odoo/odoo — pull request #616 by rgo-odoo (2014-06-18 10:32:21+00:00)
Title: [FIX] l10n_be_invoice_bba: Fixed the length of random generated code to ...

...ensure it generates 10 digit code so that it allows validation of invoice. (Maintenance Case: 608485)

If the random integer(for bba code) is generated of less then 10 digits for an invoice, it will not allow user to save/validate that invoice and user would then need to regenerate the valid code by calling the onchange. With this fix, it will ensure a 10 digits for random generated integer.

From web-client, if the generated code is something like '+++532/2550/8075+++'(less then 5 digits after the last slash('/')), it will not allow invoice to be saved and will raise the python constraint which will say 'Invalid BBA Structured Communication !'

I have created a script(http://pastebin.com/QRDfAznP) to quickly reproduce the issue by generating 10 random codes and checking each code using function(check_bbacomm(...)) that is used by OE(It should generate 1 or more invalid code by executing the script, may be at second or third or more tries).