[FIX] inter_company_rules: no warehouse defined on sale order
With: Two companies 'Company A' & 'Company B' Sequences for SO & PO for each company so_from_po set to True on 'Compny B' When: Company A created a PO with Company B as supplier, and validated it, An error is raised "Configure correct warehouse for company(Company B)..." The field warehouse_id is required on the SO, so force the user to set one in the configuration of the company
This commit is contained in:
@@ -17,8 +17,8 @@ class res_company(models.Model):
|
||||
help="When a Sale Order or a Purchase Order is created by a multi company rule for this company, it will automatically validate it")
|
||||
intercompany_user_id = fields.Many2one("res.users", string="Inter Company User", default=SUPERUSER_ID,
|
||||
help="Responsible user for creation of documents triggered by intercompany rules.")
|
||||
warehouse_id = fields.Many2one("stock.warehouse", string="Warehouse For Purchase Orders",
|
||||
help="Default value to set on Purchase Orders that will be created based on Sale Orders made to this company")
|
||||
warehouse_id = fields.Many2one("stock.warehouse", string="Warehouse For Purchase or Sale Orders",
|
||||
help="Default value to set on Purchase Orders that will be created based on Sale Orders (and reciprocally) made to this company")
|
||||
|
||||
@api.model
|
||||
def _find_company_from_partner(self, partner_id):
|
||||
|
||||
@@ -11,7 +11,10 @@
|
||||
<group string="Inter-Company Rules">
|
||||
<field name="so_from_po" attrs="{'invisible': [('auto_generate_invoices', '=', True)]}"/>
|
||||
<field name="po_from_so" attrs="{'invisible': [('auto_generate_invoices', '=', True)]}"/>
|
||||
<field name="warehouse_id" attrs="{'required': [('po_from_so', '=', True)], 'invisible': [('po_from_so', '=', False)]}" domain="[('company_id', '=', active_id)]"/>
|
||||
<field name="warehouse_id"
|
||||
attrs="{'required': ['|', ('po_from_so', '=', True), ('so_from_po', '=', True)],
|
||||
'invisible': [('po_from_so', '=', False), ('so_from_po', '=', False)]}"
|
||||
domain="[('company_id', '=', active_id)]"/>
|
||||
<field name="auto_validation" attrs="{'invisible': [('auto_generate_invoices', '=', True)]}"/>
|
||||
<field name="auto_generate_invoices" attrs="{'invisible': ['|', ('so_from_po', '=', True), ('po_from_so', '=', True)]}"/>
|
||||
<field name="intercompany_user_id" colspan="2" attrs="{'required': ['|','|',('so_from_po', '=', True), ('po_from_so', '=', True), ('auto_generate_invoices', '=', True)]}"/>
|
||||
|
||||
Reference in New Issue
Block a user