Skip to content

Commit

Permalink
[IMP] website_sale_product_minimal_price: Added endpoint for modifyin…
Browse files Browse the repository at this point in the history
…g product.pricelist.item search domain
  • Loading branch information
edward_yoch committed Jun 24, 2024
1 parent 520aa51 commit 4373ad2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
13 changes: 1 addition & 12 deletions website_sale_product_minimal_price/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,7 @@ def get_combination_info_pricelist_atributes(self, product_id, **kwargs):
# Getting all min_quantity of the current product to compute the possible
# price scale.
qty_list = request.env["product.pricelist.item"].search(
[
"|",
("product_id", "=", product.id),
"|",
("product_tmpl_id", "=", product.product_tmpl_id.id),
(
"categ_id",
"in",
list(map(int, product.categ_id.parent_path.split("/")[0:-1])),
),
("min_quantity", ">", 0),
]
product._get_product_pricelist_item_domain()
)
qty_list = sorted(set(qty_list.mapped("min_quantity")))

Expand Down
15 changes: 15 additions & 0 deletions website_sale_product_minimal_price/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@
class ProductProduct(models.Model):
_inherit = "product.product"

def _get_product_pricelist_item_domain(self):
self.ensure_one()
return [
"|",
("product_id", "=", self.id),
"|",
("product_tmpl_id", "=", self.product_tmpl_id.id),
(
"categ_id",
"in",
list(map(int, self.categ_id.parent_path.split("/")[0:-1])),
),
("min_quantity", ">", 0),
]

def _get_product_price_scale(self, qty_list):
self.ensure_one()
unit_prices = []
Expand Down

0 comments on commit 4373ad2

Please sign in to comment.