我有一个功能来比较两个不同的领域:
功能一:
def on_change_expected_qty(self, cr, uid, ids, finish_product_quantity):
res = {}
for rec in self.browse(cr, uid, ids):
expected_qty = 0.0
for line_rec in rec.bom_lines:
expected_qty += line_rec.product_qty or 0.0
if finish_product_quantity != expected_qty:
if finish_product_quantity > expected_qty:
tot_produce = finish_product_quantity - expected_qty
res['remarks'] = 'Finish product is produce EXTRA ' + str(tot_produce) + str(rec.product_uom.name)
else:
tot_produce = expected_qty - finish_product_quantity
res['remarks'] = 'Finish product is produce LESS ' + str(tot_produce) + str(rec.product_uom.name)
return {'value':res}
然后我有另一个函数是计算单位成本:
功能 B:
def get_unit_cost_calculation(self, cr, uid, ids, name, args, context=None):
res = {}
for rec in self.browse(cr, uid, ids, context=context):
total_unit_cost = 0.0
if rec.total_production_cost > 0 and rec.finish_product_quantity > 0:
total_unit_cost = rec.total_production_cost / rec.finish_product_quantity
res.update({rec.id : total_unit_cost})
return res
我的 FUNCTION B 完成计算单位成本后,如何在我的 FUNCTION B 中调用 FUNCTION A?
请帮助和建议。
谢谢你。