This question has been flagged
1 Reply
2516 Views

In Odoo 9C:

am trying to override a standard method, which involves adding another dependency field.

However, I noticed, newly added field in the depends decorator is not taken into consideration while saving the record.


Ex: Say in Purchase Order, the method called "_amount_all" has @api.depends on "order_line.price_total"

Now In my custom module I have overridden that method, and included one of my dependency field to it, like

@api.depends('order_line.price_total','myfield')

Though it seems to work, when I change the value in myfield, however while saving the record, method is not triggered to recompute...


So In other words, newly added dependency fields are not taken into consideration while saving the record, as a result, method computation is not at all triggered. Hence old value is retained.


I believe this must be a bug.


Anybody has faced this issue?



Avatar
Discard
Author Best Answer

I realised, this issue is happening only with the currency field, in which I have overridden the related property of the same in its lines.

However, for other fields or newly created fields, it works fine. Not sure what could be the problem in my scenario, perhaps the overriding of related didn't go well I guess. Anyways it doesn't matter since I found an alternate way to fulfil my requirement.

Refer the below thread which I had raised in Github, though I haven't got the solution for my problem, just thought, it might be useful to someone, who is looking for the same kind of solution.

Odoo 9C: Overriding the method & its "depends" decorator [Bug] #12459

Avatar
Discard