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