| 1 |
from odoo import api, models, Command |
| 2 |
|
| 3 |
|
| 4 |
class AccountChartTemplate(models.AbstractModel): |
| 5 |
_inherit = "account.chart.template" |
| 6 |
|
| 7 |
@api.model |
| 8 |
def _get_demo_data(self, company=False): |
| 9 |
def link_tag(tag_xml_id): |
| 10 |
tag = self.env.ref(tag_xml_id, raise_if_not_found=False) |
| 11 |
return [Command.link(tag.id)] if tag else [] |
| 12 |
|
| 13 |
demo_data = super()._get_demo_data(company) |
| 14 |
if company.chart_template.startswith('be'): |
| 15 |
cid = company.id |
| 16 |
account_data = demo_data.setdefault('account.account', {}) |
| 17 |
account_tag_map = { |
| 18 |
'a100': 'account.demo_capital_account', |
| 19 |
'a300': 'account.demo_stock_account', |
| 20 |
'a7600': 'account.demo_sale_of_land_account', |
| 21 |
'a6201': 'account.demo_ceo_wages_account', |
| 22 |
'a240000': 'account.demo_office_furniture_account', |
| 23 |
} |
| 24 |
account_data.update({ |
| 25 |
f"account.{cid}_{account}": {'tag_ids': link_tag(tag)} |
| 26 |
for account, tag in account_tag_map.items() |
| 27 |
}) |
| 28 |
|
| 29 |
return demo_data |