From 3631cc0df644ae384d16b5dc03fa0e213e94e3b7 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Fri, 21 Mar 2014 17:06:34 +0100 Subject: [PATCH 1/6] [IMP] Give pos config picking type and stock location instead of warehouse bzr revid: jco@openerp.com-20140321160634-zo9pke8pyy1b8byc --- addons/point_of_sale/point_of_sale.py | 19 ++++++++----------- addons/point_of_sale/point_of_sale_view.xml | 9 +++++---- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 11345c79d3f..ad769b9367f 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -61,8 +61,10 @@ class pos_config(osv.osv): 'journal_ids' : fields.many2many('account.journal', 'pos_config_journal_rel', 'pos_config_id', 'journal_id', 'Available Payment Methods', domain="[('journal_user', '=', True ), ('type', 'in', ['bank', 'cash'])]",), - 'warehouse_id' : fields.many2one('stock.warehouse', 'Warehouse', - required=True), +# 'warehouse_id' : fields.many2one('stock.warehouse', 'Warehouse', +# required=True), + 'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type'), + 'stock_location_id': fields.many2one('stock.location', 'Stock Location to take from', required=True), 'journal_id' : fields.many2one('account.journal', 'Sale Journal', domain=[('type', '=', 'sale')], help="Accounting journal used to post sales entries."), @@ -87,7 +89,7 @@ class pos_config(osv.osv): "to customize the reference numbers of your orders."), 'session_ids': fields.one2many('pos.session', 'config_id', 'Sessions'), '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) + 'pricelist_id': fields.many2one('product.pricelist','Pricelist', required=True), } def _check_cash_control(self, cr, uid, ids, context=None): @@ -131,18 +133,12 @@ class pos_config(osv.osv): res = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'sale'), ('company_id', '=', company_id)], limit=1, context=context) return res and res[0] or False - def _default_warehouse(self, cr, uid, context=None): - user = self.pool.get('res.users').browse(cr, uid, uid, context) - res = self.pool.get('stock.warehouse').search(cr, uid, [('company_id', '=', user.company_id.id)], limit=1, context=context) - return res and res[0] or False - def _default_pricelist(self, cr, uid, context=None): res = self.pool.get('product.pricelist').search(cr, uid, [('type', '=', 'sale')], limit=1, context=context) return res and res[0] or False _defaults = { 'state' : POS_CONFIG_STATE[0][0], - 'warehouse_id': _default_warehouse, 'journal_id': _default_sale_journal, 'group_by' : True, 'pricelist_id': _default_pricelist, @@ -664,7 +660,9 @@ class pos_order(osv.osv): 'invoice_id': fields.many2one('account.invoice', 'Invoice'), 'account_move': fields.many2one('account.move', 'Journal Entry', readonly=True), 'picking_id': fields.many2one('stock.picking', 'Picking', readonly=True), - 'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type', required=True), +# 'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type', required=True), + 'picking_type_id': fields.related('session_id', 'config_id', 'picking_type_id', type='many2one', relation='stock.picking.type'), + 'location_id': fields.related('session_id', 'config_id', 'stock_location_id', type='many2one', relation='stock.location'), 'note': fields.text('Internal Notes'), 'nb_print': fields.integer('Number of Print', readonly=True), 'pos_reference': fields.char('Receipt Ref', size=64, readonly=True), @@ -699,7 +697,6 @@ class pos_order(osv.osv): 'session_id': _default_session, 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id, 'pricelist_id': _default_pricelist, - 'picking_type_id': _get_out_picking_type, } def create(self, cr, uid, values, context=None): diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml index 14963af5def..8182fa5e36e 100644 --- a/addons/point_of_sale/point_of_sale_view.xml +++ b/addons/point_of_sale/point_of_sale_view.xml @@ -80,7 +80,7 @@ - + @@ -591,7 +591,8 @@ - + + @@ -639,7 +640,7 @@ - + @@ -653,7 +654,7 @@ - + From d4eda78813e6aaed027ac72c61be304068d1e357 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Mon, 24 Mar 2014 13:07:47 +0100 Subject: [PATCH 2/6] [IMP] Put company_id on pos config + remove pos config name bzr revid: jco@openerp.com-20140324120747-v3mt7pwgqylekshg --- addons/hw_escpos/controllers/main.py | 2 - addons/point_of_sale/point_of_sale.py | 68 ++++++++++------- addons/point_of_sale/static/src/js/models.js | 11 +-- addons/point_of_sale/static/src/xml/pos.xml | 1 - addons/point_of_sale/wizard/pos_return.py | 79 -------------------- 5 files changed, 44 insertions(+), 117 deletions(-) diff --git a/addons/hw_escpos/controllers/main.py b/addons/hw_escpos/controllers/main.py index e950950a985..6237eee786a 100644 --- a/addons/hw_escpos/controllers/main.py +++ b/addons/hw_escpos/controllers/main.py @@ -198,8 +198,6 @@ class EscposDriver(Thread): eprint.text(receipt['company']['name'] + '\n') eprint.set(align='center',type='b') - if check(receipt['shop']['name']): - eprint.text(receipt['shop']['name'] + '\n') if check(receipt['company']['contact_address']): eprint.text(receipt['company']['contact_address'] + '\n') if check(receipt['company']['phone']): diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index ad769b9367f..31650476c7e 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -64,7 +64,7 @@ class pos_config(osv.osv): # 'warehouse_id' : fields.many2one('stock.warehouse', 'Warehouse', # required=True), 'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type'), - 'stock_location_id': fields.many2one('stock.location', 'Stock Location to take from', required=True), + 'stock_location_id': fields.many2one('stock.location', 'Stock Location to take from', domain=[('usage', '=', 'internal')], required=True), 'journal_id' : fields.many2one('account.journal', 'Sale Journal', domain=[('type', '=', 'sale')], help="Accounting journal used to post sales entries."), @@ -90,6 +90,7 @@ class pos_config(osv.osv): 'session_ids': fields.one2many('pos.session', 'config_id', 'Sessions'), '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), } def _check_cash_control(self, cr, uid, ids, context=None): @@ -137,12 +138,18 @@ class pos_config(osv.osv): res = self.pool.get('product.pricelist').search(cr, uid, [('type', '=', 'sale')], limit=1, context=context) return res and res[0] or False + def _get_default_company(self, cr, uid, context=None): + company_id = self.pool.get('res.users')._get_company(cr, uid, context=context) + return company_id + + _defaults = { 'state' : POS_CONFIG_STATE[0][0], 'journal_id': _default_sale_journal, 'group_by' : True, 'pricelist_id': _default_pricelist, 'iface_invoicing': True, + 'company_id': _get_default_company, } def set_active(self, cr, uid, ids, context=None): @@ -330,7 +337,7 @@ class pos_session(osv.osv): # the .xml files as the CoA is not yet installed. jobj = self.pool.get('pos.config') pos_config = jobj.browse(cr, uid, config_id, context=context) - context.update({'company_id': pos_config.warehouse_id.company_id.id}) + context.update({'company_id': pos_config.company_id.id}) if not pos_config.journal_id: jid = jobj.default_get(cr, uid, ['journal_id'], context=context)['journal_id'] if jid: @@ -357,7 +364,7 @@ class pos_session(osv.osv): bank_values = { 'journal_id' : journal.id, 'user_id' : uid, - 'company_id' : pos_config.warehouse_id.company_id.id + 'company_id' : pos_config.company_id.id } statement_id = self.pool.get('account.bank.statement').create(cr, uid, bank_values, context=context) bank_statement_ids.append(statement_id) @@ -631,7 +638,6 @@ class pos_order(osv.osv): _columns = { 'name': fields.char('Order Ref', size=64, required=True, readonly=True), 'company_id':fields.many2one('res.company', 'Company', required=True, readonly=True), - 'warehouse_id': fields.related('session_id', 'config_id', 'warehouse_id', relation='stock.warehouse', type='many2one', string='Warehouse', store=True, readonly=True), 'date_order': fields.datetime('Order Date', readonly=True, select=True), 'user_id': fields.many2one('res.users', 'Salesman', help="Person who uses the the cash register. It can be a reliever, a student or an interim employee."), 'amount_tax': fields.function(_amount_all, string='Taxes', digits_compute=dp.get_precision('Account'), multi='all'), @@ -661,8 +667,8 @@ class pos_order(osv.osv): 'account_move': fields.many2one('account.move', 'Journal Entry', readonly=True), 'picking_id': fields.many2one('stock.picking', 'Picking', readonly=True), # 'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type', required=True), - 'picking_type_id': fields.related('session_id', 'config_id', 'picking_type_id', type='many2one', relation='stock.picking.type'), - 'location_id': fields.related('session_id', 'config_id', 'stock_location_id', type='many2one', relation='stock.location'), + 'picking_type_id': fields.related('session_id', 'config_id', 'picking_type_id', string="Picking Type", type='many2one', relation='stock.picking.type'), + 'location_id': fields.related('session_id', 'config_id', 'stock_location_id', string="Location", type='many2one', relation='stock.location'), 'note': fields.text('Internal Notes'), 'nb_print': fields.integer('Number of Print', readonly=True), 'pos_reference': fields.char('Receipt Ref', size=64, readonly=True), @@ -726,43 +732,55 @@ class pos_order(osv.osv): continue addr = order.partner_id and partner_obj.address_get(cr, uid, [order.partner_id.id], ['delivery']) or {} picking_type = order.picking_type_id - picking_id = picking_obj.create(cr, uid, { - 'origin': order.name, - 'partner_id': addr.get('delivery',False), - 'picking_type_id': picking_type.id, - 'company_id': order.company_id.id, - 'move_type': 'direct', - 'note': order.note or "", - 'invoice_state': 'none', - }, context=context) - self.write(cr, uid, [order.id], {'picking_id': picking_id}, context=context) - location_id = picking_type.default_location_src_id.id + picking_id = False + if picking_type: + picking_id = picking_obj.create(cr, uid, { + 'origin': order.name, + 'partner_id': addr.get('delivery',False), + 'picking_type_id': picking_type.id, + 'company_id': order.company_id.id, + 'move_type': 'direct', + 'note': order.note or "", + 'invoice_state': 'none', + }, context=context) + self.write(cr, uid, [order.id], {'picking_id': picking_id}, context=context) + location_id = order.location_id.id if order.partner_id: destination_id = order.partner_id.property_stock_customer.id - else: + elif picking_type: + if not picking_type.default_location_dest_id: + raise osv.except_osv(_('Error!'), _('Missing source or destination location for picking type %s. Please configure those fields and try again.' % (picking_type.name,))) destination_id = picking_type.default_location_dest_id.id - if not location_id or not destination_id: - raise osv.except_osv(_('Error!'), _('Missing source or destination location for picking type %s. Please configure those fields and try again.' % (picking_type.name,))) + else: + destination_id = partner_obj.default_get(cr, uid, ['property_stock_customer'], context=context)['property_stock_customer'] + move_list = [] for line in order.lines: if line.product_id and line.product_id.type == 'service': continue - move_obj.create(cr, uid, { + move_list.append(move_obj.create(cr, uid, { 'name': line.name, 'product_uom': line.product_id.uom_id.id, 'product_uos': line.product_id.uom_id.id, 'picking_id': picking_id, + 'picking_type_id': picking_type.id, 'product_id': line.product_id.id, 'product_uos_qty': abs(line.qty), 'product_uom_qty': abs(line.qty), 'state': 'draft', 'location_id': location_id if line.qty >= 0 else destination_id, 'location_dest_id': destination_id if line.qty >= 0 else location_id, - }, context=context) - picking_obj.action_confirm(cr, uid, [picking_id], context=context) - picking_obj.force_assign(cr, uid, [picking_id], context=context) - picking_obj.action_done(cr, uid, [picking_id], context=context) + }, context=context)) + + if picking_id: + picking_obj.action_confirm(cr, uid, [picking_id], context=context) + picking_obj.force_assign(cr, uid, [picking_id], context=context) + picking_obj.action_done(cr, uid, [picking_id], context=context) + elif move_list: + move_obj.action_confirm(cr, uid, move_list, context=context) + move_obj.force_assign(cr, uid, move_list, context=context) + move_obj.action_done(cr, uid, move_list, context=context) return True def cancel_order(self, cr, uid, ids, context=None): diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 2197783473d..a7ca62e4cdb 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -34,7 +34,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal this.company_logo = null; this.company_logo_base64 = ''; this.currency = null; - this.shop = null; this.company = null; this.user = null; this.users = []; @@ -174,7 +173,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal return self.fetch( 'pos.config', - ['name','journal_ids','warehouse_id','journal_id','pricelist_id', + ['name','journal_ids','journal_id','pricelist_id', 'iface_self_checkout', 'iface_led', 'iface_cashdrawer', 'iface_payment_terminal', 'iface_electronic_scale', 'iface_barscan', 'iface_vkeyboard','iface_print_via_proxy','iface_scan_via_proxy', @@ -191,10 +190,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal self.config.iface_scan_via_proxy || self.config.iface_cashdrawer; - return self.fetch('stock.warehouse',[],[['id','=', self.config.warehouse_id[0]]]); - }).then(function(shops){ - self.shop = shops[0]; - return self.fetch('product.pricelist',['currency_id'],[['id','=',self.config.pricelist_id[0]]]); }).then(function(pricelists){ self.pricelist = pricelists[0]; @@ -949,7 +944,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal var client = this.get('client'); var cashier = this.pos.cashier || this.pos.user; var company = this.pos.company; - var shop = this.pos.shop; var date = new Date(); return { @@ -993,9 +987,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal phone: company.phone, logo: this.pos.company_logo_base64, }, - shop:{ - name: shop.name, - }, currency: this.pos.currency, }; }, diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index d0cd945d4f4..ba48fcdb664 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -632,7 +632,6 @@
Phone:
User:
- Shop:

diff --git a/addons/point_of_sale/wizard/pos_return.py b/addons/point_of_sale/wizard/pos_return.py index fac55c593e7..cede85d1d38 100644 --- a/addons/point_of_sale/wizard/pos_return.py +++ b/addons/point_of_sale/wizard/pos_return.py @@ -91,85 +91,6 @@ class pos_return(osv.osv_memory): 'context': context, 'type': 'ir.actions.act_window', } - def create_returns2(self, cr, uid, ids, context=None): - - if context is None: - context = {} - active_id = context.get('active_id', False) - order_obj =self.pool.get('pos.order') - line_obj = self.pool.get('pos.order.line') - picking_obj = self.pool.get('stock.picking') - stock_move_obj = self.pool.get('stock.move') - property_obj= self.pool.get("ir.property") - uom_obj =self. pool.get('product.uom') - statementl_obj = self.pool.get('account.bank.statement.line') - #Todo :Need to clean the code - if active_id: - data = self.browse(cr, uid, ids, context=context)[0] - date_cur = time.strftime('%Y-%m-%d %H:%M:%S') - - for order_id in order_obj.browse(cr, uid, [active_id], context=context): - source_stock_id = property_obj.get(cr, uid, 'property_stock_customer', 'res.partner', context=context).id - cr.execute("SELECT s.id FROM stock_location s, stock_warehouse w " - "WHERE w.lot_stock_id=s.id AND w.id=%s ", - (order_id.warehouse_id.id,)) - res = cr.fetchone() - location_id = res and res[0] or None - new_picking = picking_obj.copy(cr, uid, order_id.picking_id.id, {'name':'%s (return)' % order_id.name, - 'move_lines': [], - 'state':'draft', - 'type': 'in', - 'partner_id': order_id.partner_id.id, - 'date': date_cur }) - new_order = order_obj.copy(cr, uid, order_id.id, {'name': 'Refund %s'%order_id.name, - 'lines':[], - 'statement_ids':[], - 'picking_id':[]}) - account_def = property_obj.get(cr, uid, 'property_account_payable', 'res.partner', context=context) - amount = 0.0 - for line in order_id.lines: - for record in data.pos_moves_ids: - if line.id == record.line_id: - qty = record.quantity - amount += qty * line.price_unit - stock_move_obj.create(cr, uid, { - 'product_uom_qty': qty, - 'product_uos_qty': uom_obj._compute_qty(cr, uid, qty ,line.product_id.uom_id.id), - 'picking_id': new_picking, - 'product_uom': line.product_id.uom_id.id, - 'location_id': source_stock_id, - 'product_id': line.product_id.id, - 'location_dest_id': location_id, - 'name': '%s (return)' %order_id.name, - 'date': date_cur - }) - if qty != 0.0: - line_obj.copy(cr, uid, line.id, {'qty': -qty, 'order_id': new_order}) - statementl_obj.create(cr, uid, { - 'name': 'Refund %s'%order_id.name, - 'statement_id': order_id.statement_ids[0].statement_id.id, - 'pos_statement_id': new_order, - 'date': fields.date.context_today(self, cr, uid, context=context), - 'account_id': order_id.partner_id and order_id.partner_id.property_account_payable \ - and order_id.partner_id.property_account_payable.id or account_def.id, - 'amount': -amount, - }) - order_obj.write(cr,uid, [active_id,new_order], {'state': 'done'}) - picking_obj.signal_button_confirm(cr, uid, [new_picking]) - picking_obj.force_assign(cr, uid, [new_picking], context) - act = { - 'domain': "[('id', 'in', ["+str(new_order)+"])]", - 'name': 'Refunded Orders', - 'view_type': 'form', - 'view_mode': 'tree,form', - 'res_model': 'pos.order', - 'auto_refresh':0, - 'res_id':new_order, - 'view_id': False, - 'context':context, - 'type': 'ir.actions.act_window' - } - return act class add_product(osv.osv_memory): From 641fc49eebfbb5c5be672b6e27f8a28e41ed84ca Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Mon, 24 Mar 2014 13:33:46 +0100 Subject: [PATCH 3/6] [ADD] Add default location for PoS config bzr revid: jco@openerp.com-20140324123346-r190l8e1ug5mhgyr --- addons/point_of_sale/point_of_sale.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 31650476c7e..3085cc658df 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -64,7 +64,7 @@ class pos_config(osv.osv): # 'warehouse_id' : fields.many2one('stock.warehouse', 'Warehouse', # required=True), 'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type'), - 'stock_location_id': fields.many2one('stock.location', 'Stock Location to take from', domain=[('usage', '=', 'internal')], required=True), + 'stock_location_id': fields.many2one('stock.location', 'Stock Location', domain=[('usage', '=', 'internal')], required=True), 'journal_id' : fields.many2one('account.journal', 'Sale Journal', domain=[('type', '=', 'sale')], help="Accounting journal used to post sales entries."), @@ -138,6 +138,15 @@ class pos_config(osv.osv): res = self.pool.get('product.pricelist').search(cr, uid, [('type', '=', 'sale')], limit=1, context=context) return res and res[0] or False + + def _get_default_location(self, cr, uid, context=None): + wh_obj = self.pool.get('stock.warehouse') + user = self.pool.get('res.users').browse(cr, uid, uid, context) + res = wh_obj.search(cr, uid, [('company_id', '=', user.company_id.id)], limit=1, context=context) + if res and res[0]: + return wh_obj.browse(cr, uid, res[0], context=context).lot_stock_id.id + return False + def _get_default_company(self, cr, uid, context=None): company_id = self.pool.get('res.users')._get_company(cr, uid, context=context) return company_id @@ -149,6 +158,7 @@ class pos_config(osv.osv): 'group_by' : True, 'pricelist_id': _default_pricelist, 'iface_invoicing': True, + 'stock_location_id': _get_default_location, 'company_id': _get_default_company, } From 265579870661b8ab2a94a37a792204d9f1db227b Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Mon, 24 Mar 2014 13:54:41 +0100 Subject: [PATCH 4/6] [IMP] Onchange on picking type in pos.config bzr revid: jco@openerp.com-20140324125441-eh4wb77pwzop0zon --- addons/point_of_sale/point_of_sale.py | 8 ++++++++ addons/point_of_sale/point_of_sale_view.xml | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 3085cc658df..040874d038a 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -162,6 +162,14 @@ class pos_config(osv.osv): 'company_id': _get_default_company, } + + def onchange_picking_type_id(self, cr, uid, ids, picking_type_id, context=None): + p_type_obj = self.pool.get("stock.picking.type") + p_type = p_type_obj.browse(cr, uid, picking_type_id, context=context) + if p_type.default_location_src_id and p_type.default_location_src_id.usage == 'internal' and p_type.default_location_dest_id and p_type.default_location_dest_id.usage == 'customer': + return {'value': {'stock_location_id': p_type.default_location_src_id.id}} + return False + def set_active(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'state' : 'active'}, context=context) diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml index 8182fa5e36e..9a076d2922c 100644 --- a/addons/point_of_sale/point_of_sale_view.xml +++ b/addons/point_of_sale/point_of_sale_view.xml @@ -591,7 +591,8 @@ - + From fd6352ac06796ed47c2b6f7a06d474d1990a73f4 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Mon, 24 Mar 2014 16:22:11 +0100 Subject: [PATCH 5/6] [IMP] Change report to have location instead of warehouse bzr revid: jco@openerp.com-20140324152211-jecefcplr9mjk0wy --- addons/point_of_sale/point_of_sale.py | 3 +-- addons/point_of_sale/report/pos_order_report.py | 6 +++--- addons/point_of_sale/report/pos_order_report_view.xml | 1 + 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 040874d038a..cb5a6692bfb 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -684,9 +684,8 @@ class pos_order(osv.osv): 'invoice_id': fields.many2one('account.invoice', 'Invoice'), 'account_move': fields.many2one('account.move', 'Journal Entry', readonly=True), 'picking_id': fields.many2one('stock.picking', 'Picking', readonly=True), -# 'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type', required=True), 'picking_type_id': fields.related('session_id', 'config_id', 'picking_type_id', string="Picking Type", type='many2one', relation='stock.picking.type'), - 'location_id': fields.related('session_id', 'config_id', 'stock_location_id', string="Location", type='many2one', relation='stock.location'), + 'location_id': fields.related('session_id', 'config_id', 'stock_location_id', string="Location", type='many2one', store=True, relation='stock.location'), 'note': fields.text('Internal Notes'), 'nb_print': fields.integer('Number of Print', readonly=True), 'pos_reference': fields.char('Receipt Ref', size=64, readonly=True), diff --git a/addons/point_of_sale/report/pos_order_report.py b/addons/point_of_sale/report/pos_order_report.py index 5489ccf7099..efc46dfe9ce 100644 --- a/addons/point_of_sale/report/pos_order_report.py +++ b/addons/point_of_sale/report/pos_order_report.py @@ -36,7 +36,7 @@ class pos_order_report(osv.osv): 'price_total':fields.float('Total Price', readonly=True), 'total_discount':fields.float('Total Discount', readonly=True), 'average_price': fields.float('Average Price', readonly=True,group_operator="avg"), - 'warehouse_id':fields.many2one('stock.warehouse', 'Warehouse', readonly=True), + 'location_id':fields.many2one('stock.location', 'Location', readonly=True), 'company_id':fields.many2one('res.company', 'Company', readonly=True), 'nbr':fields.integer('# of Lines', readonly=True), 'product_qty':fields.integer('# of Qty', readonly=True), @@ -61,7 +61,7 @@ class pos_order_report(osv.osv): s.partner_id as partner_id, s.state as state, s.user_id as user_id, - s.warehouse_id as warehouse_id, + s.location_id as location_id, s.company_id as company_id, s.sale_journal as journal_id, l.product_id as product_id @@ -71,7 +71,7 @@ class pos_order_report(osv.osv): left join product_uom u on (u.id=pt.uom_id) group by s.date_order, s.partner_id,s.state, - s.user_id,s.warehouse_id,s.company_id,s.sale_journal,l.product_id,s.create_date + s.user_id,s.location_id,s.company_id,s.sale_journal,l.product_id,s.create_date having sum(l.qty * u.factor) != 0)""") diff --git a/addons/point_of_sale/report/pos_order_report_view.xml b/addons/point_of_sale/report/pos_order_report_view.xml index a34bab9c559..5cef1f92cbf 100644 --- a/addons/point_of_sale/report/pos_order_report_view.xml +++ b/addons/point_of_sale/report/pos_order_report_view.xml @@ -36,6 +36,7 @@ + From 4d2eb14146fcd5a850b99ed9c88a63f74bb74c4e Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Mon, 24 Mar 2014 17:03:11 +0100 Subject: [PATCH 6/6] [IMP] The main pos config should use a standard picking type bzr revid: jco@openerp.com-20140324160311-aj4zh1y9etbeszfp --- addons/point_of_sale/point_of_sale_data.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/point_of_sale/point_of_sale_data.xml b/addons/point_of_sale/point_of_sale_data.xml index f5ad5931cad..106075ba3b2 100644 --- a/addons/point_of_sale/point_of_sale_data.xml +++ b/addons/point_of_sale/point_of_sale_data.xml @@ -31,6 +31,7 @@ Main +