Merge branch 'mig/12.0/l10n_us_hr_payroll__2020' into '12.0-test'

mig/12.0/l10n_us_hr_payroll__2020 into 12.0-test

See merge request hibou-io/hibou-odoo/suite!239
This commit is contained in:
Hibou Bot
2020-01-10 15:03:17 +00:00

View File

@@ -76,6 +76,8 @@ def migrate(cr, installed_version):
# Some added rules should have the same accounting side effects of other migrated rules
# To ease the transition, we will copy the accounting fields from one to the other.
rule_model = env['hr.salary.rule']
if hasattr(rule_model, 'account_debit'):
for source, destinations in XMLIDS_COPY_ACCOUNTING_2020.items():
source_rule = env.ref(source, raise_if_not_found=False)
if source_rule:
@@ -86,4 +88,6 @@ def migrate(cr, installed_version):
destination_rule.write({
'account_debit': source_rule.account_debit.id,
'account_credit': source_rule.account_credit.id,
'account_tax_id': source_rule.account_tax_id.id,
'analytic_account_id': source_rule.analytic_account_id.id,
})