Launchpad automatic translations update.
[odoo/odoo.git] / addons / point_of_sale / res_partner.py
1
2 import math
3
4 from openerp.osv import osv, fields
5
6 import openerp.addons.product.product
7
8
9 class res_users(osv.osv):
10     _inherit = 'res.partner'
11     _columns = {
12         'ean13' : fields.char('EAN13', size=13, help="BarCode"),
13     }
14
15     def _check_ean(self, cr, uid, ids, context=None):
16         return all(
17             openerp.addons.product.product.check_ean(user.ean13) == True
18             for user in self.browse(cr, uid, ids, context=context)
19         )
20
21     def edit_ean(self, cr, uid, ids, context):
22         return {
23             'name': "Edit Ean",
24             'type': 'ir.actions.act_window',
25             'view_type': 'form',
26             'view_mode': 'form',
27             'res_model': 'pos.ean_wizard',
28             'target' : 'new',
29             'view_id': False,
30             'context':context,
31         }
32
33     _constraints = [
34         (_check_ean, "Error: Invalid ean code", ['ean13'],),
35     ]
36