[IMP] account: multi company domain on product account fields

As we have to set account on product and product category to know in which
account generate some accounting entries in some business flow (e.i.: expense),
we need to keep some consistence with those accounts.
Since those fields are company dependent, meaning their value depends on the
current company, we want to ease the selection for the end user by only displaying
the relation available in the current company. To do so, specific domain are needed.
This guidelines should be applyied on each property fields.

Task-1999686
This commit is contained in:
jem-odoo
2019-09-05 07:48:32 +00:00
parent 1a36d98e5f
commit 14ec06e04a
+4 -4
View File
@@ -9,11 +9,11 @@ class ProductCategory(models.Model):
property_account_income_categ_id = fields.Many2one('account.account', company_dependent=True,
string="Income Account",
domain=[('deprecated', '=', False)],
domain="['&', ('deprecated', '=', False), ('company_id', '=', current_company_id)]",
help="This account will be used when validating a customer invoice.")
property_account_expense_categ_id = fields.Many2one('account.account', company_dependent=True,
string="Expense Account",
domain=[('deprecated', '=', False)],
domain="['&', ('deprecated', '=', False), ('company_id', '=', current_company_id)]",
help="The expense is accounted for when a vendor bill is validated, except in anglo-saxon accounting with perpetual inventory valuation in which case the expense (Cost of Goods Sold account) is recognized at the customer invoice validation.")
#----------------------------------------------------------
@@ -28,11 +28,11 @@ class ProductTemplate(models.Model):
domain=[('type_tax_use', '=', 'purchase')], default=lambda self: self.env.company.account_purchase_tax_id)
property_account_income_id = fields.Many2one('account.account', company_dependent=True,
string="Income Account",
domain=[('deprecated', '=', False)],
domain="['&', ('deprecated', '=', False), ('company_id', '=', current_company_id)]",
help="Keep this field empty to use the default value from the product category.")
property_account_expense_id = fields.Many2one('account.account', company_dependent=True,
string="Expense Account",
domain=[('deprecated', '=', False)],
domain="['&', ('deprecated', '=', False), ('company_id', '=', current_company_id)]",
help="Keep this field empty to use the default value from the product category. If anglo-saxon accounting with automated valuation method is configured, the expense account on the product category will be used.")
def _get_product_accounts(self):