luc-demeyer / noviat-apps

Noviat apps.odoo.com repository
20 stars 53 forks source link

Error in intrastat #17

Closed lbonjean closed 8 years ago

lbonjean commented 8 years ago

We had an error in intrastat multi company. This fixes it for us. Pls verify it and if it is ok it can be merged.

luc-demeyer commented 8 years ago

I don't understand the issue nor the fix.

in your fix you replace partner_id by l.partner_id but those values are equal hence the old code should also work. What's the exact error message you receive when doing the query with the original code ?

lbonjean commented 8 years ago

This is the error message I get when executing the old code. The error occurs on creating the xml file and the pdf file. It is a multi company installation.

File "/home/odoo/odoo-dev/custom/addons/l10n_be_coa_multilang/wizard/l10n_be_vat_intra.py", line 216, in _get_datas (codes, tuple([p.id for p in wiz_data.period_ids]), data_company.id)) File "/home/odoo/odoo-dev/odoo/openerp/sql_db.py", line 158, in wrapper return f(self, _args, *_kwargs) File "/home/odoo/odoo-dev/odoo/openerp/sql_db.py", line 234, in execute res = self._obj.execute(query, params) ProgrammingError: column reference "partner_id" is ambiguous LINE 18: ... GROUP BY vat, intra_code, partner_name, partner_id

luc-demeyer commented 8 years ago

Thanks for this clarification. It looks like your system contains a module that adds the partner_id field to the 'account_tax_code' or the 'res_partner' table. I have updated our module to avoid this type of problem and I went a little bit further than the patch you proposed, cf. https://github.com/luc-demeyer/noviat-apps/commit/c493b646e175ab13c1c28899f57e81c243cdd1b4

Hence this problem is now fixed.

Thanks for your contribution.