diff --git a/addons/account/models/company.py b/addons/account/models/company.py index 9841de22c83..11e02db2baa 100644 --- a/addons/account/models/company.py +++ b/addons/account/models/company.py @@ -555,3 +555,16 @@ class ResCompany(models.Model): results_by_journal['results'].append(rslt) return results_by_journal + + def get_fiscal_country(self): + """ Returns the country to be used for this company's tax report. + By default, it'll be the one from the address; but a config parameter + may be used for each company to customize that behavior. + """ + self.ensure_one() + + fiscal_country_key = 'account_fiscal_country_%s' % self.id + forced_country_code = self.env['ir.config_parameter'].get_param(fiscal_country_key) + forced_country = forced_country_code and self.env['res.country'].search([('code', 'ilike', forced_country_code)], limit=1) + + return forced_country or self.country_id