Skip to content

[MIG] account_multicompany_code: Migration to 19.0 T#96270#1726

Open
isaako34 wants to merge 13 commits intoVauxoo:19.0from
vauxoo-dev:19.0-mig-account_multicompany_code-isaako34
Open

[MIG] account_multicompany_code: Migration to 19.0 T#96270#1726
isaako34 wants to merge 13 commits intoVauxoo:19.0from
vauxoo-dev:19.0-mig-account_multicompany_code-isaako34

Conversation

@isaako34
Copy link
Copy Markdown
Contributor

@isaako34 isaako34 commented Mar 9, 2026

No description provided.

Jose Antonio Morales Ponce [Vauxoo] and others added 13 commits March 10, 2026 00:55
This removes:
- Hencoding headers, fixing lint `utf8-coding-comment`
- Headers like `# Part of Odoo`
- And other ones
The following is performed:
- Remove api.multi
- Fix indentation on data files
- Add translations
- Add tests
The following is performed:
- Adapt tests
- Update translation terms
- Fix black, isort and prettier lints
- Fix pylints in res_company model (use Python 3 style super() without arguments)
- Split the models in individual files
- Add the code field to tree and kanban view
- Define a setUpClass method for tests
- Set a SQL constraint "code_unique" for efficiency
- Rename file: company_view -> res_company_views.xml
Removing the use of the `@class` in the view, since is deprecated and is
giving warnings.
Test account and journal are created in tests, so tests may run even if
no chart of account is installed yet.
- Adapt the use of name_get as part of [1].

[1] odoo/odoo#122085
The following actions are performed:
- Adapt account display name computation for company_ids multi-company
  field.
- Update tests to use Command.link() for many2many field assignment and
  add the group group_account_readonly to test user.
- Fix XML xpath expressions for 18.0 compatibility.
@isaako34 isaako34 force-pushed the 19.0-mig-account_multicompany_code-isaako34 branch from ea04002 to 707087a Compare March 10, 2026 00:56
@isaako34
Copy link
Copy Markdown
Contributor Author

@luisg123v Could you review please?

@luisg123v luisg123v self-requested a review March 10, 2026 16:32
def _compute_display_name(self):
res = super()._compute_display_name()
for account in self.filtered(lambda a: a.company_ids):
codes = ", ".join(account.company_ids.mapped("code"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a good idea. If there are 10 companies using the same account (possible if all use the mexican CoA), the displayed name would be too big.

I think we need to discuss this to decide if it's worth it keeping this behavior, as it was conceived for an one-company-per-account setup.


cls.company = cls.env.ref("base.main_company")
cls.company.code = "TEST-CODE"
cls.env.user.group_ids += cls.env.ref("account.group_account_readonly")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

|=

<field name="inherit_id" ref="base.view_res_company_kanban" />
<field name="arch" type="xml">
<xpath expr="//kanban/field[@name='name']" position="after">
<field name="code" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit message says v18.

#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0+e\n"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing regenerating translations.

@api.depends("company_ids.code")
def _compute_display_name(self):
res = super()._compute_display_name()
for account in self.filtered(lambda a: a.company_ids):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should keep the previous filter but just renaming company_idcompany_ids

<field name="inherit_id" ref="base.view_company_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="before">
<field name="code" required="1" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants