011899988199
011899988199

Reputation: 11

Odoo field not found

I'm using Odoo 8 and for some reason a field which actually exists isn't found. In my XML file the following code

            <field name="amount_tax" position="after">
                <field name="delivery_cost"
                    options="{'currency_field': 'currency_id'}"
                    readonly="1" widget="monetary"/>
            </field>

Gives the error that "delivery_cost" isn't found, though in sale.py it exists

  _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.")

I don't see why the field can't be found and have been looking for quite some time :/

Upvotes: 1

Views: 793

Answers (3)

gopal
gopal

Reputation: 31

if you are use fully odoo 8.0 than after this issue than you remove the comma (,) after field

ex: name = name.Char('Name')

after you can not enter (comma)(,)

Upvotes: 0

SanathT
SanathT

Reputation: 61

Re factor your code block of function field. Don't put it in the column block. create a separate function for function field.It may solve your problem

Upvotes: 3

amr.negm
amr.negm

Reputation: 183

Make sure you restarted the server, and then upgraded the module, after making your model/view changes.

Upvotes: 1

Related Questions