Skip to content
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

CLaurelB
Copy link

@CLaurelB CLaurelB commented Jan 7, 2025

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.

@OCA-git-bot
Copy link
Contributor

Hi @luisg123v,
some modules you are maintaining are being modified, check this out!

@CLaurelB
Copy link
Author

CLaurelB commented Jan 7, 2025

@@ -9,7 +9,7 @@
<field name="price" position="after">
<field
name="sale_margin"
string="Sale margin"
string="Sale Margin (%)"

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.

Copy link
Author

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

Choose a reason for hiding this comment

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

Missing space after comma

Copy link
Author

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(

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

Copy link
Author

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",

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

Copy link
Author

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.
@CLaurelB CLaurelB force-pushed the 17.0-include_optional_price_discounted-CLaurelB branch from 928c03f to e5292b4 Compare January 7, 2025 20:15
@CLaurelB CLaurelB changed the title [IMP] product_pricelist_supplierinfo: improve sale margin string in view and add option to exclude discount in product supplier info [IMP] product_pricelist_supplierinfo: improve sale margin string in view and exclude supplier info discount in price Jan 7, 2025
@CLaurelB CLaurelB requested a review from luisg123v January 7, 2025 20:18
Copy link

@luisg123v luisg123v left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@luisg123v
Copy link

/ocabot merge major

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 17.0-ocabot-merge-pr-1836-by-luisg123v-bump-major, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 74abc70 into OCA:17.0 Jan 7, 2025
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 19db99a. Thanks a lot for contributing to OCA. ❤️

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.

3 participants