我正在使用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