问题描述
我需要在制造订单pdf报告中添加将要制造的产品的数量。问题在于该字段始终为空,就像没有值被要求很多一样。没有异常发生。如何使该值出现在报告中?
我在python文件mrp_production_with_lot.py
中创建了一个名为MrpProductionWithLots
的新模型,以继承MrpProduction
模型并添加finished_product_lot
字段:
from odoo import fields,models,tools
class MrpProductionWithLots(models.Model):
_inherit = 'mrp.production'
finished_product_lot = fields.Many2one(
'stock.production.lot','Lot/Serial Number',domain="[('product_id','=',product_id),('company_id',company_id)]",check_company=True)
然后,我继承了mrp_production_templates.xml
并创建了一个名为mrp_production_with_lots.xml
的新python文件:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_mrporder_inherit" inherit_id="report_mrporder">
<xpath expr="//div[@class='row mt32 mb32']" position="after">
<div class="row mt32 mb32" id="finished_product_lot">
<div class="col-3">
<strong>Finished product lot:</strong><br/>
<span t-field="o.finished_product_lot"/>
</div>
</div>
</xpath>
</template>
</odoo>
我相信我打的不是正确的finished_product_lot
,但是找不到正确的调用方式。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)