我正在使用Odoo 8,并且由于某种原因找不到实际存在的字段。在我的XML文件中的以下代码未找到Odoo字段
<field name="amount_tax" position="after">
<field name="delivery_cost"
options="{'currency_field': 'currency_id'}"
readonly="1" widget="monetary"/>
</field>
给出了“delivery_cost”未发现错误,虽然在sale.py存在
_columns = {
'xx_delivery_date': fields.date(string='Delivery date'),
'xx_payment_method': fields.many2one('xx.payment.method',
string='Payment method'),
'xx_warranty_period': fields.many2one('xx.warranty.period',
string='Warranty period'),
'xx_delivery_method': fields.many2one('xx.delivery.method',
string='Delivery method'),
'delivery_cost': fields.function(_amount_all_wrapper, digits_compute=dp.get_precision('Account'), string='Delivery cost',
store={
'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line', 'xx_delivery_method'], 10),
},
multi='sums', help="The delivery cost.", track_visibility='always'),
'amount_untaxed': fields.function(_amount_all_wrapper, digits_compute=dp.get_precision('Account'), string='Untaxed Amount',
store={
'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 10),
'sale.order.line': (_get_order, ['price_unit', 'tax_id', 'discount', 'product_uom_qty'], 10),
},
multi='sums', help="The amount without tax.", track_visibility='always'),
'amount_tax': fields.function(_amount_all_wrapper, digits_compute=dp.get_precision('Account'), string='Taxes',
store={
'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 10),
'sale.order.line': (_get_order, ['price_unit', 'tax_id', 'discount', 'product_uom_qty'], 10),
},
multi='sums', help="The tax amount."),
'amount_total': fields.function(_amount_all_wrapper, digits_compute=dp.get_precision('Account'), string='Total',
store={
'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line', 'xx_delivery_method'], 10),
'sale.order.line': (_get_order, ['price_unit', 'tax_id', 'discount', 'product_uom_qty'], 10),
},
multi='sums', help="The total amount.")
我不明白为什么这个领域可以”找不到并且一直在寻找相当一段时间:/
你能给我们更多的观点一样,完整的XML定义,对象的_name和服务器引发的错误信息? –
您是否在__init__.py文件中添加了py并在重新启动openerp服务后更新了模块? – dccdany
可能是您的模型中存在拼写错误或错误。如果出现错误,Odoo不会加载你的模型,但不会引发错误...顺便说一句,你应该使用新的API(models.Model)和新的方式来声明你的字段 – dturcotte