Skip to content

Commit

Permalink
[PATCH] upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
parthivgls committed Dec 4, 2024
1 parent 5b68d61 commit 9a2bdec
Show file tree
Hide file tree
Showing 487 changed files with 8,904 additions and 2,889 deletions.
37 changes: 35 additions & 2 deletions addons/account/demo/account_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ class AccountChartTemplate(models.AbstractModel):
@api.model
def _get_demo_data(self, company=False):
"""Generate the demo data related to accounting."""
# This is a generator because data created here might be referenced by xml_id to data
# created later but defined in this same function.
return {
**self._get_demo_data_products(company),
'account.move': self._get_demo_data_move(company),
'account.bank.statement': self._get_demo_data_statement(company),
'account.bank.statement.line': self._get_demo_data_transactions(company),
Expand All @@ -29,6 +28,40 @@ def _get_demo_data(self, company=False):
'mail.activity': self._get_demo_data_mail_activity(company),
}

def _get_demo_exception_product_template_xml_ids(self):
""" Return demo product template xml ids to not put taxes on"""
return []

def _get_demo_exception_product_variant_xml_ids(self):
""" Return demo product variant xml ids to not put taxes on"""
return ['product.office_combo']

def _get_demo_data_products(self, company):
# Only needed for the first company
if company != self.env.ref('base.main_company', raise_if_not_found=False):
return {}

taxes = {}
if company.account_sale_tax_id:
taxes.update({'taxes_id': [Command.link(company.account_sale_tax_id.id)]})
if company.account_purchase_tax_id:
taxes.update({'supplier_taxes_id': [Command.link(company.account_purchase_tax_id.id)]})
if not taxes:
return {}
IMD = self.env['ir.model.data'].sudo()
product_templates = sorted(
set(IMD.search([('model', '=', 'product.template')]).mapped('complete_name'))
- set(self._get_demo_exception_product_template_xml_ids())
)
product_variants = sorted(
set(IMD.search([('model', '=', 'product.product')]).mapped('complete_name'))
- set(self._get_demo_exception_product_variant_xml_ids())
)
return {
'product.template': {d: taxes for d in product_templates},
'product.product': {d: taxes for d in product_variants},
}

def _post_load_demo_data(self, company=False):
invoices = (
self.ref('demo_invoice_1')
Expand Down
6 changes: 2 additions & 4 deletions addons/account/i18n/ar.po
Original file line number Diff line number Diff line change
Expand Up @@ -13970,11 +13970,9 @@ msgstr ""
#: code:addons/account/models/chart_template.py:0
#, python-format
msgid ""
"The Syscohada chart template shouldn't be selected directly. Instead, you "
"should directly select the chart template related to your country."
"The %s chart template shouldn't be selected directly. Instead, you should "
"directly select the chart template related to your country."
msgstr ""
"The Syscohada chart template shouldn't be selected directly. Instead, you "
"should directly select the chart template related to your country."

#. module: account
#. flectra-python
Expand Down
4 changes: 2 additions & 2 deletions addons/account/i18n/az.po
Original file line number Diff line number Diff line change
Expand Up @@ -13711,8 +13711,8 @@ msgstr ""
#: code:addons/account/models/chart_template.py:0
#, python-format
msgid ""
"The Syscohada chart template shouldn't be selected directly. Instead, you "
"should directly select the chart template related to your country."
"The %s chart template shouldn't be selected directly. Instead, you should "
"directly select the chart template related to your country."
msgstr ""

#. module: account
Expand Down
Loading

0 comments on commit 9a2bdec

Please sign in to comment.