domain=[('type', '=', 'sale')],
help="Accounting journal used to post sales entries."),
'currency_id' : fields.function(_get_currency, type="many2one", string="Currency", relation="res.currency"),
- 'iface_self_checkout' : fields.boolean('Self Checkout Mode', # FIXME : this field is obsolete
- help="Check this if this point of sale should open by default in a self checkout mode. If unchecked, Odoo uses the normal cashier mode by default."),
'iface_cashdrawer' : fields.boolean('Cashdrawer', help="Automatically open the cashdrawer"),
'iface_payment_terminal' : fields.boolean('Payment Terminal', help="Enables Payment Terminal integration"),
'iface_electronic_scale' : fields.boolean('Electronic Scale', help="Enables Electronic Scale integration"),
'group_by' : fields.boolean('Group Journal Items', help="Check this if you want to group the Journal Items by Product while closing a Session"),
'pricelist_id': fields.many2one('product.pricelist','Pricelist', required=True),
'company_id': fields.many2one('res.company', 'Company', required=True),
- 'barcode_nomenclature_id': fields.many2one('barcode.nomenclature','Barcode Nomenclature', help='A barcode nomenclature', required="True"),
+ 'barcode_nomenclature_id': fields.many2one('barcode.nomenclature','Barcodes', help='Defines what kind of barcodes are available and how they are assigned to products, customers and cashiers', required=True),
+ 'group_pos_manager_id': fields.many2one('res.groups','Point of Sale Manager Group', help='This field is there to pass the id of the pos manager group to the point of sale client'),
+ 'group_pos_user_id': fields.many2one('res.groups','Point of Sale User Group', help='This field is there to pass the id of the pos user group to the point of sale client'),
}
def _check_cash_control(self, cr, uid, ids, context=None):
session = record.session_ids[0]
result.append((record.id, record.name + ' ('+session.user_id.name+')')) #, '+states[session.state]+')'))
return result
- def _generate_uuid(self, cr, uid, context=None):
- return str(uuid.uuid1())
def _default_sale_journal(self, cr, uid, context=None):
company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
def _get_default_company(self, cr, uid, context=None):
company_id = self.pool.get('res.users')._get_company(cr, uid, context=context)
+ print company_id
return company_id
def _get_default_nomenclature(self, cr, uid, context=None):
nom_obj = self.pool.get('barcode.nomenclature')
res = nom_obj.search(cr, uid, [], limit=1, context=context)
- if res and res[0]:
- return nom_obj.browse(cr, uid, res[0], context=context).id
- return False
+ return res and res[0] or False
+
+ def _get_group_pos_manager(self, cr, uid, context=None):
+ group = self.pool.get('ir.model.data').get_object_reference(cr,uid,'point_of_sale','group_pos_manager')
+ if group:
+ return group[1]
+ else:
+ return False
+
+ def _get_group_pos_user(self, cr, uid, context=None):
+ group = self.pool.get('ir.model.data').get_object_reference(cr,uid,'point_of_sale','group_pos_user')
+ if group:
+ return group[1]
+ else:
+ return False
_defaults = {
- 'uuid' : _generate_uuid,
+ 'uuid' : lambda self, cr, uid, context={}: str(uuid.uuid4()),
'state' : POS_CONFIG_STATE[0][0],
'journal_id': _default_sale_journal,
'group_by' : True,
'stock_location_id': _get_default_location,
'company_id': _get_default_company,
'barcode_nomenclature_id': _get_default_nomenclature,
+ 'group_pos_manager_id': _get_group_pos_manager,
+ 'group_pos_user_id': _get_group_pos_user,
}
def onchange_picking_type_id(self, cr, uid, ids, picking_type_id, context=None):
class barcode_rule(models.Model):
_inherit = 'barcode.rule'
- type = openerp.fields.Selection(selection_add=[
- ('weight','Weighted Product'),
- ('price','Priced Product'),
- ('discount','Discounted Product'),
- ('client','Client'),
- ('cashier','Cashier')
- ])
+ def _get_type_selection(self):
+ types = super(barcode_rule,self)._get_type_selection()
+
+ new_types = [
+ ('weight','Weighted Product'),
+ ('price','Priced Product'),
+ ('discount','Discounted Product'),
+ ('client','Client'),
+ ('cashier','Cashier')
+ ]
+
+ for (key, value) in new_types:
+ add = True
+ for (key2, value2) in types:
+ if key == key2:
+ add = False
+ break
+ if add:
+ types += [(key, value)]
+
+ return types
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: