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

[16.0] Fix build #1521

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,8 @@ def _auto_apply_computed_value_for_product_levels(self):
},
)
level_ids.extend(r[0] for r in self.env.cr.fetchall())
self.env["abc.classification.product.level"].invalidate_cache(
["manual_level_id"], level_ids
)
modified_levels = self.env["abc.classification.product.level"].browse(level_ids)
modified_levels.invalidate_recordset(fnames=["manual_level_id"])
# mark field as modified and trigger recompute of dependent fields.
modified_levels.modified(["manual_level_id"])
modified_levels._recompute_recordset()
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from psycopg2 import IntegrityError

from odoo.exceptions import ValidationError
from odoo.tools import mute_logger

from .common import ABCClassificationLevelCase

Expand Down Expand Up @@ -137,6 +138,7 @@ def test_02(self):
self.assertEqual(self.product_level.level_id, self.classification_level_a)
self.assertFalse(self.product_level.flag)

@mute_logger("odoo.sql_db")
def test_03(self):
"""
Data:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,5 @@ class PricelistSimulationLine(models.TransientModel):
)
price = fields.Monetary(
string="Unit Price",
digits="Price",
readonly=True,
currency_field="currency_id",
)
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class PricelistSimulationLine(models.TransientModel):

margin = fields.Monetary(
store=True,
digits="Price",
readonly=True,
)

Expand Down
22 changes: 16 additions & 6 deletions product_supplierinfo_for_customer/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,20 @@ def _select_customerinfo(
params = dict()
params.update({"partner_id": partner.id})
domain = self._prepare_domain_customerinfo(params)
res = (
self.env["product.customerinfo"]
.search(domain)
.sorted(lambda s: (s.sequence, s.min_qty, s.price, s.id))
# Search for customerinfo records based on the domain
any_match = self.env["product.customerinfo"].search(
domain, order="sequence,min_qty,price,id"
)
res_1 = res.sorted("product_tmpl_id")[:1]
return res_1
first_template_match = None
# return the first customer_info matching the variant
# otherwise the first one matching the template
for customer_info in any_match:
if customer_info.product_id == self:
return customer_info
if (
not customer_info.product_id
and not first_template_match
and customer_info.product_tmpl_id == self.product_tmpl_id
):
first_template_match = customer_info
return first_template_match
Loading