Skip to content

Commit

Permalink
[MIG] purchase_sale_inter_company: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cuongnmtm committed Mar 26, 2024
1 parent 4dd86a6 commit fd9e02d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 30 deletions.
2 changes: 1 addition & 1 deletion purchase_sale_inter_company/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"name": "Inter Company Module for Purchase to Sale Order",
"summary": "Intercompany PO/SO rules",
"version": "16.0.1.1.1",
"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)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ def setUpClass(cls):
# Create purchase order
cls.purchase_company_a = cls._create_purchase_order(cls.partner_company_b)

# Configure pricelist to USD
# Configure pricelist to EUR
cls.env["product.pricelist"].sudo().search([]).write(
{"currency_id": cls.env.ref("base.USD").id}
{"currency_id": cls.env.ref("base.EUR").id}
)

def _approve_po(self):
Expand Down Expand Up @@ -128,7 +128,7 @@ def test_raise_product_access(self):
self._approve_po()

def test_raise_currency(self):
currency = self.env.ref("base.EUR")
currency = self.env.ref("base.USD")
self.purchase_company_a.currency_id = currency
with self.assertRaises(UserError):
self._approve_po()
Expand Down Expand Up @@ -162,6 +162,7 @@ def test_cancel_confirmed_po_so(self):
self.purchase_company_a.with_user(self.user_company_a).button_cancel()

def test_so_change_price(self):
self.company_b.sale_auto_validation = False
sale = self._approve_po()
sale.order_line.price_unit = 10
sale.action_confirm()
Expand All @@ -182,6 +183,7 @@ def test_update_open_sale_order(self):
When the purchase user request extra product, the sale order gets synched if
it's open.
"""
self.company_b.sale_auto_validation = False
purchase = self.purchase_company_a
sale = self._approve_po()
sale.action_confirm()
Expand Down
54 changes: 28 additions & 26 deletions purchase_sale_inter_company/views/res_config_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,34 @@
ref="account_invoice_inter_company.res_config_settings_view_form"
/>
<field name="arch" type="xml">
<xpath
expr="//div[@id='inter_company_invoice_validation']"
position='after'
>
<div class="o_form_label mt8">Purchase/Sale</div>
<div id="inter_company_so_from_po">
<field name="so_from_po" class="oe_inline" />
<label
string="Sale from purchase"
class="o_light_label"
for="so_from_po"
/>
</div>
<div
id="inter_company_settings"
attrs="{'invisible':['|', ('company_id', '=', False), ('so_from_po', '=', False)]}"
>
<label for="intercompany_sale_user_id" class="o_light_label" />
<field
name="intercompany_sale_user_id"
attrs="{'required': [('so_from_po', '=', True)]}"
class="oe_inline"
/>
<br />
<field name="sale_auto_validation" class="oe_inline" />
<label for="sale_auto_validation" class="oe_inline o_light_label" />
<xpath expr="//setting[@id='inter_company_oca']" position='inside'>
<div class="text-decoration-underline mt8 mb8">Purchase / Sale</div>
<div class="content-group">
<div>
<label
string="Sale from purchase"
class="o_light_label mr8"
for="so_from_po"
/>
<field name="so_from_po" class="oe_inline" />
</div>
<div invisible="not company_id or not so_from_po">
<label
for="intercompany_sale_user_id"
class="o_light_label mr8"
/>
<field
name="intercompany_sale_user_id"
required="so_from_po"
class="oe_inline mr8"
/>
<br />
<label
for="sale_auto_validation"
class="oe_inline o_light_label mr8"
/>
<field name="sale_auto_validation" class="oe_inline" />
</div>
</div>
</xpath>
</field>
Expand Down

0 comments on commit fd9e02d

Please sign in to comment.