Enforce company of parent/childs of chart of accounts

issue11613
review417611003
This commit is contained in:
Cédric Krier committed 2022-08-06 10:46:17 +02:00
1 parent d3753f4846
commit 82396fc083
2 files changed
+27 -7

No files matched your search

+8 -2
View File
@@ -884,11 +884,17 @@ class Account(
help="The type used if not empty and debit < credit.")
parent = fields.Many2One(
'account.account', 'Parent', select=True,
left="left", right="right", ondelete="RESTRICT", states=_states)
left="left", right="right", ondelete="RESTRICT", states=_states,
domain=[
('company', '=', Eval('company', -1)),
])
left = fields.Integer('Left', required=True, select=True)
right = fields.Integer('Right', required=True, select=True)
childs = fields.One2Many(
'account.account', 'parent', 'Children')
'account.account', 'parent', "Children",
domain=[
('company', '=', Eval('company', -1)),
])
balance = fields.Function(Monetary(
"Balance", currency='currency', digits='currency'),
'get_balance')
+19 -5
View File
@@ -134,9 +134,16 @@ class TaxCode(
company = fields.Many2One('company.company', 'Company', required=True,
select=True)
parent = fields.Many2One(
'account.tax.code', 'Parent', select=True, states=_states)
'account.tax.code', "Parent", select=True, states=_states,
domain=[
('company', '=', Eval('company', -1)),
])
lines = fields.One2Many('account.tax.code.line', 'code', "Lines")
childs = fields.One2Many('account.tax.code', 'parent', 'Children')
childs = fields.One2Many(
'account.tax.code', 'parent', "Children",
domain=[
('company', '=', Eval('company', -1)),
])
currency = fields.Function(fields.Many2One('currency.currency',
'Currency'), 'on_change_with_currency')
amount = fields.Function(Monetary(
@@ -781,9 +788,16 @@ class Tax(sequence_ordered(), ModelSQL, ModelView, DeactivableMixin):
},
help=('If checked then the unit price for further tax computation will'
' be modified by this tax.'))
parent = fields.Many2One('account.tax', 'Parent', ondelete='CASCADE',
states=_states)
childs = fields.One2Many('account.tax', 'parent', 'Children')
parent = fields.Many2One(
'account.tax', "Parent", ondelete='CASCADE', states=_states,
domain=[
('company', '=', Eval('company', -1)),
])
childs = fields.One2Many(
'account.tax', 'parent', "Children",
domain=[
('company', '=', Eval('company', -1)),
])
company = fields.Many2One(
'company.company', "Company", required=True, select=True)
invoice_account = fields.Many2One('account.account', 'Invoice Account',