Community mailing list archives

community@mail.odoo.com

Re: best way to generate a field

by
mr.file
- 01/27/2015 06:44:54
2015-01-27 12:28 GMT+01:00 Ludwik Trammer <ludwik@gmail.com>:

The second one looks almost correct, but I don't know where did the "related_vals" came from. The line should read:
    self.ean13 = barcode.get_barcode('ean13', code).get_fullcode()

​Yes, related vals it's a copy/paste error! :)
It's correct your line of code (self.ean13)

 
"_compute_default_code" looks very incomplete. Also, you use the old API (style) for defining model fields. 
​You're right again, thanks, this should be ok!
​def _compute_default_code(self):
    self.default_code = self.pool.get('ir.sequence').get(cr, uid, 'product.product')

​I use still the old api becaus all the product module still use the old api in v8.
If the original module still use the old api, can overwrite somthing using the new api? doesn't this generate confusion?
Thanks again
Fabrizio​