Skip to content

Commit

Permalink
[MIG] : Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
miquelalzanillas committed May 7, 2024
1 parent 860ed49 commit cd81278
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions account_analytic_tag/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


def pre_init_hook(cr):
def pre_init_hook(env):
# In case you come from a previous version, reuse the security group, and avoid
# to crash due to 2 groups with the same name.
cr.execute(
env.cr.execute(
"""UPDATE ir_model_data
SET module='account_analytic_tag'
WHERE module='analytic' and name='group_analytic_tags'
Expand Down
4 changes: 3 additions & 1 deletion account_analytic_tag/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ def _prepare_analytic_lines(self):
vals = super()._prepare_analytic_lines()
if self.analytic_tag_ids:
for val in vals:
account_id = val.get("account_id")
account_id = [
value for key, value in val.items() if key.startswith("x_plan")
][0]
tags = self.analytic_tag_ids.filtered(
lambda x, y=account_id: not x.account_analytic_id
or x.account_analytic_id.id == y
Expand Down
9 changes: 7 additions & 2 deletions account_analytic_tag/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ def setUpClass(cls):
cls.user = new_test_user(
cls.env,
login="test-analytic-tag-user",
groups="account.group_account_invoice \
analytic.group_analytic_accounting \
groups="account.group_account_invoice, analytic.group_analytic_accounting, \
account_analytic_tag.group_analytic_tags",
)
# ==== For Accounting ====
cls.default_company_id = cls.env["res.company"].browse(1)
# Set chart template
cls.default_company_id._chart_template_selection()
cls.default_journal_id = cls.env["account.journal"].create(
{"name": "Test Journal", "type": "sale", "code": "TST"}
)
cls.default_plan = cls.env["account.analytic.plan"].create({"name": "Default"})
cls.analytic_account_a = cls.env["account.analytic.account"].create(
{
Expand Down
2 changes: 1 addition & 1 deletion account_analytic_tag/views/account_analytic_tag_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
name="web_ribbon"
title="Archived"
bg_color="bg-danger"
attrs="{'invisible': [('active', '=', True)]}"
invisible="active == True"
/>
<group>
<group>
Expand Down
2 changes: 1 addition & 1 deletion account_analytic_tag/views/res_config_settings_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[@id='track_costs_revenues']" position="after">
<xpath expr="//setting[@id='track_costs_revenues']" position="after">
<div
class="col-12 col-lg-6 o_setting_box"
id="tag_analytic_entries"
Expand Down

0 comments on commit cd81278

Please sign in to comment.