-
-
Notifications
You must be signed in to change notification settings - Fork 715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IMP] product_pricelist_supplierinfo: improve sale margin string in view and exclude supplier info discount in price #1836
Conversation
Hi @luisg123v, |
Hi @luisg123v, This implements the following comments: |
@@ -9,7 +9,7 @@ | |||
<field name="price" position="after"> | |||
<field | |||
name="sale_margin" | |||
string="Sale margin" | |||
string="Sale Margin (%)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not at model level?
The native field does it that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes implemented at the model level.
@@ -311,3 +311,19 @@ def test_line_uom_and_supplierinfo_uom(self): | |||
# And the price with the pricelist and the uom of Units (Instead of Dozen) | |||
# will be 100, plus the 20% the total will be 120 per Unit | |||
self.assertEqual(product_pricelist_price_unit, 120) | |||
|
|||
def test_pricelist_exclude_supplier_info_discount(self): | |||
"""Test the scenario where the product supplier info includes a discount,to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after comma
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@@ -20,6 +20,9 @@ class ProductPricelistItem(models.Model): | |||
string="Supplier filter", | |||
help="Only match prices from the selected supplier", | |||
) | |||
no_supplierinfo_discount = fields.Boolean( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit title is too long
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit title has been shortened.
@@ -20,6 +20,9 @@ class ProductPricelistItem(models.Model): | |||
string="Supplier filter", | |||
help="Only match prices from the selected supplier", | |||
) | |||
no_supplierinfo_discount = fields.Boolean( | |||
string="Ignore Supplier Info Discount", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a help message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Help message added.
Update the sale margin string on the field to match the format of the discount field [1], which is located beside it in the list view. [1]: https://github.com/odoo/odoo/blob/e947c589/addons/product/models/product_supplierinfo.py#L65
…in price Introduce a new field to optionally exclude the discount set in the product supplier info when calculating the product's price. Additionally, add a test to validate the new functionality.
928c03f
to
e5292b4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
/ocabot merge major |
On my way to merge this fine PR! |
Congratulations, your PR was merged at 19db99a. Thanks a lot for contributing to OCA. ❤️ |
Update the sale margin string on the field to match the format of the discount field 1, which is located beside it in the list view.
Also, introduce a new field to optionally exclude the discount set in the product supplier info when calculating the product's price. A test has been added to validate this new functionality.