@@ -26,52 +26,13 @@ def get_pack_lines(self):
26
26
can be overloaded to introduce filtering function by date, etc..."""
27
27
return self .mapped ("pack_line_ids" )
28
28
29
+ def _is_pack_to_be_handled (self ):
30
+ return self .product_tmpl_id ._is_pack_to_be_handled ()
31
+
29
32
def split_pack_products (self ):
30
33
packs = self .filtered (lambda p : p .product_tmpl_id ._is_pack_to_be_handled ())
31
34
return packs , (self - packs )
32
35
33
- def price_compute (
34
- self , price_type , uom = False , currency = False , company = False , date = False
35
- ):
36
- packs , no_packs = self .split_pack_products ()
37
- prices = super (ProductProduct , no_packs ).price_compute (
38
- price_type , uom , currency , company , date
39
- )
40
- for product in packs .with_context (prefetch_fields = False ):
41
- pack_price = 0.0
42
- for pack_line in product .sudo ().pack_line_ids :
43
- pack_price += pack_line .get_price ()
44
- pricelist_id_or_name = self ._context .get ("pricelist" )
45
- # if there is a pricelist on the context the returned prices are on
46
- # that currency but, if the pack product has a different currency
47
- # it will be converted again by pp._compute_price_rule, so if
48
- # that is the case we convert the amounts to the pack currency
49
- if pricelist_id_or_name :
50
- pricelist = None
51
- if isinstance (pricelist_id_or_name , list ):
52
- pricelist_id_or_name = pricelist_id_or_name [0 ]
53
- if isinstance (pricelist_id_or_name , str ):
54
- pricelist_name_search = self .env ["product.pricelist" ].name_search (
55
- pricelist_id_or_name , operator = "=" , limit = 1
56
- )
57
- if pricelist_name_search :
58
- pricelist = self .env ["product.pricelist" ].browse (
59
- [pricelist_name_search [0 ][0 ]]
60
- )
61
- elif isinstance (pricelist_id_or_name , int ):
62
- pricelist = self .env ["product.pricelist" ].browse (
63
- pricelist_id_or_name
64
- )
65
- if pricelist and pricelist .currency_id != product .currency_id :
66
- pack_price = pricelist .currency_id ._convert (
67
- pack_price ,
68
- product .currency_id ,
69
- self .company_id or self .env .company ,
70
- fields .Date .today (),
71
- )
72
- prices [product .id ] = pack_price
73
- return prices
74
-
75
36
@api .depends ("list_price" , "price_extra" )
76
37
def _compute_product_lst_price (self ):
77
38
packs , no_packs = self .split_pack_products ()
0 commit comments