Skip to content

Commit b0eacad

Browse files
committed
Merge PR #856 into 17.0
Signed-off-by pedrobaeza
2 parents bc1555a + 8ff490b commit b0eacad

29 files changed

Lines changed: 2875 additions & 10 deletions

purchase_sale_inter_company/tests/test_inter_company_purchase_sale.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,21 @@ def _configure_user(cls, user):
2323
user.groups_id |= cls.env.ref(xml)
2424

2525
@classmethod
26-
def _create_purchase_order(cls, partner):
26+
def _create_purchase_order(cls, partner, products=None):
27+
if not products:
28+
products = [None]
29+
2730
po = Form(cls.env["purchase.order"])
2831
po.company_id = cls.company_a
2932
po.partner_id = partner
3033

3134
cls.product.invoice_policy = "order"
3235

33-
with po.order_line.new() as line_form:
34-
line_form.product_id = cls.product
35-
line_form.product_qty = 3.0
36-
line_form.name = "Service Multi Company"
37-
line_form.price_unit = 450.0
36+
for product in products:
37+
with po.order_line.new() as line_form:
38+
line_form.product_id = product or cls.product
39+
line_form.product_qty = 3.0
40+
line_form.price_unit = 450.0
3841
return po.save()
3942

4043
@classmethod
@@ -113,19 +116,21 @@ def setUpClass(cls):
113116
}
114117
)
115118

116-
def _approve_po(self):
119+
def _approve_po(self, purchase_to_approve=None):
117120
"""Confirm the PO in company A and return the related sale of Company B"""
118-
parnter_company = self.purchase_company_a.company_id.partner_id.company_id
121+
if not purchase_to_approve:
122+
purchase_to_approve = self.purchase_company_a
123+
parnter_company = purchase_to_approve.company_id.partner_id.company_id
119124
assert not parnter_company, (
120125
"The partner should not have a company set, otherwise the "
121126
"intercompany_sale_order_id will not be computed properly. Current "
122127
f"partner company_id: {parnter_company.name}"
123128
)
124-
self.purchase_company_a.with_user(self.user_company_a).button_approve()
129+
purchase_to_approve.with_user(self.user_company_a).button_approve()
125130
return (
126131
self.env["sale.order"]
127132
.with_user(self.user_company_b)
128-
.search([("auto_purchase_order_id", "=", self.purchase_company_a.id)])
133+
.search([("auto_purchase_order_id", "=", purchase_to_approve.id)])
129134
)
130135

131136
def test_purchase_sale_inter_company(self):
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
==============================================================
2+
Inter Company Module for Purchase to Sale Order with warehouse
3+
==============================================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:94426490230688dfaec009199b08ce4bd7d916315a363e73c74bb7469a3cf705
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmulti--company-lightgray.png?logo=github
20+
:target: https://github.com/OCA/multi-company/tree/17.0/purchase_sale_stock_inter_company
21+
:alt: OCA/multi-company
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/multi-company-17-0/multi-company-17-0-purchase_sale_stock_inter_company
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/multi-company&target_branch=17.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module is a glue module and is auto installed if
32+
purchase_sale_inter_company, sale_stock and purchase_stock modules are
33+
installed. Full purpose description can be found in
34+
purchase_sale_inter_company.
35+
36+
In addition to the features provided by purchase_sale_inter_company,
37+
which automatically creates inter-company Sale Orders from Purchase
38+
Orders, this module extends the functionality by automatically
39+
validating the corresponding inter-company receipts when the Delivery
40+
Order is confirmed. During this process, lot/serial numbers and
41+
quantities are synchronized to ensure consistency across companies.
42+
43+
The configuration includes an option to specify a default Warehouse that
44+
will be automatically assigned to Sale Orders generated from Purchase
45+
Orders addressed to this company.
46+
47+
When Company A sends a product tracked by lot or serial number, a new
48+
lot/serial number with the same name is created in Company B to match
49+
it, if one doesn't already exist.
50+
51+
**Table of contents**
52+
53+
.. contents::
54+
:local:
55+
56+
Configuration
57+
=============
58+
59+
To configure this module, you need to: #. Go to the menu *Settings >
60+
General Settings*. #. Go to the tab *Companies / Inter Company OCA
61+
features*, in the group *Purchase/Sale*, check the option *Sale from
62+
purchase*. #. Then, select the *Warehouse for Sale Orders*, it is the
63+
warehouse that will be used to automatically generate the sale order in
64+
the other company.
65+
66+
1. If you check the option "Sync picking" (for both companies),
67+
validating a picking generated by an inter-company purchase/sale will
68+
validate the respective picking for the other company.
69+
2. If you check the option "Block manual validation of picking in the
70+
destination company" is not possible to validate manually the picking
71+
in the destination company.
72+
73+
Known issues / Roadmap
74+
======================
75+
76+
- Module is not very robust in complex situations, such as multi-step
77+
receipts and multi-step deliveries, with backorders. Multi-step
78+
receipts could be improved further.
79+
- This module does not sync packages.
80+
81+
Bug Tracker
82+
===========
83+
84+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/multi-company/issues>`_.
85+
In case of trouble, please check there if your issue has already been reported.
86+
If you spotted it first, help us to smash it by providing a detailed and welcomed
87+
`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**>`_.
88+
89+
Do not contact contributors directly about support or help with technical issues.
90+
91+
Credits
92+
=======
93+
94+
Authors
95+
-------
96+
97+
* Odoo SA
98+
* Akretion
99+
* Tecnativa
100+
101+
Contributors
102+
------------
103+
104+
- Adria Gil Sorribes <adria.gil@forgeflow.com>
105+
- \`Akretion <https://www.akretion.com>\`:
106+
107+
- Chafique Delli <chafique.delli@akretion.com>
108+
- Pierrick Brun <pierrick.brun@akretion.com>
109+
110+
- \`Tecnativa <https://www.tecnativa.com>\`:
111+
112+
- Pedro M. Baeza
113+
- Carlos Lopez
114+
115+
- \`Camptocamp <https://www.camptocamp.com>\`:
116+
117+
- Maksym Yankin <maksym.yankin@camptocamp.com>
118+
119+
- `PyTech SRL <info@pytech.it>`__:
120+
121+
- Alessandro Uffreduzzi <alessandro.uffreduzzi@pytech.it>
122+
123+
- Ooops404 <info@ooops404.com>
124+
125+
- Francesco Foresti <francesco.foresti@ooops404.com>
126+
127+
- Eduard Brahas <eduardbrhas@outlook.it>
128+
- \`Komit
129+
<`https://komit-consulting.com\\>\\\` <https://komit-consulting.com\>\`>`__:
130+
131+
- Cuong Nguyen Mtm <cuong.nmtm@komit-consulting.com>
132+
- Nam TNT <nam-tnt@komit-consulting.com>
133+
134+
Maintainers
135+
-----------
136+
137+
This module is maintained by the OCA.
138+
139+
.. image:: https://odoo-community.org/logo.png
140+
:alt: Odoo Community Association
141+
:target: https://odoo-community.org
142+
143+
OCA, or the Odoo Community Association, is a nonprofit organization whose
144+
mission is to support the collaborative development of Odoo features and
145+
promote its widespread use.
146+
147+
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.
148+
149+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2013-Today Odoo SA
2+
# Copyright 2016-2019 Chafique DELLI @ Akretion
3+
# Copyright 2018-2019 Tecnativa - Carlos Dauden
4+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
5+
6+
{
7+
"name": "Inter Company Module for Purchase to Sale Order with warehouse",
8+
"summary": "Intercompany PO/SO rules with warehouse",
9+
"version": "17.0.1.0.0",
10+
"category": "Purchase Management",
11+
"website": "https://github.com/OCA/multi-company",
12+
"author": "Odoo SA, Akretion, Tecnativa, Odoo Community Association (OCA)",
13+
"license": "AGPL-3",
14+
"installable": True,
15+
"auto_install": True,
16+
"depends": ["purchase_sale_inter_company", "sale_stock", "purchase_stock"],
17+
"data": ["views/res_config_view.xml"],
18+
"demo": ["demo/res_partner_demo.xml"],
19+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<odoo>
3+
4+
<!-- Technically a bug in `stock` module's demo data,
5+
Just changing these fields to make it easier to test the module
6+
The route for location "Inter-warehouse transit" doesn't exist
7+
causing an error when creating the intercompany SO with demo data -->
8+
<record id="stock.res_partner_address_41" model="res.partner">
9+
<field name="property_stock_customer" ref="stock.stock_location_customers" />
10+
<field name="property_stock_supplier" ref="stock.stock_location_suppliers" />
11+
</record>
12+
13+
</odoo>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * purchase_sale_stock_inter_company
4+
#
5+
# Translators:
6+
# Rudolf Schnapka <rs@techno-flex.de>, 2017
7+
msgid ""
8+
msgstr ""
9+
"Project-Id-Version: Odoo Server 8.0\n"
10+
"Report-Msgid-Bugs-To: \n"
11+
"POT-Creation-Date: 2022-08-05 13:15+0000\n"
12+
"PO-Revision-Date: 2017-04-22 02:48+0000\n"
13+
"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>, 2017\n"
14+
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
15+
"Language: de\n"
16+
"MIME-Version: 1.0\n"
17+
"Content-Type: text/plain; charset=UTF-8\n"
18+
"Content-Transfer-Encoding: \n"
19+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
20+
21+
#. module: purchase_sale_stock_inter_company
22+
#: model:ir.model,name:purchase_sale_stock_inter_company.model_res_company
23+
msgid "Companies"
24+
msgstr "Unternehmen"
25+
26+
#. module: purchase_sale_stock_inter_company
27+
#: model:ir.model,name:purchase_sale_stock_inter_company.model_res_config_settings
28+
msgid "Config Settings"
29+
msgstr ""
30+
31+
#. module: purchase_sale_stock_inter_company
32+
#: model:ir.model.fields,help:purchase_sale_stock_inter_company.field_res_company__warehouse_id
33+
msgid ""
34+
"Default value to set on Sale Orders that will be created based on Purchase "
35+
"Orders made to this company"
36+
msgstr ""
37+
38+
#. module: purchase_sale_stock_inter_company
39+
#: model:ir.model.fields,help:purchase_sale_stock_inter_company.field_res_config_settings__warehouse_id
40+
msgid ""
41+
"Default value to set on Sale Orders that will be created based on Purchase "
42+
"Orders made to this company."
43+
msgstr ""
44+
45+
#. module: purchase_sale_stock_inter_company
46+
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_stock_picking__intercompany_picking_id
47+
msgid "Intercompany Picking"
48+
msgstr ""
49+
50+
#. module: purchase_sale_stock_inter_company
51+
#: model:ir.model,name:purchase_sale_stock_inter_company.model_purchase_order
52+
msgid "Purchase Order"
53+
msgstr ""
54+
55+
#. module: purchase_sale_stock_inter_company
56+
#: code:addons/purchase_sale_stock_inter_company/models/stock_picking.py:0
57+
#, python-format
58+
msgid ""
59+
"There's no corresponding line in PO %(po)s for assigning qty from "
60+
"%(pick_name)s for product %(product)s"
61+
msgstr ""
62+
63+
#. module: purchase_sale_stock_inter_company
64+
#: model:ir.model,name:purchase_sale_stock_inter_company.model_stock_picking
65+
msgid "Transfer"
66+
msgstr ""
67+
68+
#. module: purchase_sale_stock_inter_company
69+
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_res_company__warehouse_id
70+
msgid "Warehouse For Sale Orders"
71+
msgstr ""
72+
73+
#. module: purchase_sale_stock_inter_company
74+
#: model:ir.model.fields,field_description:purchase_sale_stock_inter_company.field_res_config_settings__warehouse_id
75+
msgid "Warehouse for Sale Orders"
76+
msgstr ""
77+
78+
#~ msgid "Invoice"
79+
#~ msgstr "Rechnung"

0 commit comments

Comments
 (0)