← Back to team overview

c2c-oerpscenario team mailing list archive

Re: [Bug 522192] Re: Incorrect amount_to_text_en.py

 

On Saturday 14 May 2011, you wrote:
> ** Attachment added: "Amount to Text es_MX"
>   
> https://bugs.launchpad.net/openobject-server/+bug/522192/+attachment/21277
> 96/+files/amount_to_text_es_mx.py

Hello.
I have read your patch..

Although I don't deny it does the job (of formulating a string for your 
needs), I would ask you to clean it up a bit.

Please, add a few _english_ comments on what each function does. You need to 
explain to a non-Spanish speaker why the code looks like this etc.
How does it apply to 'pesos', would it work for Euro or Dollars (wrt. 
Feminine/Masculine genders), to hours or other UoMs (or quantities)?

Also, try to avoid in-line conditionals. Being a C old-timer, I can understand 
this syntax. But in python they are not very welcome.
( I mean, the ones like
       if amount == 10 :      res = "ten"
)

I would also recommend you to write a few tests, where the numerical quantity 
passes through your function and is then compared with a fixed string. Like:
     assert amount2text("1500", "Eur") == 'One thousand five hundred Eur"

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/522192

Title:
  Incorrect amount_to_text_en.py

Status in OpenERP Server:
  Confirmed

Bug description:
  amount_to_text_en.py incorrect in structure. It shouldn't redefine so called "generic" functions and variables from amount_to_text.py, but should extend it in proper way - by using add_amount_to_text_function function.
  To avoid confusion i propose to leave in amount_to_text.py "generic" functions only, and all localisation staff turn into amount_to_text_fr.py and so on.
  Modules shouldn't direct use any "amount_to_text_XX" function, instead it should call generic amount_to_text.

  Here is incorrect use from /account_voucher/report/report_voucher.py :

  38 		    def convert(self,amount, cur):
  39 		        amt_en = amount_to_text_en.amount_to_text(amount,'en',cur);
  40 		        return amt_en


References