X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=addons%2Fpoint_of_sale%2Fpoint_of_sale.py;fp=addons%2Fpoint_of_sale%2Fpoint_of_sale.py;h=d30d754ff241e81a23a91721bbac8e1a295ca861;hb=dc560a4dd0b6c109eede6b30c02ae4b34ca77c38;hp=5b67bdc9c1c03923ef4a2fef60197054152c3433;hpb=b5164698f255633e68e6c3b75f30eae8492326dc;p=odoo%2Fodoo.git diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 5b67bdc..d30d754 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -21,8 +21,10 @@ import logging import time +import uuid +import sets -from openerp import tools +from openerp import tools, models from openerp.osv import fields, osv from openerp.tools.translate import _ from openerp.exceptions import Warning @@ -63,8 +65,6 @@ class pos_config(osv.osv): 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"), @@ -74,11 +74,15 @@ class pos_config(osv.osv): 'iface_invoicing': fields.boolean('Invoicing',help='Enables invoice generation from the Point of Sale'), 'iface_big_scrollbars': fields.boolean('Large Scrollbars',help='For imprecise industrial touchscreens'), 'iface_fullscreen': fields.boolean('Fullscreen', help='Display the Point of Sale in full screen mode'), + 'iface_print_auto': fields.boolean('Automatic Receipt Printing', help='The receipt will automatically be printed at the end of each order'), + 'iface_precompute_cash': fields.boolean('Prefill Cash Payment', help='The payment input will behave similarily to bank payment input, and will be prefilled with the exact due amount'), + 'iface_tax_included': fields.boolean('Include Taxes in Prices', help='The displayed prices will always include all taxes, even if the taxes have been setup differently'), 'receipt_header': fields.text('Receipt Header',help="A short text that will be inserted as a header in the printed receipt"), 'receipt_footer': fields.text('Receipt Footer',help="A short text that will be inserted as a footer in the printed receipt"), 'proxy_ip': fields.char('IP Address', help='The hostname or ip address of the hardware proxy, Will be autodetected if left empty', size=45), 'state' : fields.selection(POS_CONFIG_STATE, 'Status', required=True, readonly=True, copy=False), + 'uuid' : fields.char('uuid', readonly=True, help='A globally unique identifier for this pos configuration, used to prevent conflicts in client-generated data'), 'sequence_id' : fields.many2one('ir.sequence', 'Order IDs Sequence', readonly=True, help="This sequence is automatically created by Odoo but you can change it "\ "to customize the reference numbers of your orders.", copy=False), @@ -86,12 +90,9 @@ class pos_config(osv.osv): '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_product': fields.char('Product Barcodes', size=64, help='The pattern that identifies product barcodes'), - 'barcode_cashier': fields.char('Cashier Barcodes', size=64, help='The pattern that identifies cashier login barcodes'), - 'barcode_customer': fields.char('Customer Barcodes',size=64, help='The pattern that identifies customer\'s client card barcodes'), - 'barcode_price': fields.char('Price Barcodes', size=64, help='The pattern that identifies a product with a barcode encoded price'), - 'barcode_weight': fields.char('Weight Barcodes', size=64, help='The pattern that identifies a product with a barcode encoded weight'), - 'barcode_discount': fields.char('Discount Barcodes', size=64, help='The pattern that identifies a product with a barcode encoded discount'), + '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): @@ -164,22 +165,41 @@ class pos_config(osv.osv): 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) + 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' : lambda self, cr, uid, context={}: str(uuid.uuid4()), 'state' : POS_CONFIG_STATE[0][0], 'journal_id': _default_sale_journal, 'group_by' : True, 'pricelist_id': _default_pricelist, 'iface_invoicing': True, + 'iface_print_auto': True, 'stock_location_id': _get_default_location, 'company_id': _get_default_company, - 'barcode_product': '*', - 'barcode_cashier': '041*', - 'barcode_customer':'042*', - 'barcode_weight': '21xxxxxNNDDD', - 'barcode_discount':'22xxxxxxxxNN', - 'barcode_price': '23xxxxxNNNDD', + '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): @@ -1338,7 +1358,7 @@ class ean_wizard(osv.osv_memory): ean13 = openerp.addons.product.product.sanitize_ean13(r.ean13_pattern) m = context.get('active_model') m_id = context.get('active_id') - self.pool[m].write(cr,uid,[m_id],{'ean13':ean13}) + self.pool[m].write(cr,uid,[m_id],{'barcode':ean13}) return { 'type' : 'ir.actions.act_window_close' } class pos_category(osv.osv): @@ -1443,6 +1463,18 @@ class res_partner(osv.osv): return partner_id - +class barcode_rule(models.Model): + _inherit = 'barcode.rule' + + def _get_type_selection(self): + types = sets.Set(super(barcode_rule,self)._get_type_selection()) + types.update([ + ('weight','Weighted Product'), + ('price','Priced Product'), + ('discount','Discounted Product'), + ('client','Client'), + ('cashier','Cashier') + ]) + return list(types) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: