Skip to content

Commit

Permalink
Merge pull request #1024 from OCA/14.0
Browse files Browse the repository at this point in the history
Syncing from upstream OCA/product-attribute (14.0)
  • Loading branch information
bt-admin authored Feb 1, 2024
2 parents ff92b4d + 751c2d1 commit a1cccfa
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ addon | version | maintainers | summary
[product_status](product_status/) | 14.0.1.0.2 | | Product Status Computed From Fields
[product_stock_state](product_stock_state/) | 14.0.1.0.1 | [![sebastienbeau](https://github.com/sebastienbeau.png?size=30px)](https://github.com/sebastienbeau) [![legalsylvain](https://github.com/legalsylvain.png?size=30px)](https://github.com/legalsylvain) [![kevinkhao](https://github.com/kevinkhao.png?size=30px)](https://github.com/kevinkhao) | Compute the state of a product's stockthe stock level and sale_ok field
[product_supplierinfo_archive](product_supplierinfo_archive/) | 14.0.1.1.0 | [![GuillemCForgeFlow](https://github.com/GuillemCForgeFlow.png?size=30px)](https://github.com/GuillemCForgeFlow) [![AlvaroTForgeFlow](https://github.com/AlvaroTForgeFlow.png?size=30px)](https://github.com/AlvaroTForgeFlow) [![OriolVForgeFlow](https://github.com/OriolVForgeFlow.png?size=30px)](https://github.com/OriolVForgeFlow) | Add the active field to the product supplier info
[product_supplierinfo_for_customer](product_supplierinfo_for_customer/) | 14.0.2.0.0 | [![aleuffre](https://github.com/aleuffre.png?size=30px)](https://github.com/aleuffre) [![renda-dev](https://github.com/renda-dev.png?size=30px)](https://github.com/renda-dev) [![PicchiSeba](https://github.com/PicchiSeba.png?size=30px)](https://github.com/PicchiSeba) | Allows to define prices for customers in the products
[product_supplierinfo_for_customer](product_supplierinfo_for_customer/) | 14.0.2.0.2 | [![aleuffre](https://github.com/aleuffre.png?size=30px)](https://github.com/aleuffre) [![renda-dev](https://github.com/renda-dev.png?size=30px)](https://github.com/renda-dev) [![PicchiSeba](https://github.com/PicchiSeba.png?size=30px)](https://github.com/PicchiSeba) | Allows to define prices for customers in the products
[product_supplierinfo_for_customer_group](product_supplierinfo_for_customer_group/) | 14.0.1.0.0 | | Fixes compatibility of product_supplierinfo_for_customer and product_supplierinfo_group
[product_supplierinfo_group](product_supplierinfo_group/) | 14.0.2.0.3 | | Product Supplierinfo Group
[product_supplierinfo_revision](product_supplierinfo_revision/) | 14.0.1.0.0 | | Product Supplierinfo Revision
Expand Down
2 changes: 1 addition & 1 deletion product_supplierinfo_for_customer/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Product Supplierinfo for Customers
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:36fba0b3303dcc97a8f6c4059391bdabbcfca850aaad827d66f6a5300514b62a
!! source digest: sha256:4e7e184938beee049149e64aa34580dd662eeaadfb29f9bbc584e80db20ed54f
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
Expand Down
2 changes: 1 addition & 1 deletion product_supplierinfo_for_customer/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"name": "Product Supplierinfo for Customers",
"summary": "Allows to define prices for customers in the products",
"version": "14.0.2.0.0",
"version": "14.0.2.0.2",
"development_status": "Production/Stable",
"author": "AvanzOSC, " "Tecnativa, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/product-attribute",
Expand Down
29 changes: 18 additions & 11 deletions product_supplierinfo_for_customer/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,28 +169,35 @@ def _customers_filter_by_quantity(self, customers, quantity, uom_id, precision):
def _select_customerinfo(
self, partner=False, quantity=0.0, date=None, uom_id=False, params=False
):
"""Customer version of the standard `_select_seller`."""
"""
Customer version of the standard `_select_seller`.
If you want not to filter by quantity, explicitly pass quantity=None
"""
self.ensure_one()
if not params:
params = {}
params.update({"date": date, "partner_id": partner})
domain = self._prepare_domain_customerinfo(params)
params["domain"] = domain

customers = self._prepare_customers(params)
customerinfos = self._prepare_customers(params)
precision = self.env["decimal.precision"].precision_get(
"Product Unit of Measure"
)
res = self._customers_filter_by_quantity(
customers, quantity=quantity, uom_id=uom_id, precision=precision
)
if res:
customer_name = res[0].name
res = res.filtered(lambda x, name=customer_name: x.name == name)

if quantity is not None:
customerinfos = self._customers_filter_by_quantity(
customerinfos, quantity=quantity, uom_id=uom_id, precision=precision
)
if customerinfos:
customer = customerinfos[0].name
customerinfos = customerinfos.filtered(
lambda x, name=customer: x.name == name
)

# Prefer matching specific variants over templates if possible
variant_res = res.filtered(lambda x: x.product_id)
variant_res = customerinfos.filtered(lambda x: x.product_id)
if variant_res:
res = variant_res
customerinfos = variant_res

return res.sorted("price")[:1]
return customerinfos.sorted("price")[:1]
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ <h1 class="title">Product Supplierinfo for Customers</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:36fba0b3303dcc97a8f6c4059391bdabbcfca850aaad827d66f6a5300514b62a
!! source digest: sha256:4e7e184938beee049149e64aa34580dd662eeaadfb29f9bbc584e80db20ed54f
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/product-attribute/tree/14.0/product_supplierinfo_for_customer"><img alt="OCA/product-attribute" src="https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/product-attribute-14-0/product-attribute-14-0-product_supplierinfo_for_customer"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This modules allows to use supplier info structure, available in
Expand Down
5 changes: 5 additions & 0 deletions product_tier_validation/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ msgstr "Revisores"
msgid "Tier Definition"
msgstr "Definición del Nivel"

#. module: product_tier_validation
#: model:ir.model.fields,field_description:product_tier_validation.field_product_template__tier_validation_before_write
msgid "Tier Validation Before Write"
msgstr ""

#. module: product_tier_validation
#: model:ir.model.fields,field_description:product_tier_validation.field_product_template__to_validate_message
msgid "To Validate Message"
Expand Down
5 changes: 5 additions & 0 deletions product_tier_validation/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ msgstr "Revisori"
msgid "Tier Definition"
msgstr "Definizione livello"

#. module: product_tier_validation
#: model:ir.model.fields,field_description:product_tier_validation.field_product_template__tier_validation_before_write
msgid "Tier Validation Before Write"
msgstr ""

#. module: product_tier_validation
#: model:ir.model.fields,field_description:product_tier_validation.field_product_template__to_validate_message
msgid "To Validate Message"
Expand Down
5 changes: 5 additions & 0 deletions product_tier_validation/i18n/product_tier_validation.pot
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ msgstr ""
msgid "Tier Definition"
msgstr ""

#. module: product_tier_validation
#: model:ir.model.fields,field_description:product_tier_validation.field_product_template__tier_validation_before_write
msgid "Tier Validation Before Write"
msgstr ""

#. module: product_tier_validation
#: model:ir.model.fields,field_description:product_tier_validation.field_product_template__to_validate_message
msgid "To Validate Message"
Expand Down

0 comments on commit a1cccfa

Please sign in to comment.