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