Secondary uom not showing in stock?

i just activated secondry uom for stock move but i can’t see the field on Moves


what am i doing wrong ?

The secondary unit is available only for move created by an origin that defines a secondary unit like a sale or a purchase.

En caso que se requiera hacer uso de la unidad secundaria en movimientos sin origen de compra o venta, como se puede lograr?

You need to have an origin that define the conversion factor.

He estado intentándolo con el siguiente código:

    @fields.depends('shipment')
    def on_change_product(self):
        super().on_change_product()
        if self.product and self.shipment:
            if self.shipment.__name__ in ['stock.shipment.in', 'stock.shipment.in.return']:
                if self.product.purchase_secondary_uom:
                    self.secondary_unit = self.product.purchase_secondary_uom
                    self.on_change_secondary_unit()
            elif self.shipment.__name__ in ['stock.shipment.out', 'stock.shipment.out.return']:
                if self.product.sale_secondary_uom:
                    self.secondary_unit = self.product.sale_secondary_uom
                    self.on_change_secondary_unit()

    @property
    def secondary_uom_factor(self):
        if isinstance(self.origin, self.__class__) and self.origin != self:
            return self.origin.secondary_uom_factor
        elif self.product:
            if self.shipment.__name__ in ['stock.shipment.in', 'stock.shipment.in.return']:
                if self.product.purchase_secondary_uom:
                    return self.product.purchase_secondary_uom_normal_factor
            elif self.shipment.__name__ in ['stock.shipment.out', 'stock.shipment.out.return']:
                if self.product.sale_secondary_uom:
                    return self.product.sale_secondary_uom_normal_factor
        return None

    @property
    def secondary_uom_rate(self):
        if isinstance(self.origin, self.__class__) and self.origin != self:
            return self.origin.secondary_uom_rate
        elif self.product:
            if self.shipment.__name__ in ['stock.shipment.in', 'stock.shipment.in.return']:
                if self.product.purchase_secondary_uom:
                    return self.product.purchase_secondary_uom_rate
            elif self.shipment.__name__ in ['stock.shipment.out', 'stock.shipment.out.return']:
                if self.product.sale_secondary_uom:
                    return self.product.sale_secondary_uom_rate
        return None

Pero al parecer hay problemas al reescribir los property, ya que me genera el siguiente error:

Traceback (most recent call last):
  File "/.../trytond/model/model.py", line 394, in _getitem
    return getattr(self, field)
AttributeError: 'stock.move._record' object has no attribute 'secondary_uom_factor'. Did you mean: 'extra_secondary_uom_factor'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/.../trytond/model/model.py", line 317, in __getattr__
    return self._values[name]
           ~~~~~~~~~~~~^^^^^^
  File "/.../trytond/model/model.py", line 396, in _getitem
    raise KeyError(field)
KeyError: 'secondary_uom_factor'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/.../trytond/protocols/dispatcher.py", line 201, in _dispatch
    result = rpc.result(meth(inst, *c_args, **c_kwargs))
                        ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../trytond/model/modelview.py", line 52, in wrapper
    result = func(self, *args, **kwargs)
  File "/.../trytond/model/modelview.py", line 805, in on_change_with
    value = getattr(self, method_name)()
  File "/.../trytond/model/fields/field.py", line 124, in wrapper
    return func(self, *args, **kwargs)
  File "/.../trytond/modules/garman/stock.py", line 196, in on_change_with_secondary_quantity
    return super().on_change_with_secondary_quantity(name)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/.../trytond/model/fields/field.py", line 124, in wrapper
    return func(self, *args, **kwargs)
  File "/.../trytond/modules/stock_secondary_unit/stock.py", line 51, in on_change_with_secondary_quantity
    and (self.secondary_uom_factor or self.secondary_uom_rate)):
         ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../trytond/model/modelstorage.py", line 1657, in __getattr__
    return super(ModelStorage, self).__getattr__(name)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/.../trytond/model/model.py", line 319, in __getattr__
    raise AttributeError("'%s' Model has no attribute '%s': %s"
        % (self.__name__, name, self._values))
AttributeError: 'stock.move' Model has no attribute 'secondary_uom_factor': <trytond.model.model.stock.move._record object at 0x7f71c00d39d0>. Did you mean: 'secondary_uom_rate'?
49770 140126877357760 [2026-03-11 15:19:53,301] ERROR trytond.protocols.wrappers <JSONRequest 1@127.0.0.1 'http://localhost:8000/garman/' [POST] model.stock.move.on_change_with>
Traceback (most recent call last):
  File "/.../trytond/model/model.py", line 394, in _getitem
    return getattr(self, field)
AttributeError: 'stock.move._record' object has no attribute 'secondary_uom_factor'. Did you mean: 'extra_secondary_uom_factor'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/.../trytond/model/model.py", line 317, in __getattr__
    return self._values[name]
           ~~~~~~~~~~~~^^^^^^
  File "/.../trytond/model/model.py", line 396, in _getitem
    raise KeyError(field)
KeyError: 'secondary_uom_factor'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/.../trytond/protocols/wrappers.py", line 200, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/.../trytond/protocols/dispatcher.py", line 201, in _dispatch
    result = rpc.result(meth(inst, *c_args, **c_kwargs))
                        ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../trytond/model/modelview.py", line 52, in wrapper
    result = func(self, *args, **kwargs)
  File "/.../trytond/model/modelview.py", line 805, in on_change_with
    value = getattr(self, method_name)()
  File "/.../trytond/model/fields/field.py", line 124, in wrapper
    return func(self, *args, **kwargs)
  File "/.../trytond/modules/garman/stock.py", line 196, in on_change_with_secondary_quantity
    return super().on_change_with_secondary_quantity(name)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/.../trytond/model/fields/field.py", line 124, in wrapper
    return func(self, *args, **kwargs)
  File "/.../trytond/modules/stock_secondary_unit/stock.py", line 51, in on_change_with_secondary_quantity
    and (self.secondary_uom_factor or self.secondary_uom_rate)):
         ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../trytond/model/modelstorage.py", line 1657, in __getattr__
    return super(ModelStorage, self).__getattr__(name)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/.../trytond/model/model.py", line 319, in __getattr__
    raise AttributeError("'%s' Model has no attribute '%s': %s"
        % (self.__name__, name, self._values))
AttributeError: 'stock.move' Model has no attribute 'secondary_uom_factor': <trytond.model.model.stock.move._record object at 0x7f71c00d39d0>. Did you mean: 'secondary_uom_rate'?

This is typical when the method of @property raise an AttributeError.