Missing tax values after migration to 5.2

Hello,

we have setup a new tryton 5.2 instance and make a migration from 4.8 to 5.2. After that everything seems to be good, but when we open the tax statements, the tree stays empty, only the structure elements are displayed and zero values.

Should we need some adjustments within our account.xml, because we used a german SKR04 account schema, which works well in 4.8. I saw, that there have been some changes from 5.0 to 5.2, which I inserted, but I do not understand, why the account.tax.line will not be shown in the report.

Thank you and best regards,
Hendrik

Did you update the chart of accounts from the template?

The way how data is computed changed between this versions and it requires to update the chart from the template after the migration to the new version.

Yes, I did, but without any success.

After that, I try to set up a new clean tryton dababase, and try to load the SKR04 module again. But then, I get an XML-error, with the message “Fault: ‘invoice_base_sign’”.

Stacktrace:
103 140592796813056 [2019-10-14 14:58:24,334] ERROR trytond.convert Error while parsing xml file:
In tag record model account.tax.template with id account_de_skr04.tax_eu_19_purchase_ust.
Traceback (most recent call last):
File “/usr/local/lib/python3.5/dist-packages/trytond/convert.py”, line 456, in parse_xmlstream
self.sax_parser.parse(source)
File “/usr/lib/python3.5/xml/sax/expatreader.py”, line 110, in parse
xmlreader.IncrementalParser.parse(self, source)
File “/usr/lib/python3.5/xml/sax/xmlreader.py”, line 125, in parse
self.feed(buffer)
File “/usr/lib/python3.5/xml/sax/expatreader.py”, line 210, in feed
self._parser.Parse(data, isFinal)
File “…/Modules/pyexpat.c”, line 468, in EndElement
File “/usr/lib/python3.5/xml/sax/expatreader.py”, line 325, in end_element
self._cont_handler.endElement(name)
File “/usr/local/lib/python3.5/dist-packages/trytond/convert.py”, line 515, in endElement
self.taghandler = self.taghandler.endElement(name)
File “/usr/local/lib/python3.5/dist-packages/trytond/convert.py”, line 295, in endElement
self.model.name, self.values, self.xml_id)
File “/usr/local/lib/python3.5/dist-packages/trytond/convert.py”, line 694, in import_record
self.create_records(model, [values], [fs_id])
File “/usr/local/lib/python3.5/dist-packages/trytond/convert.py”, line 700, in create_records
records = Model.create(vlist)
File “/usr/local/lib/python3.5/dist-packages/trytond/model/modelsql.py”, line 159, in wrapper
return func(cls, *args, **kwargs)
File “/usr/local/lib/python3.5/dist-packages/trytond/model/modelsql.py”, line 603, in create
field = cls._fields[fname]
KeyError: ‘credit_note_base_sign’

And the XML-record looks like this:

    <record model="account.tax.template" id="tax_eu_19_purchase">
        <field name="name">Innergem. Erwerb 19%USt/19%VSt</field>
        <field name="account" ref="account_template_root"/>
        <field name="description">innergem. Erwerb 19%</field>
        <field name="type">none</field>
        <field name="group" ref="tax_group_vst"/>
    </record>
    <record model="account.tax.template" id="tax_eu_19_purchase_ust">
        <field name="name">19% Umsatzsteuer aus innergem. Erwerb</field>
        <field name="account" ref="account_template_root"/>
        <field name="description">19% USt</field> 
        <field name="type">percentage</field>
        <field name="rate" eval="Decimal('-.19')"/>
        <field name="invoice_account" ref="account_template_3804"/>
        <field name="invoice_base_code" ref="tax_code_89"/>
        <field name="invoice_base_sign" eval="Decimal('-1')"/>
        <field name="invoice_tax_code" ref="tax_code_891"/>
        <field name="invoice_tax_sign" eval="Decimal('-1')"/>
        <field name="credit_note_account" ref="account_template_3804"/>
        <field name="credit_note_base_code" ref="tax_code_89"/>
        <field name="credit_note_base_sign" eval="Decimal('-1')"/>
        <field name="credit_note_tax_code" ref="tax_code_891"/>
        <field name="credit_note_tax_sign" eval="Decimal('-1')"/>
        <field name="parent" ref="tax_eu_19_purchase"/>
    </record>

Actual I am a little bit confused, because I have the fields on the database table but cannot load this XML.

Thank you and best regards,
Hendrik

You should ask the maintainer of this external module to fix it.
It looks like it was not updated to 5.2 series.

Well, that’s me :slight_smile: The problem is, that I tried to compare account_de_skr03 and our implementation and could not find a reason, why there is this fault.

How can I get more informations, to get this module ready for the 5.2 series? Actual, it looks like, that something in the field-list of the AccountTaxTemplate is missing, so the fields are not there at runtime.

Several months ago, I did a migration from 4.8 to 5.0 when the chart of tax codes became empty. We didn’t use a tax codes template but created everything our self.
In our case it turns out that the tax codes were missing tax lines. Adding those tax lines to the tax codes fixed our issue.
Today I migrated my test system to 5.2 and had no problem with the taxes.
So maybe check your Financial -> Configuration -> Taxes -> Tax Codes -> Tax Codes and see if the different codes has lines.
That maybe fixes your missing tax values, but not the template. It can be a start however.

1 Like

For your template I think that some fields should go to a account.tax.code.line.template or something. Please take a look at the account_de_skr03/tax_de.xml around line 348 … 375. Together with my previous post I think you can upgrade your template.

Could you give the link to the module?

Normally the CHANGELOG of account module should give the proper information:

  • Merge account kind and account type

But it seems you also missed this from 4.8:

  • Use tax code line for tax reporting

It may be better to submit your module as standard module (if it makes sense) so it will be updated during development like other chart modules.

Thank you! I made a comparision between the skr03 and skr04 module and found out, where the differences in the XML-defintion are. After correction and update of the chart of accounts, the account based reports are working now.

Only for the tax report it is not working yet, I think it is the part of the migration step for 4.8. I will investigate in that and try to get a solution.

Yes, of course. But, I will be honest, actual I am not sure, if I can met your requirements regarding the quality of code…

Indeed if you have the diferences between the to charts it will be great to have a single module which include both of them. This can be done by using and xslt transformation to generate both charts from a single structure.

That’s how the Spanish Chart of Accounts is developed.

I can provide help on how this can be achieved if requested.

The review process is there to help contributor to acquire and guide them.

1 Like

Thank you! I read the XSL and your module. Actual, I did it in a very basic way by editing the XML via texteditor :slight_smile: I think, my biggest problem is, that I need the chart of accounts and the tax codes, but have no real connection to this topics - I just use the accounting module for booking our invoices :wink:

Alright. I will prepare the module and will submit it, as it is described here https://www.tryton.org/develop

BTW: I found out, what my problems has been:

  1. The tax definition need to be actualized for the new tax code schema, I did it like in the account_de_skr03
  2. The definition of the account code templates and account type templates had some missing attributes like receivable, payable, expenses and the statement field. There, I made some try and error updates to get this working
  3. The updating of the chart of accounts and tax codes had some issues, due to my wrong definitions, so I need at least a clean upgrade, because of doubled tax codes :slight_smile:

At least: Everything runs fine: Chart of accounts, balance sheet, trial balance and the tax code report!
Thank you for your support!