fix review issues
This commit is contained in:
parent
26588accc2
commit
b58948295c
|
@ -299,27 +299,6 @@ class Production(metaclass=PoolMeta):
|
||||||
if shipments:
|
if shipments:
|
||||||
InternalShipment.assign_try(shipments)
|
InternalShipment.assign_try(shipments)
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def set_cost(cls, productions):
|
|
||||||
pool = Pool()
|
|
||||||
Move = pool.get('stock.move')
|
|
||||||
super().set_cost(productions)
|
|
||||||
to_save = []
|
|
||||||
for production in productions:
|
|
||||||
if not production.purchase_request:
|
|
||||||
continue
|
|
||||||
|
|
||||||
purchase = production.purchase_request.purchase
|
|
||||||
amount = purchase.untaxed_amount
|
|
||||||
for output in production.outputs:
|
|
||||||
output.unit_price += round_price(
|
|
||||||
Decimal(float(amount)/output.internal_quantity))
|
|
||||||
to_save.append(output)
|
|
||||||
|
|
||||||
Move.save(to_save)
|
|
||||||
|
|
||||||
|
|
||||||
def get_cost(self, name):
|
def get_cost(self, name):
|
||||||
price = super().get_cost(name)
|
price = super().get_cost(name)
|
||||||
purchase = self.purchase_request and self.purchase_request.purchase
|
purchase = self.purchase_request and self.purchase_request.purchase
|
||||||
|
@ -329,7 +308,6 @@ class Production(metaclass=PoolMeta):
|
||||||
return price + purchase.untaxed_amount
|
return price + purchase.untaxed_amount
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# TODO: Internal shipment should be updated each time outputs are changed
|
# TODO: Internal shipment should be updated each time outputs are changed
|
||||||
|
|
||||||
class Purchase(metaclass=PoolMeta):
|
class Purchase(metaclass=PoolMeta):
|
||||||
|
|
|
@ -338,4 +338,4 @@ Make a subcontract production::
|
||||||
'done'
|
'done'
|
||||||
>>> output, = production.outputs
|
>>> output, = production.outputs
|
||||||
>>> output.unit_price
|
>>> output.unit_price
|
||||||
Decimal('212.5000')
|
Decimal('112.5000')
|
||||||
|
|
Loading…
Reference in New Issue