我在采购订单行中添加了两个字段。它正常工作并保存,但当我确认订单时,它会引发错误,如
AttributeError: "Field 'product_tunch' does not exist in object 'browse_record(purchase.order, 23)'"
此处已成功添加字段,但为何在确认采购订单时出现错误,以下是我的字段
_columns={
'product_tunch':fields.float('Tunch', digits_compute= dp.get_precision('price_subtotal')),
'product_kt':fields.selection([('14kt','14 KT'), ('18kt','18 KT'), ('20kt','20 KT')
, ('22kt','22 KT'), ('24kt','24 KT')], 'Type',
size=32,),
我的功能是
def _amount_line(self, cr, uid, ids, prop, arg, context=None):
res = {}
cur_obj=self.pool.get('res.currency')
tax_obj = self.pool.get('account.tax')
for line in self.browse(cr, uid, ids, context=context):
taxes = tax_obj.compute_all(cr, uid, line.taxes_id, line.price_unit, line.product_qty, line.product_id, line.product_pc, line.order_id.partner_id)
cur = line.order_id.pricelist_id.currency_id
res[line.id] = cur_obj.round(cr, uid, cur, taxes['total'])
res[line.id]=(line.price_unit *line.product_qty*(line.product_tunch/100))
return res
我的视图文件是
<record id="view_purchase_inherit_form" model="ir.ui.view">
<field name="name">purchase.inherit.form</field>
<field name="model">purchase.order.line</field>
<field name="inherit_id" ref="purcahse.view_order_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='taxes']" position="before">
<field name="product_tunch"/>
<field name="product_kt"/>
</xpath>
</data>
</field>
</record>
答案 0 :(得分:1)
在视图文件的第4行中检查购买的拼写
答案 1 :(得分:0)
我没有更多的想法
答案 2 :(得分:0)
您可以尝试使用以下语法一次启动服务器:
openerp-server -c path/to/your/conf.file -d your_database -u module_to_update