price component
This commit is contained in:
@@ -1167,11 +1167,15 @@ class SaleLine(metaclass=PoolMeta):
|
||||
if self.tol_max and self.quantity_theorical:
|
||||
return round((1+(self.tol_max/100))*Decimal(self.quantity_theorical),3)
|
||||
|
||||
def get_progress(self,name):
|
||||
PS = Pool().get('sale.pricing.summary')
|
||||
ps = PS.search(['sale_line','=',self.id])
|
||||
if ps:
|
||||
return sum((e.progress if e.progress else 0) * (e.ratio if e.ratio else 0) / 100 for e in ps)
|
||||
def get_progress(self,name):
|
||||
PS = Pool().get('sale.pricing.summary')
|
||||
ps = PS.search(['sale_line','=',self.id])
|
||||
if ps:
|
||||
if not self.price_components:
|
||||
manual = [e for e in ps if not e.price_component]
|
||||
if manual:
|
||||
return manual[0].progress or 0
|
||||
return sum((e.progress if e.progress else 0) * (e.ratio if e.ratio else 0) / 100 for e in ps)
|
||||
|
||||
def getVirtualLot(self):
|
||||
if self.lots:
|
||||
@@ -1225,6 +1229,14 @@ class SaleLine(metaclass=PoolMeta):
|
||||
|
||||
def _get_basis_component_price(self):
|
||||
price = Decimal(0)
|
||||
if not self.price_components:
|
||||
PP = Pool().get('sale.pricing.summary')
|
||||
pp = PP.search([
|
||||
('sale_line', '=', self.id),
|
||||
('price_component', '=', None),
|
||||
], limit=1)
|
||||
if pp:
|
||||
return round(Decimal(pp[0].price or 0), 4)
|
||||
for pc in self.price_components:
|
||||
PP = Pool().get('sale.pricing.summary')
|
||||
pp = PP.search([('price_component','=',pc.id),('sale_line','=',self.id)])
|
||||
|
||||
Reference in New Issue
Block a user