Module l10nch: bug with the reference number

Bug #535618 reported by Open Net Sàrl
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
Unassigned

Bug Description

While printing a BVR with the module l10n_ch, one can encounter a bug, espacially if the invoice number has a slash in it.
When an invoice is created, a small function called '_convert_ref( ... )' removes all occurences of slashes.
Within the l10n_ch module, while printing a BVR, all characters but digits are converted to 0's (the digit), so that the reference number that is printed does not correspond to what is in the database.
Example:
    FC00020021/2010 becomes:
        account_invoice table: FC000200212010
        printed on the BVR: 000002002102010
After that, importing the BVR's can not do its job because the reference has no chance to find anything.
I suggest the following change in l10n_ch/report/bvr.py, line 108:
          -- invoice_number = re.sub('[^0-9]', '0', o.number)
          ++ invoice_number = re.sub('[^0-9]', '', o.number)

Best regards

affects: openobject-server → openobject-addons
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Hello,
If you read the BVR manual
http://www.postfinance.ch/pf/content/fr/seg/biz/customer/download/doc.html
You will see that ref numbers are validating using the modulo 10 validation algorithm. So as this algorithm can only check
numeric data, non numeric chars are not allowed in reference numbers.

Regards

Nicolas

Changed in openobject-addons:
status: New → Invalid
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

An other point the len of the ref is used to determine the type of postfinance account =>
If it is a post account or a bank account hosted by postfinance. So replacing special chars with empty strings is not a good idea.

Regards

Nicolas

Revision history for this message
Open Net Sàrl (openerp-open-net) wrote :

Thank you for your comments.

The modification i am proposing is taking place before the line that pads everything to the right so that 26 digits are always generated.
Remember: this modification introduces the same reference number as do the official code, the mod10 excepted.
No invalid characters are introduced.

Changed in openobject-addons:
status: Invalid → New
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Hello,

Sorry, I did not understand well your ticket. It 'is right that the reference column in the account_move_line will not match the printed reference. It is due to the fact that the _convert_ref function of account.invoice has been changed.

The best solution will be to override this function in account invoice, but it may have unexpected side effect. So we have to modified the wizard and report code.

Your patch is a part of the solution, but the modification has to be propagated to bvr_import.py

I have provided a patch, feel free to test it.

Regards

Nicolas

Changed in openobject-addons:
status: New → Fix Committed
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

It has been Fixed by revision 2731 <email address hidden>.
Thanks.

Changed in openobject-addons:
importance: Undecided → Medium
milestone: none → 5.0.11
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.