Ensure the code works fine even if countries are deleted. Also consider "re"-created countries after deletion, by only considering the country code, not the data reference. This should reduce support requests related to deleted countries, and ease the resolution of such problems by the users themselves. TASK ID - 2368842 closes odoo/odoo#60558 X-original-commit: 037012bc4e2935eb00a7f353529bb7ec55066733 Related: odoo/enterprise#14347 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
22 lines
833 B
Python
22 lines
833 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
from odoo import fields, models, api, _
|
|
|
|
|
|
class ResPartner(models.Model):
|
|
_inherit = 'res.partner'
|
|
|
|
siret = fields.Char(string='SIRET', size=14)
|
|
|
|
class ChartTemplate(models.Model):
|
|
_inherit = 'account.chart.template'
|
|
|
|
def _prepare_all_journals(self, acc_template_ref, company, journals_dict=None):
|
|
journals = super(ChartTemplate, self)._prepare_all_journals(acc_template_ref, company, journals_dict)
|
|
if company.country_id.code == "FR":
|
|
#For France, sale/purchase journals must have a dedicated sequence for refunds
|
|
for journal in journals:
|
|
if journal['type'] in ['sale', 'purchase']:
|
|
journal['refund_sequence'] = True
|
|
return journals
|