fix: don't recalculate rate for scrap items
This commit is contained in:
parent
a6b2cf3acd
commit
40a6b5cefe
@ -171,6 +171,7 @@ class SubcontractingReceipt(SubcontractingController):
|
|||||||
"rejected_warehouse": self.rejected_warehouse,
|
"rejected_warehouse": self.rejected_warehouse,
|
||||||
"service_cost_per_qty": 0,
|
"service_cost_per_qty": 0,
|
||||||
"reference_name": item.name,
|
"reference_name": item.name,
|
||||||
|
"recalculate_rate": 0,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -239,23 +240,24 @@ class SubcontractingReceipt(SubcontractingController):
|
|||||||
|
|
||||||
total_qty = total_amount = 0
|
total_qty = total_amount = 0
|
||||||
for item in self.items:
|
for item in self.items:
|
||||||
if item.qty and not item.is_scrap_item:
|
if not item.is_scrap_item:
|
||||||
if item.name in rm_cost_map:
|
if item.qty:
|
||||||
item.rm_supp_cost = rm_cost_map[item.name]
|
if item.name in rm_cost_map:
|
||||||
item.rm_cost_per_qty = item.rm_supp_cost / item.qty
|
item.rm_supp_cost = rm_cost_map[item.name]
|
||||||
rm_cost_map.pop(item.name)
|
item.rm_cost_per_qty = item.rm_supp_cost / item.qty
|
||||||
|
rm_cost_map.pop(item.name)
|
||||||
|
|
||||||
if item.name in scrap_cost_map:
|
if item.name in scrap_cost_map:
|
||||||
item.scrap_cost_per_qty = scrap_cost_map[item.name] / item.qty
|
item.scrap_cost_per_qty = scrap_cost_map[item.name] / item.qty
|
||||||
scrap_cost_map.pop(item.name)
|
scrap_cost_map.pop(item.name)
|
||||||
|
|
||||||
if item.recalculate_rate:
|
if item.recalculate_rate:
|
||||||
item.rate = (
|
item.rate = (
|
||||||
flt(item.rm_cost_per_qty)
|
flt(item.rm_cost_per_qty)
|
||||||
+ flt(item.service_cost_per_qty)
|
+ flt(item.service_cost_per_qty)
|
||||||
+ flt(item.additional_cost_per_qty)
|
+ flt(item.additional_cost_per_qty)
|
||||||
- flt(item.scrap_cost_per_qty)
|
- flt(item.scrap_cost_per_qty)
|
||||||
)
|
)
|
||||||
|
|
||||||
item.received_qty = flt(item.qty) + flt(item.rejected_qty)
|
item.received_qty = flt(item.qty) + flt(item.rejected_qty)
|
||||||
item.amount = flt(item.qty) * flt(item.rate)
|
item.amount = flt(item.qty) * flt(item.rate)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user