[IMP] account: tax report: add the possibility to use a different country than the company's for the tax report

Some companies have their office in a country, and sell and pay taxes in another one. Before this commit, they couldn't use Odoo's tax report, as the country set on the res.company than the one to be used with their taxes. It is now possible to do that, using a config parameter.

closes odoo/odoo#52734

X-original-commit: 1728dfadeac252f5cd26d7770d044ae5f06a3352
Related: odoo/enterprise#11039
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
This commit is contained in:
oco-odoo
2020-06-09 16:42:01 +00:00
parent c058f19bfa
commit dbe537a3f8
+13
View File
@@ -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