Skip to content

[14.0][ADD] purchase_order_supplierinfo_update#18

Open
mathieudelva wants to merge 2 commits into
14.0from
14.0-add_purchase_order_supplierinfo_update
Open

[14.0][ADD] purchase_order_supplierinfo_update#18
mathieudelva wants to merge 2 commits into
14.0from
14.0-add_purchase_order_supplierinfo_update

Conversation

@mathieudelva
Copy link
Copy Markdown
Member

No description provided.

@mathieudelva mathieudelva force-pushed the 14.0-add_purchase_order_supplierinfo_update branch from 301c1e5 to 4d6100c Compare March 18, 2026 08:44
@metaminux metaminux force-pushed the 14.0-add_purchase_order_supplierinfo_update branch from 3956c77 to d9e566d Compare March 20, 2026 00:57
@sebastienbeau sebastienbeau force-pushed the 14.0-add_purchase_order_supplierinfo_update branch from d9e566d to f72fa99 Compare March 26, 2026 19:03
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We need to fill the fr.po file before deploying to production...

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing copyright and if possible sorting alphabetically for maintainability

Comment on lines +41 to +45
if supplierinfo:
if line._is_matching_supplierinfo(supplierinfo):
continue

lines.append((0, 0, line._prepare_supplier_wizard_line(supplierinfo)))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If supplierinfo is an empty recordset, line._is_matching_supplierinfo will most probably be False (when line.product_uom is set and line.price_unit is not 0.0) and a line will be added with an empty supplierinfo.

Suggested change
if supplierinfo:
if line._is_matching_supplierinfo(supplierinfo):
continue
lines.append((0, 0, line._prepare_supplier_wizard_line(supplierinfo)))
if supplierinfo:
if line._is_matching_supplierinfo(supplierinfo):
continue
lines.append((0, 0, line._prepare_supplier_wizard_line(supplierinfo)))

<tree
create="false"
editable="bottom"
decoration-info="not supplierinfo_id"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is it really needed if no lines are added when supplierinfo_id is empty ?

Comment on lines +18 to +21
supplierinfos = line.product_id._select_seller(
line.order_id.partner_id.commercial_partner_id,
quantity=None,
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Calling _select_seller without giving all parameters from the line can retrieve inaccurate supplierinfo (not in the right date range, not for the right quantity, etc.)

Suggested change
supplierinfos = line.product_id._select_seller(
line.order_id.partner_id.commercial_partner_id,
quantity=None,
)
supplierinfos = line.product_id._select_seller(
partner_id=line.order_id.partner_id.commercial_partner_id,
quantity=line.product_qty,
date=line.order_id.date_order,
uom_id=line.product_uom,
)

Comment on lines +1 to +3
# Copyright 2025 Akretion (https://www.akretion.com).
# @author Mathieu DELVA <mathieu.delva@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copyright present but with a different format than in the other files of the module...

I personally use this format, but I don't know if there is one "official" format so feel to choose your preferred one, and keep the same in all files

import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
setup_requires=['setuptools-odoo'],
setup_requires=["setuptools-odoo"],

<field name="supplierinfo_id" />
<field
name="current_price"
attrs="{'invisible': [('supplierinfo_id', '=', 'False')]}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
attrs="{'invisible': [('supplierinfo_id', '=', 'False')]}"
attrs="{'invisible': [('supplierinfo_id', '=', False)]}"

Comment on lines +11 to +13
cls.purchase = cls.env.ref("purchase_stock.purchase_order_8")
product = cls.env.ref("product.product_product_25_product_template")
vendor = cls.env.ref("base.res_partner_4")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

To highlight some points discussed in this review, can you add some tests with :

  • product with several supplierinfo using start and end dates, different quantities, etc. : should retrieve the one corresponding to this given line
  • product without supplierinfo for this partner shouldn't create a line in the wizard
  • same product purchased in several lines but with different prices, quantitites, etc.
  • test with draft purchase

@metaminux
Copy link
Copy Markdown

Hello @mathieudelva

Can you look at those comments ? I think some of them should be addressed before migrating to higher version.

Regards,

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants