Merge.
This commit is contained in:
commit
fb61bfbf46
17
plan.py
17
plan.py
|
@ -321,15 +321,26 @@ class Plan(Workflow, ModelSQL, ModelView):
|
|||
*factor*: The factor to calculate the quantity
|
||||
"""
|
||||
pool = Pool()
|
||||
Uom = pool.get('product.uom')
|
||||
Input = pool.get('production.bom.input')
|
||||
ProductLine = pool.get('product.cost.plan.product_line')
|
||||
quantity = Input.compute_quantity(input_, factor)
|
||||
cost_factor = Decimal(Uom.compute_qty(input_.product.default_uom, 1,
|
||||
input_.uom))
|
||||
digits = ProductLine.product_cost_price.digits[1]
|
||||
product_cost_price = (input_.product.cost_price /
|
||||
cost_factor).quantize(Decimal(str(10 ** -digits)))
|
||||
digits = ProductLine.cost_price.digits[1]
|
||||
cost_price = (input_.product.cost_price /
|
||||
cost_factor).quantize(Decimal(str(10 ** -digits)))
|
||||
|
||||
return {
|
||||
'name': input_.product.rec_name,
|
||||
'product': input_.product.id,
|
||||
'quantity': quantity,
|
||||
'uom': input_.uom.id,
|
||||
'product_cost_price': input_.product.cost_price,
|
||||
'cost_price': input_.product.cost_price,
|
||||
'product_cost_price': product_cost_price,
|
||||
'cost_price': cost_price,
|
||||
}
|
||||
|
||||
@classmethod
|
||||
|
@ -434,8 +445,6 @@ class PlanProductLine(ModelSQL, ModelView):
|
|||
return cost.quantize(Decimal(str(10 ** -digits)))
|
||||
|
||||
def on_change_with_total(self, name=None):
|
||||
pool = Pool()
|
||||
Uom = pool.get('product.uom')
|
||||
quantity = self.quantity
|
||||
if not quantity:
|
||||
return Decimal('0.0')
|
||||
|
|
Loading…
Reference in New Issue