Issue 10382

Decimals of quantity move exceed the total digits when split move
Error quantity exceeds the limit when doing stock_split (issue 10227)
Nosy list
ced, resteve
Assigned to

Created on 2021-05-03.19:14:28 by resteve, last changed 1 month ago by ced.


Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-05-03.19:34:34

The traceback is tainted with non standard module and the file lines clearly are not corresponding to last version.
Also I'm pretty sure it is a duplicate of issue10227.

Author: [hidden] (resteve)
Date: 2021-05-03.19:14:28

when try to split a move the number of decimals exceeds the total digits the quantity field [1].

>>> quantity = 317.52
>>> remainder = 589.68
>>> remainder -= quantity
>>> remainder

I think we need to round according the unit_digits from the stock.move, in out scenario, is 3.

>>> remainder = round(remainder, 3)
>>> remainder


The traceback:

Traceback (most recent call last):
  File "/tryton/trytond/trytond/protocols/", line 186, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/tryton/trytond/trytond/wizard/", line 290, in execute
    return wizard._execute(state_name)
  File "/tryton/trytond/trytond/wizard/", line 321, in _execute
    result = self._execute(transition())
  File "/tryton/trytond/trytond/modules/stock_split/", line 128, in transition_split
    move.split(self.start.quantity, self.start.uom, self.start.count)
  File "/tryton/trytond/trytond/modules/stock_split/", line 73, in split
  File "/tryton/trytond/trytond/modules/stock_scanner/", line 94, in copy
    return super(Move, cls).copy(moves, default=default)
  File "/tryton/trytond/trytond/modules/account_invoice_stock/", line 37, in copy
    return super(StockMove, cls).copy(moves, default=default)
  File "/tryton/trytond/trytond/modules/product_cost_fifo/", line 158, in copy
    return super().copy(moves, default=default)
  File "/tryton/trytond/trytond/model/", line 58, in copy
    return super().copy(records, default=default)
  File "/tryton/trytond/trytond/model/", line 409, in copy
    new_records = cls.create(to_create)
  File "/tryton/trytond/trytond/modules/stock/", line 727, in create
    moves = super(Move, cls).create(vlist)
  File "/tryton/trytond/trytond/model/", line 159, in wrapper
    return func(cls, *args, **kwargs)
  File "/tryton/trytond/trytond/model/", line 677, in create
  File "/tryton/trytond/trytond/model/", line 75, in wrapper
    return func(*args, **kwargs)
  File "/tryton/trytond/trytond/model/", line 1257, in _validate
  File "/tryton/trytond/trytond/model/", line 1248, in digits_test
  File "/tryton/trytond/trytond/model/", line 1237, in raise_error
trytond.model.modelstorage.DigitsValidationError: El nombre de dígits del valor "272.15999999999997" del camp "Quantitat" de "Moviment d'existències" excedeix el seu límit de "3". - 
Date User Action Args
2021-05-21 22:57:51cedsetstatus: need-eg -> closed
superseder: + Error quantity exceeds the limit when doing stock_split
2021-05-03 19:34:34cedsetmessages: + msg67344
nosy: + ced
status: chatting -> need-eg
2021-05-03 19:14:28restevecreate

Showing 10 items. Show all history (warning: this could be VERY long)