我正在使用Odoo 8,由于某种原因,找不到实际存在的字段。在我的XML文件中有以下代码
<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.")
我不明白为什么这个领域找不到并且已经找了很长时间了:/
答案 0 :(得分:3)
重新考虑功能字段的代码块。不要把它放在列块中。为函数字段创建一个单独的函数。它可以解决你的问题
答案 1 :(得分:1)
确保在进行模型/视图更改后重新启动服务器,然后升级模块。
答案 2 :(得分:0)
如果您使用完全odoo 8.0而不是在此问题之后,则删除字段后的逗号(,)
例如: name = name.Char('Name')
after you can not enter (comma)(,)