Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
3c21b1a
[ADD][15.0] purchase_sale_stock_inter_company
yankinmax Aug 5, 2022
ea1d905
[15.0][IMP] purchase_sale_stock_inter_company:
JasminSForgeFlow Jan 3, 2023
82ef54c
[IMP] purchase_sale_stock_inter_company: reflect purpose of module
MiquelRForgeFlow Feb 8, 2023
b778c3b
[IMP] purchase_sale_stock_inter_company: pre-commit stuff
chafique-delli Feb 13, 2023
ba4473c
[MIG] purchase_sale_stock_inter_company: Migration to 16.0
chafique-delli Feb 13, 2023
5c6eaf0
[FIX] purchase_sale_stock_inter_company: use reserved_qty instead of …
JordiBForgeFlow Jun 12, 2023
3f54157
Translated using Weblate (Spanish)
Ivorra78 Dec 21, 2023
ef6f4a3
Translated using Weblate (Italian)
mymage Dec 22, 2023
0219211
Translated using Weblate (Italian)
francesco-ooops Dec 28, 2023
0ee5940
[IMP] purchase_sale_stock_inter_company: refactor stock picking valid…
JordiMForgeFlow Jan 22, 2024
748a133
[ADD] purchase_sale_stock_inter_company_mrp
JordiMForgeFlow Jan 22, 2024
a1c2e07
[16.0][FIX] add test: synchronize inter-company picking qty in case o…
Kev-Roche Mar 2, 2025
d08adc8
[16.0][FIX] add fix: synchronize inter-company picking qty in case of…
Kev-Roche Mar 2, 2025
4441c35
[16.0][FIX][purchase_sale_stock_inter_company] multiple products lead…
Kev-Roche Mar 15, 2025
77f288d
[12.0][IMP] purchase_sale_inter_company: add sync_picking option
MateuGForgeFlow May 25, 2022
6b038c5
[12.0][IMP] purchase_sale_inter_company: sync pickings
MateuGForgeFlow Feb 9, 2023
a73f4e1
[12.0][IMP] purchas_sale_inter_company: sync lines and moves
MateuGForgeFlow Mar 15, 2023
3dd8494
[FIX] purchase_sale_inter_company: consider moves that contain same p…
MiquelRForgeFlow Sep 6, 2023
c020045
[MIG] purchase_sale_inter_company: migrate sync pickings for v14
HekkiMelody Sep 19, 2023
9d98617
[FIX]purchase_sale_inter_company: handle pickings with lots/serials
HekkiMelody Dec 6, 2023
e4d3b1e
[FIX] purchase_sale_inter_company: sync moves with same product
HekkiMelody Dec 6, 2023
087b0b8
purchase_sale_inter_company: fix validation of several picking. self …
sebastienbeau Oct 23, 2023
9607fbe
[IMP] purchase_sale_inter_company: manage and sync state
renda-dev Dec 27, 2023
68c43ba
[IMP] purchase_sale_inter_company: remove user error on lines mismatch
renda-dev Mar 18, 2024
0031ba6
[IMP]purchase_sale_inter_company: lock incoming picking validation if…
toita86 Mar 25, 2024
57c3392
[FIX] In case of dropshipping, partner_id is the end customer so ref_…
Jun 11, 2024
4a26c06
[FIX] purchase_sale_inter_company: support 'no backorder'
Jun 18, 2024
76a33bd
[IMP] purchase_sale_inter_company: Activity instead of hard raise
Jul 4, 2024
774e4f3
[FIX] purchase_sale_inter_company: fix no attribute 'company_id'
Oct 18, 2024
e815811
[FIX] purchase_sale_inter_company: support multistep deliveries
HekkiMelody Apr 8, 2025
36b0355
[FIX] purchase_sale_stock_inter_company: Allow reception with serial …
carlos-lopez-tecnativa Nov 29, 2024
ebc916b
[IMP] purchase_sale_stock_inter_company: Synchronize move lines from …
carlos-lopez-tecnativa Dec 16, 2024
73dc7ef
[IMP] purchase_sale_stock_inter_company: pre-commit auto fixes
namtnt Jul 7, 2025
dc06c48
[MIG] purchase_sale_stock_inter_company: Migration to 17.0
namtnt Jun 6, 2025
f34ddc2
[MIG] purchase_sale_stock_inter_company: Finish migration to version …
carlos-lopez-tecnativa Jul 8, 2025
503ad7b
[FIX] purchase_sale_inter_company: fix demo data
HekkiMelody Dec 20, 2023
8ff490b
[MIG] purchase_sale_inter_company: allow reuse of utilities in anothe…
carlos-lopez-tecnativa Jul 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@ def _configure_user(cls, user):
user.groups_id |= cls.env.ref(xml)

@classmethod
def _create_purchase_order(cls, partner):
def _create_purchase_order(cls, partner, products=None):
if not products:
products = [None]

po = Form(cls.env["purchase.order"])
po.company_id = cls.company_a
po.partner_id = partner

cls.product.invoice_policy = "order"

with po.order_line.new() as line_form:
line_form.product_id = cls.product
line_form.product_qty = 3.0
line_form.name = "Service Multi Company"
line_form.price_unit = 450.0
for product in products:
with po.order_line.new() as line_form:
line_form.product_id = product or cls.product
line_form.product_qty = 3.0
line_form.price_unit = 450.0
return po.save()

@classmethod
Expand Down Expand Up @@ -113,19 +116,21 @@ def setUpClass(cls):
}
)

def _approve_po(self):
def _approve_po(self, purchase_to_approve=None):
"""Confirm the PO in company A and return the related sale of Company B"""
parnter_company = self.purchase_company_a.company_id.partner_id.company_id
if not purchase_to_approve:
purchase_to_approve = self.purchase_company_a
parnter_company = purchase_to_approve.company_id.partner_id.company_id
assert not parnter_company, (
"The partner should not have a company set, otherwise the "
"intercompany_sale_order_id will not be computed properly. Current "
f"partner company_id: {parnter_company.name}"
)
self.purchase_company_a.with_user(self.user_company_a).button_approve()
purchase_to_approve.with_user(self.user_company_a).button_approve()
return (
self.env["sale.order"]
.with_user(self.user_company_b)
.search([("auto_purchase_order_id", "=", self.purchase_company_a.id)])
.search([("auto_purchase_order_id", "=", purchase_to_approve.id)])
)

def test_purchase_sale_inter_company(self):
Expand Down
149 changes: 149 additions & 0 deletions purchase_sale_stock_inter_company/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
==============================================================
Inter Company Module for Purchase to Sale Order with warehouse
==============================================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:94426490230688dfaec009199b08ce4bd7d916315a363e73c74bb7469a3cf705
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmulti--company-lightgray.png?logo=github
:target: https://github.com/OCA/multi-company/tree/17.0/purchase_sale_stock_inter_company
:alt: OCA/multi-company
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/multi-company-17-0/multi-company-17-0-purchase_sale_stock_inter_company
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/multi-company&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module is a glue module and is auto installed if
purchase_sale_inter_company, sale_stock and purchase_stock modules are
installed. Full purpose description can be found in
purchase_sale_inter_company.

In addition to the features provided by purchase_sale_inter_company,
which automatically creates inter-company Sale Orders from Purchase
Orders, this module extends the functionality by automatically
validating the corresponding inter-company receipts when the Delivery
Order is confirmed. During this process, lot/serial numbers and
quantities are synchronized to ensure consistency across companies.

The configuration includes an option to specify a default Warehouse that
will be automatically assigned to Sale Orders generated from Purchase
Orders addressed to this company.

When Company A sends a product tracked by lot or serial number, a new
lot/serial number with the same name is created in Company B to match
it, if one doesn't already exist.

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure this module, you need to: #. Go to the menu *Settings >
General Settings*. #. Go to the tab *Companies / Inter Company OCA
features*, in the group *Purchase/Sale*, check the option *Sale from
purchase*. #. Then, select the *Warehouse for Sale Orders*, it is the
warehouse that will be used to automatically generate the sale order in
the other company.

1. If you check the option "Sync picking" (for both companies),
validating a picking generated by an inter-company purchase/sale will
validate the respective picking for the other company.
2. If you check the option "Block manual validation of picking in the
destination company" is not possible to validate manually the picking
in the destination company.

Known issues / Roadmap
======================

- Module is not very robust in complex situations, such as multi-step
receipts and multi-step deliveries, with backorders. Multi-step
receipts could be improved further.
- This module does not sync packages.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/multi-company/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/multi-company/issues/new?body=module:%20purchase_sale_stock_inter_company%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Odoo SA
* Akretion
* Tecnativa

Contributors
------------

- Adria Gil Sorribes <adria.gil@forgeflow.com>
- \`Akretion <https://www.akretion.com>\`:

- Chafique Delli <chafique.delli@akretion.com>
- Pierrick Brun <pierrick.brun@akretion.com>

- \`Tecnativa <https://www.tecnativa.com>\`:

- Pedro M. Baeza
- Carlos Lopez

- \`Camptocamp <https://www.camptocamp.com>\`:

- Maksym Yankin <maksym.yankin@camptocamp.com>

- `PyTech SRL <info@pytech.it>`__:

- Alessandro Uffreduzzi <alessandro.uffreduzzi@pytech.it>

- Ooops404 <info@ooops404.com>

- Francesco Foresti <francesco.foresti@ooops404.com>

- Eduard Brahas <eduardbrhas@outlook.it>
- \`Komit
<`https://komit-consulting.com\\>\\\` <https://komit-consulting.com\>\`>`__:

- Cuong Nguyen Mtm <cuong.nmtm@komit-consulting.com>
- Nam TNT <nam-tnt@komit-consulting.com>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/multi-company <https://github.com/OCA/multi-company/tree/17.0/purchase_sale_stock_inter_company>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions purchase_sale_stock_inter_company/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions purchase_sale_stock_inter_company/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2013-Today Odoo SA
# Copyright 2016-2019 Chafique DELLI @ Akretion
# Copyright 2018-2019 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Inter Company Module for Purchase to Sale Order with warehouse",
"summary": "Intercompany PO/SO rules with warehouse",
"version": "17.0.1.0.0",
"category": "Purchase Management",
"website": "https://github.com/OCA/multi-company",
"author": "Odoo SA, Akretion, Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"auto_install": True,
"depends": ["purchase_sale_inter_company", "sale_stock", "purchase_stock"],
"data": ["views/res_config_view.xml"],
"demo": ["demo/res_partner_demo.xml"],
}
13 changes: 13 additions & 0 deletions purchase_sale_stock_inter_company/demo/res_partner_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<!-- Technically a bug in `stock` module's demo data,
Just changing these fields to make it easier to test the module
The route for location "Inter-warehouse transit" doesn't exist
causing an error when creating the intercompany SO with demo data -->
<record id="stock.res_partner_address_41" model="res.partner">
<field name="property_stock_customer" ref="stock.stock_location_customers" />
<field name="property_stock_supplier" ref="stock.stock_location_suppliers" />
</record>

</odoo>
79 changes: 79 additions & 0 deletions purchase_sale_stock_inter_company/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_sale_stock_inter_company
#
# Translators:
# Rudolf Schnapka <rs@techno-flex.de>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-08-05 13:15+0000\n"
"PO-Revision-Date: 2017-04-22 02:48+0000\n"
"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>, 2017\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: purchase_sale_stock_inter_company
#: model:ir.model,name:purchase_sale_stock_inter_company.model_res_company
msgid "Companies"
msgstr "Unternehmen"

#. module: purchase_sale_stock_inter_company
#: model:ir.model,name:purchase_sale_stock_inter_company.model_res_config_settings
msgid "Config Settings"
msgstr ""

#. module: purchase_sale_stock_inter_company
#: model:ir.model.fields,help:purchase_sale_stock_inter_company.field_res_company__warehouse_id
msgid ""
"Default value to set on Sale Orders that will be created based on Purchase "
"Orders made to this company"
msgstr ""

#. module: purchase_sale_stock_inter_company
#: model:ir.model.fields,help:purchase_sale_stock_inter_company.field_res_config_settings__warehouse_id
msgid ""
"Default value to set on Sale Orders that will be created based on Purchase "
"Orders made to this company."
msgstr ""

#. module: purchase_sale_stock_inter_company
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_stock_picking__intercompany_picking_id
msgid "Intercompany Picking"
msgstr ""

#. module: purchase_sale_stock_inter_company
#: model:ir.model,name:purchase_sale_stock_inter_company.model_purchase_order
msgid "Purchase Order"
msgstr ""

#. module: purchase_sale_stock_inter_company
#: code:addons/purchase_sale_stock_inter_company/models/stock_picking.py:0
#, python-format
msgid ""
"There's no corresponding line in PO %(po)s for assigning qty from "
"%(pick_name)s for product %(product)s"
msgstr ""

#. module: purchase_sale_stock_inter_company
#: model:ir.model,name:purchase_sale_stock_inter_company.model_stock_picking
msgid "Transfer"
msgstr ""

#. module: purchase_sale_stock_inter_company
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_res_company__warehouse_id
msgid "Warehouse For Sale Orders"
msgstr ""

#. module: purchase_sale_stock_inter_company
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_res_config_settings__warehouse_id
msgid "Warehouse for Sale Orders"
msgstr ""

#~ msgid "Invoice"
#~ msgstr "Rechnung"
Loading