MouTio
MouTio

Reputation: 1289

How can I redefine a compute field? In Odoo 9

I want to override (or redefine) a Odoo base field.

Usually I do this with a custom module and it works. But this field is a computed field.

I do not want to computed that field anymore.

This is the original field, from purchase.order class:

date_planned = fields.Datetime(
    string='Scheduled Date',
    compute='_compute_date_planned',
    required=True,
    index=True,
    oldname='minimum_planned_date')

In a custom module I am doing this:

class PurchaseOrder(models.Model):
    _inherit = ['purchase.order']

    date_planned = fields.Datetime(
        string='Scheduled Date',
        required=True,
        index=True,
        oldname='minimum_planned_date')

It is not working. No errors, but the field is still computed.

How can I achieve my purpose?

Upvotes: 3

Views: 1157

Answers (1)

Charif DZ
Charif DZ

Reputation: 14751

Try this:

date_planned = fields.Datetime(
    string='Scheduled Date',
    required=True,
    index=True,
    oldname='minimum_planned_date',
    compute=False)

Hope this works for you

Upvotes: 3

Related Questions