[CLEAN] Project_issue: cleaned subtypes, removed auto following that will be added...
[odoo/odoo.git] / addons / point_of_sale / res_users.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.users'
12     _columns = {
13         'ean13' : fields.char('EAN13', size=13, help="BarCode"),
14         'pos_config' : fields.many2one('pos.config', 'Default Point of Sale', domain=[('state', '=', 'active')]),
15     }
16
17     def _check_ean(self, cr, uid, ids, context=None):
18         return all(
19             openerp.addons.product.product.check_ean(user.ean13) == True
20             for user in self.browse(cr, uid, ids, context=context)
21         )
22
23     def edit_ean(self, cr, uid, ids, context):
24         return {
25             'name': "Edit EAN",
26             'type': 'ir.actions.act_window',
27             'view_type': 'form',
28             'view_mode': 'form',
29             'res_model': 'pos.ean_wizard',
30             'target' : 'new',
31             'view_id': False,
32             'context':context,
33         }
34
35     _constraints = [
36         (_check_ean, "Error: Invalid ean code", ['ean13'],),
37     ]
38