2012-12-06 14:56:32 +00:00
|
|
|
|
2012-05-09 09:35:17 +00:00
|
|
|
import math
|
2012-12-06 14:56:32 +00:00
|
|
|
|
|
|
|
from openerp.osv import osv, fields
|
|
|
|
|
2012-07-26 09:53:15 +00:00
|
|
|
import openerp.addons.product.product
|
2012-05-09 09:35:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
class res_users(osv.osv):
|
|
|
|
_inherit = 'res.users'
|
|
|
|
_columns = {
|
|
|
|
'ean13' : fields.char('EAN13', size=13, help="BarCode"),
|
2012-05-12 22:37:43 +00:00
|
|
|
'pos_config' : fields.many2one('pos.config', 'Default Point of Sale', domain=[('state', '=', 'active')]),
|
2012-05-09 09:35:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def _check_ean(self, cr, uid, ids, context=None):
|
|
|
|
return all(
|
2012-07-26 09:53:15 +00:00
|
|
|
openerp.addons.product.product.check_ean(user.ean13) == True
|
2012-05-09 09:35:17 +00:00
|
|
|
for user in self.browse(cr, uid, ids, context=context)
|
2012-05-12 22:37:43 +00:00
|
|
|
)
|
2012-05-09 09:35:17 +00:00
|
|
|
|
2012-07-25 14:26:08 +00:00
|
|
|
def edit_ean(self, cr, uid, ids, context):
|
|
|
|
return {
|
2012-11-05 13:11:21 +00:00
|
|
|
'name': "Edit EAN",
|
2012-07-25 14:26:08 +00:00
|
|
|
'type': 'ir.actions.act_window',
|
|
|
|
'view_type': 'form',
|
|
|
|
'view_mode': 'form',
|
|
|
|
'res_model': 'pos.ean_wizard',
|
|
|
|
'target' : 'new',
|
|
|
|
'view_id': False,
|
|
|
|
'context':context,
|
|
|
|
}
|
|
|
|
|
2012-05-09 09:35:17 +00:00
|
|
|
_constraints = [
|
|
|
|
(_check_ean, "Error: Invalid ean code", ['ean13'],),
|
|
|
|
]
|
|
|
|
|