Adding fields to product.product that already exist in product.template

I want to create a module that depends on product_measurements but also adds the “length” fields to product.product (instead of relying on product.template).

At first I thought that I would just have to add the field to _no_template_field but all scenarios fail with something like:

File ".../tests/scenario_production_priority.rst", line 142, in scenario_production_priority.rst
Failed example:
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.9/", line 1336, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest scenario_production_priority.rst[85]>", line 1, in <module>
      File "/proteus/proteus/", line 102, in newfunc
        return self.func(owner, [instance], *args, **kwargs)
      File "/proteus/proteus/", line 847, in save
        ids = proxy.create(values, context)
      File "/proteus/proteus/", line 203, in __call__
        result = rpc.result(meth(*args, **kwargs))
      File "/trytond/trytond/modules/product/", line 256, in create
        templates = super(Template, cls).create(vlist)
      File "/trytond/trytond/model/", line 161, in wrapper
        return func(cls, *args, **kwargs)
      File "/trytond/trytond/model/", line 718, in create
        field.set(cls, fname, *fargs)
      File "/trytond/trytond/model/fields/", line 287, in set
      File "/trytond/trytond/modules/product/", line 582, in create
        products = super().create(vlist)
      File "/trytond/trytond/model/", line 161, in wrapper
        return func(cls, *args, **kwargs)
      File "/home/albert/d/root-6.4/trytond/trytond/model/", line 726, in create
      File "/trytond/trytond/model/", line 91, in wrapper
        return func(*args, **kwargs)
      File "/trytond/trytond/model/", line 1442, in _validate
        value = getattr(record, field_name)
      File "/trytond/trytond/model/fields/", line 365, in __get__
        return inst.__getattr__(
      File "/trytond/trytond/model/", line 1784, in __getattr__
        read_data =, list(ffields.keys()))
      File "/trytond/trytond/model/", line 839, in read
        cursor.execute(**columns.values(), where=where,
    sqlite3.OperationalError: no such column: a.length_uom

If I add the __register__() method and use pdb I see that the length fields are already created as Function fields when __register__() is called (before calling super) so register will not create those fields in the database.

Am I missing something?

You need to add the field definition on product_product and override _no_template_field to avoid overriding the definition of your custom field.

see Not possible to redefine product field (#10322) · Issues · Tryton / Tryton · GitLab