top of page
  • Writer's pictureTek Siong, Hock

Track changes in Odoo line item (One-to-Many Field)

Updated: Mar 28, 2021

This Odoo technical development blog is my way to contribute back to the Odoo Community, for all the selfless and great sharing by the community members.

Odoo has the standard feature of tracking the changes of the document with chatter, by declaring in the field.


However, this cannot be applicable to One-to-Many field on the line item.

Don't freak, here is the solution, to override the write and create method on the One-to-Many field.

Click "Like" at the bottom of this blog, to motivate us to continue sharing more Odoo tips.

def create(self, vals):
    res = super(FreightOperationLine, self).create(vals)
    content = ""
    content = content + "  \u2022 Container: " + str(vals.get("container_no")) + "<br/>"

    return res

def write(self, vals):
    res = super(FreightOperationLine, self).write(vals)
    content = ""
    if vals.get("container_no"):
        content = content + "  \u2022 Container: " + str(vals.get("container_no")) + "<br/>"

    return res  

1,916 views1 comment

Recent Posts

See All

1 Comment
Jul 06, 2020

Thank you so much for sharing this very informative content. It's very useful for us. Keep blogging.

bottom of page