diff --git a/addons/account/models/account.py b/addons/account/models/account.py index 6e7b87d3423..eb86c2da02f 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -1071,16 +1071,20 @@ class AccountTax(models.Model): rslt = super(AccountTax, self).default_get(vals + ['company_id']) company_id = rslt.get('company_id') + company = self.env['res.company'].browse(company_id) + if 'refund_repartition_line_ids' in vals: + # We write on the related country_id field so that the field is recomputed. Without that, it will stay empty until we save the record. rslt['refund_repartition_line_ids'] = [ - (0, 0, { 'repartition_type': 'base', 'factor_percent': 100.0, 'tag_ids': [], 'company_id': company_id}), - (0, 0, { 'repartition_type': 'tax', 'factor_percent': 100.0, 'tag_ids': [], 'company_id': company_id}), + (0, 0, { 'repartition_type': 'base', 'factor_percent': 100.0, 'tag_ids': [], 'company_id': company_id, 'country_id': company.country_id.id}), + (0, 0, { 'repartition_type': 'tax', 'factor_percent': 100.0, 'tag_ids': [], 'company_id': company_id, 'country_id': company.country_id.id}), ] if 'invoice_repartition_line_ids' in vals: + # We write on the related country_id field so that the field is recomputed. Without that, it will stay empty until we save the record. rslt['invoice_repartition_line_ids'] = [ - (0, 0, { 'repartition_type': 'base', 'factor_percent': 100.0, 'tag_ids': [], 'company_id': company_id}), - (0, 0, { 'repartition_type': 'tax', 'factor_percent': 100.0, 'tag_ids': [], 'company_id': company_id}), + (0, 0, { 'repartition_type': 'base', 'factor_percent': 100.0, 'tag_ids': [], 'company_id': company_id, 'country_id': company.country_id.id}), + (0, 0, { 'repartition_type': 'tax', 'factor_percent': 100.0, 'tag_ids': [], 'company_id': company_id, 'country_id': company.country_id.id}), ] return rslt