Crash when creating a sale with payment term and account_cash_rounding module
When the account_cash_rounding
module is activated creating a sale with payment term raises the following exception::
File "/home/pokoli/projectes/tryton/modules/account_cash_rounding/tests/scenario_account_cash_rounding_sale.rst", line 74, in scenario_account_cash_rounding_sale.rst
Failed example:
line = sale.lines.new()
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python3.11/doctest.py", line 1351, in __run
exec(compile(example.source, filename, "single",
File "<doctest scenario_account_cash_rounding_sale.rst[43]>", line 1, in <module>
line = sale.lines.new()
^^^^^^^^^^^^^^^^
File "/home/pokoli/projectes/tryton/proteus/proteus/__init__.py", line 638, in new
new_record = Relation(_group=self, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pokoli/projectes/tryton/proteus/proteus/__init__.py", line 712, in __init__
self._default_get()
File "/home/pokoli/projectes/tryton/proteus/proteus/__init__.py", line 982, in _default_get
self._default_set(
File "/home/pokoli/projectes/tryton/proteus/proteus/__init__.py", line 1005, in _default_set
self._on_change(sorted(fieldnames))
File "/home/pokoli/projectes/tryton/proteus/proteus/__init__.py", line 1190, in _on_change
self._parent._on_change([self._parent_field_name])
File "/home/pokoli/projectes/tryton/proteus/proteus/__init__.py", line 1155, in _on_change
change = getattr(self._proxy, 'on_change')(values, names, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pokoli/projectes/tryton/proteus/proteus/config.py", line 215, in __call__
meth(inst, *c_args, **c_kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pokoli/projectes/tryton/trytond/trytond/model/modelview.py", line 51, in wrapper
result = func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pokoli/projectes/tryton/trytond/trytond/model/modelview.py", line 795, in on_change
method()
File "/home/pokoli/projectes/tryton/trytond/trytond/model/modelview.py", line 51, in wrapper
result = func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pokoli/projectes/tryton/trytond/trytond/model/fields/field.py", line 124, in wrapper
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pokoli/projectes/tryton/trytond/trytond/modules/account_cash_rounding/sale.py", line 20, in on_change_lines
self.total_amount = self._cash_round_total_amount(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pokoli/projectes/tryton/trytond/trytond/model/fields/field.py", line 124, in wrapper
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pokoli/projectes/tryton/trytond/trytond/modules/account_cash_rounding/sale.py", line 48, in _cash_round_total_amount
with Transaction().set_company(company=self.company.id):
^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Transaction' object has no attribute 'set_company'