There's more...

Related fields are in fact computed fields. They just provide a convenient shortcut syntax to read field values from related models. As a computed field, this means that the store attribute is also available to them. As a shortcut, they also have all the attributes from the referenced field, such as name, translatable, and required.

Additionally, they support a related_sudo flag similar to compute_sudo; when set to True, the field chain is traversed without checking user access rights.

Using related fields in a create() method can harm performance, as the computation of theses fields is delayed until the end of the creation. So, if you have a One2many relation, such as in the sale.order and sale.order.line models, and you have a related field on the line model referring to a field on the 'order' model, you should explicitly read the field on the order model during record creation instead of using the related field shortcut, especially if there are a lot of lines.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.216.249