Skip to content

Document field in the Transaction class should be an integer instead of a string

The Transaction class has a document attribute based on the field "Número de documento", which corresponds to positions 43:53 in the transaction line of a Norma43 file.

According to the documentation, this field must be a number.

imagen

The AEB43 class returns this field without casting it to an integer, instead as a string of 10 characters.

The account_statement_aeb43 module in Tryton expects this attribute to be an integer in order to print it as aeb43_document_number. You can verify this by checking the account statement view:

        <record model="account.statement.origin.information"
            id="information_document_number">
            <field name="name">aeb43_document_number</field>
            <field name="string">Document Number</field>
            <field name="type_">integer</field>
        </record>

When trying to open statement view in tryton client view, an error appears due to bad formatting:

ERROR:tryton.common.common:  File "/home/jm/.virtualenvs/tryton72/lib/python3.10/site-packages/tryton/gui/window/view_form/view/list.py", line 1032, in __sig_switch
    if not self.screen.row_activate() and self.children_field:
  File "/home/jm/.virtualenvs/tryton72/lib/python3.10/site-packages/tryton/gui/window/view_form/view/form_gtk/one2many.py", line 256, in _on_activate
    self._sig_edit()
  File "/home/jm/.virtualenvs/tryton72/lib/python3.10/site-packages/tryton/gui/window/view_form/view/form_gtk/one2many.py", line 469, in _sig_edit
    WinForm(self.screen, callback)
  File "/home/jm/.virtualenvs/tryton72/lib/python3.10/site-packages/tryton/gui/window/win_form.py", line 50, in __init__
    self.screen.switch_view(view_type=view_type)
  File "/home/jm/.virtualenvs/tryton72/lib/python3.10/site-packages/tryton/gui/window/view_form/screen/screen.py", line 588, in switch_view
    self.display()
  File "/home/jm/.virtualenvs/tryton72/lib/python3.10/site-packages/tryton/gui/window/view_form/screen/screen.py", line 969, in display
    view.display()
  File "/home/jm/.virtualenvs/tryton72/lib/python3.10/site-packages/tryton/gui/window/view_form/view/form.py", line 558, in display
    widget.display()
  File "/home/jm/.virtualenvs/tryton72/lib/python3.10/site-packages/tryton/gui/window/view_form/view/form_gtk/dictionary.py", line 638, in display
    widget.set_value(val)
  File "/home/jm/.virtualenvs/tryton72/lib/python3.10/site-packages/tryton/gui/window/view_form/view/form_gtk/dictionary.py", line 289, in set_value
    txt_val = locale.format_string('%d', value, True)
  File "/usr/lib/python3.10/locale.py", line 240, in format_string
    new_val.append(_format(perc.group(),
  File "/usr/lib/python3.10/locale.py", line 187, in _format
    formatted = percent % value

TypeError: %d format: a real number is required, not str

This error cannot be reproduced in SAO because the frontend management approach does not cause a crash.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information