Skip to content

[18.0][IMP] use commercial_partner_id iso parent_id - #61

Open
remi-filament wants to merge 1 commit into
akretion:18.0from
lefilament:18.0-commercial_partner_id
Open

[18.0][IMP] use commercial_partner_id iso parent_id#61
remi-filament wants to merge 1 commit into
akretion:18.0from
lefilament:18.0-commercial_partner_id

Conversation

@remi-filament

Copy link
Copy Markdown
Contributor

As per #49 (comment)

It seems more appropriate to make use of commercial_partner_id rather than parent_id.
Also a number of times parent_id was used to make sure the partner was not a contact, where checking is_company seems more accurate.

Commercial_partner_id is computed as follow (see https://github.com/odoo/odoo/blob/fc7bd92cc52f366a0d8730bca066b757aefe870c/odoo/addons/base/models/res_partner.py#L450) :

  • if partner is a company or has no parent : commercial_partner_id = partner
  • else : commercial_partner_id = partner.parent_id.commercial_partner_id

This allows for 2 things which are not covered by simply using parent_id :

  • Have multiple levels of partners : commercial_partner_id is the higher level partner (or the first upper level which is a company)
  • Use partner itself if it is a company (which is child of another company) : in this case, I think it makes sense to use the company itself rather than its parent

@ak-git-bot

Copy link
Copy Markdown

Hi @alexis-via,
some modules you are maintaining are being modified, check this out!

@ak-git-bot ak-git-bot added mod:l10n_fr_einvoicing Module l10n_fr_einvoicing series:18.0 mod:account_invoice_en16931 Module account_invoice_en16931 labels Aug 20, 2026
@remi-filament
remi-filament force-pushed the 18.0-commercial_partner_id branch from 7e68bf5 to d7ea029 Compare August 20, 2026 19:12
@remi-filament remi-filament changed the title [IMP] use commercial_partner_id iso parent_id [18.0][IMP] use commercial_partner_id iso parent_id Aug 20, 2026
@remi-filament
remi-filament force-pushed the 18.0-commercial_partner_id branch from d7ea029 to 7c0c461 Compare September 1, 2026 13:18
@remi-filament
remi-filament force-pushed the 18.0-commercial_partner_id branch from 7c0c461 to 77328f5 Compare September 3, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:account_invoice_en16931 Module account_invoice_en16931 mod:l10n_fr_einvoicing Module l10n_fr_einvoicing series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants