From fd4cb45dfd83c9ab32e13dd0d8d98ba34be21ea9 Mon Sep 17 00:00:00 2001 From: "Saurang Suthar (OpenERP)" Date: Mon, 11 Jun 2012 12:38:45 +0530 Subject: [PATCH 001/165] [FIX]stock:improved code by reverting all unwanted changes bzr revid: ssu@tinyerp.com-20120611070845-k28njbigvd8pq5l6 --- addons/stock/report/picking.rml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/addons/stock/report/picking.rml b/addons/stock/report/picking.rml index 898c078157d..5f395c9f005 100644 --- a/addons/stock/report/picking.rml +++ b/addons/stock/report/picking.rml @@ -299,21 +299,6 @@ - - - - - - - - - Total - - - [[ formatLang(get_qtytotal(picking.move_lines)['quantity']) ]] [[ get_qtytotal(picking.move_lines)['uom'] ]] - - - From bc23c8b7275c950641100ac2b276adece4a64620 Mon Sep 17 00:00:00 2001 From: "Saurang Suthar (OpenERP)" Date: Mon, 11 Jun 2012 14:16:28 +0530 Subject: [PATCH 002/165] [FIX]stock:remove unnecessary function bzr revid: ssu@tinyerp.com-20120611084628-musbyk3jhlg1ulaj --- addons/stock/report/picking.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/addons/stock/report/picking.py b/addons/stock/report/picking.py index 27141c917a9..29a53fba7a2 100644 --- a/addons/stock/report/picking.py +++ b/addons/stock/report/picking.py @@ -29,14 +29,7 @@ class picking(report_sxw.rml_parse): super(picking, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, - 'get_qtytotal':self._get_qtytotal }) - def _get_qtytotal(self,move_lines): - total = 0.0 - uom = move_lines[0].product_uom.name - for move in move_lines: - total+=move.product_qty - return {'quantity':total,'uom':uom} report_sxw.report_sxw('report.stock.picking.list','stock.picking','addons/stock/report/picking.rml',parser=picking) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 5d5ab9c9f99a3dd80401bd850de82ad3aaa6ebca Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Mon, 11 Jun 2012 17:49:40 +0530 Subject: [PATCH 003/165] [FIX]stock : add value to the field year & month bzr revid: cha@tinyerp.com-20120611121940-ynw03liych1gj2df --- addons/stock/report/report_stock_move.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/stock/report/report_stock_move.py b/addons/stock/report/report_stock_move.py index afd6bd4d1f4..894d82534a2 100644 --- a/addons/stock/report/report_stock_move.py +++ b/addons/stock/report/report_stock_move.py @@ -153,7 +153,7 @@ class report_stock_inventory(osv.osv): 'date': fields.datetime('Date', readonly=True), 'year': fields.char('Year', size=4, readonly=True), 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), - ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September')]), + ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September')],'Month'), 'partner_id':fields.many2one('res.partner', 'Partner', readonly=True), 'product_id':fields.many2one('product.product', 'Product', readonly=True), 'product_categ_id':fields.many2one('product.category', 'Product Category', readonly=True), @@ -173,6 +173,8 @@ class report_stock_inventory(osv.osv): CREATE OR REPLACE view report_stock_inventory AS ( (SELECT min(m.id) as id, m.date as date, + to_char(m.date, 'YYYY') as year, + to_char(m.date, 'MM') as month, m.partner_id as partner_id, m.location_id as location_id, m.product_id as product_id, pt.categ_id as product_categ_id, l.usage as location_type, m.company_id, @@ -195,6 +197,8 @@ CREATE OR REPLACE view report_stock_inventory AS ( ) UNION ALL ( SELECT -m.id as id, m.date as date, + to_char(m.date, 'YYYY') as year, + to_char(m.date, 'MM') as month, m.partner_id as partner_id, m.location_dest_id as location_id, m.product_id as product_id, pt.categ_id as product_categ_id, l.usage as location_type, m.company_id, From 449e9ee6fa629a66baeb2473c92bfdde3d3ad826 Mon Sep 17 00:00:00 2001 From: "Khushboo Bhatt (Open ERP)" Date: Thu, 21 Jun 2012 12:08:00 +0530 Subject: [PATCH 004/165] [FIX]Journal entry for rule which is not in payslip lines is created. bzr revid: kbh@tinyerp.com-20120621063800-0nhf399uaf1nbdmw --- addons/hr_payroll_account/hr_payroll_account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_payroll_account/hr_payroll_account.py b/addons/hr_payroll_account/hr_payroll_account.py index a022cac05b1..cfd35c7ea2b 100644 --- a/addons/hr_payroll_account/hr_payroll_account.py +++ b/addons/hr_payroll_account/hr_payroll_account.py @@ -107,7 +107,7 @@ class hr_payslip(osv.osv): 'journal_id': slip.journal_id.id, 'period_id': period_id, } - for line in slip.line_ids: + for line in slip.details_by_salary_rule_category: amt = slip.credit_note and -line.total or line.total partner_id = False debit_account_id = line.salary_rule_id.account_debit.id From c5f7f6ecdf710985f29cc73e310ea1f3852b468d Mon Sep 17 00:00:00 2001 From: hugo <> Date: Thu, 21 Jun 2012 14:40:01 +0530 Subject: [PATCH 005/165] [FIX] stock : Wrong quantity on invoice when invoice based on delivery and stock move has more than one line on picking lp bug: https://launchpad.net/bugs/1015697 fixed bzr revid: amp@tinyerp.com-20120621091001-of46b1016rqcpyvz --- addons/stock/stock.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 87cf9ade130..9b754deba7b 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2082,11 +2082,13 @@ class stock_move(osv.osv): done.append(move.id) pickings[move.picking_id.id] = 1 r = res.pop(0) - cr.execute('update stock_move set location_id=%s, product_qty=%s where id=%s', (r[1], r[0], move.id)) + product_uos_qty = self.pool.get('stock.move').onchange_quantity(cr, uid, ids, move.product_id.id, r[0], move.product_id.uom_id.id, move.product_id.uos_id.id)['value']['product_uos_qty'] + cr.execute('update stock_move set location_id=%s, product_qty=%s, product_uos_qty=%s where id=%s', (r[1], r[0], r[0], move.id)) while res: r = res.pop(0) - move_id = self.copy(cr, uid, move.id, {'product_qty': r[0], 'location_id': r[1]}) + product_uos_qty = self.pool.get('stock.move').onchange_quantity(cr, uid, ids, move.product_id.id, r[0], move.product_id.uom_id.id, move.product_id.uos_id.id)['value']['product_uos_qty'] + move_id = self.copy(cr, uid, move.id, {'product_uos_qty': product_uos_qty, 'product_qty': r[0], 'location_id': r[1]}) done.append(move_id) if done: count += len(done) From 56150b1aef230cd7a7fb4cd8f44dd8884934d716 Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Fri, 22 Jun 2012 17:02:37 +0530 Subject: [PATCH 006/165] [FIX] Purchase: set value for field expected_date in purchase.order lp bug: https://launchpad.net/bugs/1016372 fixed bzr revid: cha@tinyerp.com-20120622113237-88laaa8603jr0k73 --- addons/purchase/report/purchase_report.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/purchase/report/purchase_report.py b/addons/purchase/report/purchase_report.py index f7d73bfb739..ec8f7d5cba5 100644 --- a/addons/purchase/report/purchase_report.py +++ b/addons/purchase/report/purchase_report.py @@ -79,7 +79,7 @@ class purchase_report(osv.osv): to_char(s.date_order, 'YYYY-MM-DD') as day, s.state, s.date_approve, - date_trunc('day',s.minimum_planned_date) as expected_date, + s.minimum_planned_date as expected_date, s.dest_address_id, s.pricelist_id, s.validator, @@ -118,7 +118,7 @@ class purchase_report(osv.osv): s.date_approve, l.date_planned, l.product_uom, - date_trunc('day',s.minimum_planned_date), + s.minimum_planned_date, s.pricelist_id, s.validator, s.dest_address_id, From 9c54520f3669262490223f5c1ce68b136ff65e36 Mon Sep 17 00:00:00 2001 From: "Pinakin Nayi (OpenERP)" Date: Wed, 4 Jul 2012 14:46:13 +0530 Subject: [PATCH 007/165] [IMP]server-log-warning bzr revid: pna@tinyerp.com-20120704091613-i7vxzgq8hgmv20s5 --- addons/l10n_uk/demo/demo.xml | 4 ++-- addons/mail/mail_thread.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/l10n_uk/demo/demo.xml b/addons/l10n_uk/demo/demo.xml index 1184828df50..f1d5088c825 100644 --- a/addons/l10n_uk/demo/demo.xml +++ b/addons/l10n_uk/demo/demo.xml @@ -1,6 +1,6 @@ - + UK OpenERP Partner smartmode http://www.smartmode.co.uk @@ -12,7 +12,7 @@ Vadim Chobanu HA4 7JW Ruislip - + vadim@smartmode.co.uk +44 (0) 8456434548 diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 5668709af17..3d65f1313a6 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -202,7 +202,6 @@ class mail_thread(osv.Model): def message_create_get_notification_user_ids(self, cr, uid, thread_ids, new_msg_vals, context=None): if context is None: context = {} - notif_user_ids = [] body = new_msg_vals.get('body_html', '') if new_msg_vals.get('subtype', 'plain') == 'html' else new_msg_vals.get('body_text', '') for thread_id in thread_ids: @@ -880,7 +879,7 @@ class mail_thread(osv.Model): """ When creating a new message, set as unread if uid is not the object responsible. """ for obj in self.browse(cr, uid, ids, context=context): - if obj.message_state and hasattr(obj, 'user_id') and (not obj.user_id or obj.user_id.id != uid): + if obj.message_state and ('user_id' in obj._columns.keys()) and (not obj.user_id or obj.user_id.id != uid) : self.message_mark_as_unread(cr, uid, [obj.id], context=context) def message_check_and_set_unread(self, cr, uid, ids, context=None): From 3982e3524a1ab8bbe18b931d614fbcb46ece07bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Tue, 17 Jul 2012 16:29:23 +0200 Subject: [PATCH 008/165] [FIX] point_of_sale: various css fixes bzr revid: fva@openerp.com-20120717142923-tk4nkp4mdbegcndi --- addons/point_of_sale/static/src/css/pos.css | 3 +++ addons/point_of_sale/static/src/js/pos_scrollbar_widget.js | 1 + 2 files changed, 4 insertions(+) diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css index 0b92dce6504..d90a12b22eb 100644 --- a/addons/point_of_sale/static/src/css/pos.css +++ b/addons/point_of_sale/static/src/css/pos.css @@ -522,6 +522,7 @@ position:relative; vertical-align: top; display: inline-block; + line-height: 100px; font-size: 11px; margin: 5px; width: 120px; @@ -548,6 +549,7 @@ right: 2px; vertical-align: top; color: white; + line-height: 14px; background: #7f82ac; padding: 2px 5px; border-radius: 3px; @@ -561,6 +563,7 @@ box-sizing: border-box; bottom:0; top:auto; + line-height: 14px; width:100%; background: -webkit-linear-gradient(-90deg,rgba(255,255,255,0),rgba(255,255,255,1), rgba(255,255,255,1)); background: -moz-linear-gradient(-90deg,rgba(255,255,255,0),rgba(255,255,255,1), rgba(255,255,255,1)); diff --git a/addons/point_of_sale/static/src/js/pos_scrollbar_widget.js b/addons/point_of_sale/static/src/js/pos_scrollbar_widget.js index d4f6903c435..7c765028231 100644 --- a/addons/point_of_sale/static/src/js/pos_scrollbar_widget.js +++ b/addons/point_of_sale/static/src/js/pos_scrollbar_widget.js @@ -65,6 +65,7 @@ function openerp_pos_scrollbar(instance, module){ //module is instance.point_of_ this.auto_hide(false); this.$element.bind('mousewheel',function(event,delta){ self.scroll(delta*self.wheel_step); + return false; }); this.$element.bind('click',function(event){ var vpos = event.pageY - self.$element.offset().top; From 1e00d4e9ec1c678f01ea53cb1e53a88b77b975b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Tue, 17 Jul 2012 18:25:17 +0200 Subject: [PATCH 009/165] [IMP] point_of_sale: made it easier to change the flux between screens bzr revid: fva@openerp.com-20120717162517-pjsq3x81zfw38siy --- .../static/src/js/pos_screens.js | 42 +++++++++++++------ .../static/src/js/pos_widgets.js | 10 +++-- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/addons/point_of_sale/static/src/js/pos_screens.js b/addons/point_of_sale/static/src/js/pos_screens.js index eeb45e8a27d..c89228dcc18 100644 --- a/addons/point_of_sale/static/src/js/pos_screens.js +++ b/addons/point_of_sale/static/src/js/pos_screens.js @@ -349,6 +349,9 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa module.ScaleInviteScreenWidget = module.ScreenWidget.extend({ template:'ScaleInviteScreenWidget', + next_screen:'scale', + previous_screen:'products', + show: function(){ this._super(); var self = this; @@ -359,7 +362,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa var weight = self.pos.proxy.weighting_read_kg(); if(weight > 0.001){ clearInterval(this.intervalID); - self.pos_widget.screen_selector.set_current_screen('scale'); + self.pos_widget.screen_selector.set_current_screen(self.next_screen); } },500); @@ -370,7 +373,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa click: function(){ clearInterval(this.intervalID); self.pos.proxy.weighting_end(); - self.pos_widget.screen_selector.set_current_screen('products'); + self.pos_widget.screen_selector.set_current_screen(self.previous_screen); } } ); @@ -383,6 +386,10 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa module.ScaleScreenWidget = module.ScreenWidget.extend({ template:'ScaleScreenWidget', + + next_screen: 'products', + previous_screen: 'products', + show: function(){ this._super(); this.renderElement(); @@ -392,7 +399,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa label: 'back', icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png', click: function(){ - self.pos_widget.screen_selector.set_current_screen('products'); + self.pos_widget.screen_selector.set_current_screen(self.previous_screen); } }); @@ -401,7 +408,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa icon: '/point_of_sale/static/src/img/icons/png48/validate.png', click: function(){ self.order_product(); - self.pos_widget.screen_selector.set_current_screen('products'); + self.pos_widget.screen_selector.set_current_screen(self.next_screen); }, }); @@ -419,7 +426,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this._super(); this.$('.product-picture').click(function(){ self.order_product(); - self.pos_widget.screen_selector.set_current_screen('products'); + self.pos_widget.screen_selector.set_current_screen(self.next_screen); }); }, get_product: function(){ @@ -458,6 +465,8 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa module.ClientPaymentScreenWidget = module.ScreenWidget.extend({ template:'ClientPaymentScreenWidget', + next_screen: 'welcome', + previous_screen: 'products', show: function(){ this._super(); var self = this; @@ -486,7 +495,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa self.pos.push_order(currentOrder.exportAsJSON()).then(function() { currentOrder.destroy(); self.pos.proxy.transaction_end(); - self.pos_widget.screen_selector.set_current_screen('welcome'); + self.pos_widget.screen_selector.set_current_screen(self.next_screen); }); }else if(payment === 'payment_rejected'){ clearInterval(this.intervalID); @@ -501,7 +510,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa click: function(){ //TODO Go to ask for weighting screen clearInterval(this.intervalID); self.pos.proxy.payment_canceled(); - self.pos_widget.screen_selector.set_current_screen('products'); + self.pos_widget.screen_selector.set_current_screen(self.previous_screen); } } ); @@ -515,12 +524,14 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa module.WelcomeScreenWidget = module.ScreenWidget.extend({ template:'WelcomeScreenWidget', + next_screen: 'products', + show_numpad: false, show_leftpane: false, barcode_client_action: function(ean){ this._super(ean); - this.pos_widget.screen_selector.set_current_screen('products'); + this.pos_widget.screen_selector.set_current_screen(self.next_screen); }, show: function(){ @@ -532,6 +543,9 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa module.ProductScreenWidget = module.ScreenWidget.extend({ template:'ProductScreenWidget', + scale_screen: 'scale_invite', + client_next_screen: 'client_payment', + show_numpad: true, show_leftpane: true, @@ -543,7 +557,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this.product_list_widget = new module.ProductListWidget(this,{ click_product_action: function(product){ if(product.get('to_weight') && self.pos.use_scale){ - self.pos_widget.screen_selector.set_current_screen('scale_invite', {product: product}); + self.pos_widget.screen_selector.set_current_screen(self.scale_screen, {product: product}); }else{ self.pos.get('selectedOrder').addProduct(product); } @@ -568,7 +582,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa label: 'pay', icon: '/point_of_sale/static/src/img/icons/png48/go-next.png', click: function(){ - self.pos_widget.screen_selector.set_current_screen('client_payment'); + self.pos_widget.screen_selector.set_current_screen(self.client_next_screen); } }); } @@ -643,6 +657,8 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa module.PaymentScreenWidget = module.ScreenWidget.extend({ template: 'PaymentScreenWidget', + back_screen: 'products', + next_screen: 'receipt', init: function(parent, options) { this._super(parent,options); this.model = options.model; @@ -664,7 +680,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa label: 'Back', icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png', click: function(){ - self.pos_widget.screen_selector.set_current_screen('products'); + self.pos_widget.screen_selector.set_current_screen(self.back_screen); }, }); @@ -682,7 +698,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this.pos_widget.payment_screen.set_numpad_state(null); }, back: function() { - this.pos_widget.screen_selector.set_current_screen('products'); + this.pos_widget.screen_selector.set_current_screen(self.back_screen); }, validateCurrentOrder: function() { var self = this; @@ -697,7 +713,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa self.pos.proxy.print_receipt(currentOrder.export_for_printing()); self.pos.get('selectedOrder').destroy(); //finish order and go back to scan screen }else{ - self.pos_widget.screen_selector.set_current_screen('receipt'); + self.pos_widget.screen_selector.set_current_screen(self.next_screen); } }); }, diff --git a/addons/point_of_sale/static/src/js/pos_widgets.js b/addons/point_of_sale/static/src/js/pos_widgets.js index b20bee712ee..0ee8cbf519d 100644 --- a/addons/point_of_sale/static/src/js/pos_widgets.js +++ b/addons/point_of_sale/static/src/js/pos_widgets.js @@ -676,6 +676,10 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa self.build_widgets(); + self.screen_selector.set_default_screen(); + + self.pos.barcode_reader.connect(); + instance.webclient.set_content_full_screen(true); if (!self.pos.get('pos_session')) { @@ -700,6 +704,9 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa }); }, + + // This method instantiates all the screens, widgets, etc. If you want to add new screens change the + // startup screen, etc, override this method. build_widgets: function() { // -------- Screens --------- @@ -788,9 +795,6 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa default_mode: this.pos.use_selfcheckout ? 'client' : 'cashier', }); - this.screen_selector.set_default_screen(); - - this.pos.barcode_reader.connect(); }, //FIXME this method is probably not at the right place ... From 3577764184ebe2c6f34e59c8e781f4455882a1a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Tue, 17 Jul 2012 18:26:09 +0200 Subject: [PATCH 010/165] [FIX] point_of_sale: removed auto-installation of the module bzr revid: fva@openerp.com-20120717162609-sj48xe8u8k52v4j2 --- addons/point_of_sale/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/__openerp__.py b/addons/point_of_sale/__openerp__.py index 5e7e5578f72..4c0bb14cc10 100644 --- a/addons/point_of_sale/__openerp__.py +++ b/addons/point_of_sale/__openerp__.py @@ -99,6 +99,6 @@ Main features : 'static/src/css/keyboard.css' ], 'qweb': ['static/src/xml/pos.xml'], - 'auto_install': True, + 'auto_install': False, } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From c94104586517da23fec98b8b50f93fb1ab30556c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Wed, 18 Jul 2012 11:29:54 +0200 Subject: [PATCH 011/165] [IMP] point_of_sale: very very subtle css improvement bzr revid: fva@openerp.com-20120718092954-ww84yaxh1p2cyf1b --- addons/point_of_sale/static/src/css/pos.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css index d90a12b22eb..4ec88e02185 100644 --- a/addons/point_of_sale/static/src/css/pos.css +++ b/addons/point_of_sale/static/src/css/pos.css @@ -530,9 +530,9 @@ background:#fff; border: 1px solid #fff; border-radius: 3px; - -webkit-box-shadow: 0px 1px 8px rgba(0,0,0,0.2); - -moz-box-shadow: 0px 1px 8px rgba(0,0,0,0.2); - box-shadow: 0px 1px 8px rgba(0,0,0,0.2); + -webkit-box-shadow: 0px 1px 8px rgba(127,130,172,0.4); + -moz-box-shadow: 0px 1px 8px rgba(127,130,172,0.4); + box-shadow: 0px 1px 8px rgba(127,130,172,0.4); } .point-of-sale .product .product-img { From 6df84daaee48ea46ace902aee121c26aa1b243f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Thu, 19 Jul 2012 17:25:19 +0200 Subject: [PATCH 012/165] [IMP] point_of_sale: removed action bar bzr revid: fva@openerp.com-20120719152519-l6gbweu58fk54ga3 --- addons/point_of_sale/static/src/css/pos.css | 41 +++++++-- .../static/src/js/pos_screens.js | 84 ++++++++++++------ .../static/src/js/pos_widgets.js | 86 ++++++++++++++----- addons/point_of_sale/static/src/xml/pos.xml | 31 ++----- 4 files changed, 163 insertions(+), 79 deletions(-) diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css index 4ec88e02185..b03633e181c 100644 --- a/addons/point_of_sale/static/src/css/pos.css +++ b/addons/point_of_sale/static/src/css/pos.css @@ -156,11 +156,11 @@ } .point-of-sale #rightheader button { - color: black; - height:29px; - margin:2px; + color: #273072; + height:27px; + margin:3px; margin-right:0px; - border: 1px solid black; + border: 1px solid #353A7E; background: #7f82ac; background: -webkit-gradient(linear, left top, left bottom, from(#b2b3d7), to(#7f82ac)); background: -moz-linear-gradient(#b2b3d7, #7f82ac); @@ -187,6 +187,33 @@ font-weight: 900; } +/* c) The session buttons */ + +.point-of-sale #rightheader .header-button{ + float:right; + height:32px; + padding-left:10px; + padding-right:10px; + border-right: 1px solid #3a3a3a; + border-left: 1px solid #3a3a3a; + color:#DDD; + line-height:32px; + text-align:center; + cursor: pointer; + + -webkit-transition-property: background; + -webkit-transition-duration: 0.2s; + -webkit-transition-timing-function: ease-out; +} +.point-of-sale #rightheader .header-button:last-child{ + border-left: 1px solid #3a3a3a; +} +.point-of-sale #rightheader .header-button:hover{ + background: rgba(0,0,0,0.2); + text-shadow: #000 0px 0px 3px; + color:#EEE; +} + /* c) The notifications indicator */ .point-of-sale .oe_pos_synch-notification{ @@ -234,7 +261,8 @@ left:0; width:440px; top:0px; - bottom:105px; + /*bottom:105px;*/ + bottom:0; border-right: solid 1px #CECBCB; background-color: white; } @@ -318,7 +346,8 @@ .point-of-sale #rightpane { position: absolute; top: 0; - bottom: 105px; + /*bottom: 105px;*/ + bottom:0; left: 440px; right: 0; vertical-align: top; diff --git a/addons/point_of_sale/static/src/js/pos_screens.js b/addons/point_of_sale/static/src/js/pos_screens.js index c89228dcc18..93e25ab21dc 100644 --- a/addons/point_of_sale/static/src/js/pos_screens.js +++ b/addons/point_of_sale/static/src/js/pos_screens.js @@ -152,14 +152,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this.pos_widget.screen_selector.show_popup('help'); }, - logout_button_action: function(){ - this.pos_widget.screen_selector.set_user_mode('client'); - }, - - close_button_action: function(){ - this.pos_widget.try_close(); - }, - barcode_product_screen: 'products', //if defined, this screen will be loaded when a product is scanned barcode_product_error_popup: 'error', //if defined, this popup will be loaded when there's an error in the popup @@ -223,6 +215,29 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa } }, + // shows an action bar on the screen. The actionbar is automatically shown when you add a button + // with add_action_button() + show_action_bar: function(){ + this.pos_widget.action_bar.show(); + this.$element.css({'bottom':'105px'}); + }, + + // hides the action bar. The actionbar is automatically hidden when it is empty + hide_action_bar: function(){ + this.pos_widget.action_bar.hide(); + this.$element.css({'bottom':'0px'}); + }, + + // adds a new button to the action bar. The button definition takes three parameters, all optional : + // - label: the text below the button + // - icon: a small icon that will be shown + // - click: a callback that will be executed when the button is clicked. + // the method returns a reference to the button widget, and automatically show the actionbar. + add_action_button: function(button_def){ + this.show_action_bar(); + return this.pos_widget.action_bar.add_new_button(button_def); + }, + // this method shows the screen and sets up all the widget related to this screen. Extend this method // if you want to alter the behavior of the screen. show: function(){ @@ -231,15 +246,30 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this.$element.show(); } + if(this.pos_widget.action_bar.get_button_count() > 0){ + this.show_action_bar(); + }else{ + this.hide_action_bar(); + } + var self = this; var cashier_mode = this.pos_widget.screen_selector.get_user_mode() === 'cashier'; this.pos_widget.set_numpad_visible(this.show_numpad && cashier_mode); this.pos_widget.set_leftpane_visible(this.show_leftpane); this.pos_widget.set_cashier_controls_visible(cashier_mode); - this.pos_widget.action_bar.set_element_visible('help-button', !cashier_mode, function(){ self.help_button_action(); }); - this.pos_widget.action_bar.set_element_visible('logout-button', cashier_mode && this.pos.use_selfcheckout, function(){ self.logout_button_action(); }); - this.pos_widget.action_bar.set_element_visible('close-button', cashier_mode, function(){ self.close_button_action(); }); + /*this.pos_widget.action_bar.set_element_visible('help-button', !cashier_mode, function(){ self.help_button_action(); });*/ + + if(cashier_mode && this.pos.use_selfcheckout){ + this.pos_widget.client_button.show(); + }else{ + this.pos_widget.client_button.hide(); + } + if(cashier_mode){ + this.pos_widget.close_button.show(); + }else{ + this.pos_widget.close_button.hide(); + } this.pos_widget.username.set_user_mode(this.pos_widget.screen_selector.get_user_mode()); @@ -251,7 +281,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa }); }, - // this method is called when the screen is closed to make place for a new screen. this is a good place // to put your cleanup stuff as it is guaranteed that for each show() there is one and only one close() close: function(){ @@ -366,8 +395,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa } },500); - this.pos_widget.action_bar.add_new_button( - { + this.add_action_button({ label: 'back', icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png', click: function(){ @@ -375,8 +403,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa self.pos.proxy.weighting_end(); self.pos_widget.screen_selector.set_current_screen(self.previous_screen); } - } - ); + }); }, close: function(){ this._super(); @@ -395,7 +422,8 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this.renderElement(); var self = this; - this.pos_widget.action_bar.add_new_button({ + + this.add_action_button({ label: 'back', icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png', click: function(){ @@ -403,7 +431,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa } }); - this.validate_button = this.pos_widget.action_bar.add_new_button({ + this.validate_button = this.add_action_button({ label: 'Validate', icon: '/point_of_sale/static/src/img/icons/png48/validate.png', click: function(){ @@ -465,8 +493,10 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa module.ClientPaymentScreenWidget = module.ScreenWidget.extend({ template:'ClientPaymentScreenWidget', + next_screen: 'welcome', previous_screen: 'products', + show: function(){ this._super(); var self = this; @@ -503,17 +533,15 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa } },500); - this.pos_widget.action_bar.add_new_button( - { + this.add_action_button({ label: 'back', icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png', - click: function(){ //TODO Go to ask for weighting screen + click: function(){ clearInterval(this.intervalID); self.pos.proxy.payment_canceled(); self.pos_widget.screen_selector.set_current_screen(self.previous_screen); } - } - ); + }); }, close: function(){ this._super(); @@ -578,7 +606,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa } if(this.pos_widget.screen_selector.current_mode === 'client'){ - this.pos_widget.action_bar.add_new_button({ + this.add_action_button({ label: 'pay', icon: '/point_of_sale/static/src/img/icons/png48/go-next.png', click: function(){ @@ -618,13 +646,13 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this._super(); var self = this; - this.pos_widget.action_bar.add_new_button({ + this.add_action_button({ label: 'Print', icon: '/point_of_sale/static/src/img/icons/png48/printer.png', click: function(){ self.print(); }, }); - this.pos_widget.action_bar.add_new_button({ + this.add_action_button({ label: 'Next Order', icon: '/point_of_sale/static/src/img/icons/png48/go-next.png', click: function() { self.finishOrder(); }, @@ -676,7 +704,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this.set_numpad_state(this.pos_widget.numpad.state); - this.back_button = this.pos_widget.action_bar.add_new_button({ + this.back_button = this.add_action_button({ label: 'Back', icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png', click: function(){ @@ -684,7 +712,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa }, }); - this.validate_button = this.pos_widget.action_bar.add_new_button({ + this.validate_button = this.add_action_button({ label: 'Validate', icon: '/point_of_sale/static/src/img/icons/png48/validate.png', click: function(){ diff --git a/addons/point_of_sale/static/src/js/pos_widgets.js b/addons/point_of_sale/static/src/js/pos_widgets.js index 0ee8cbf519d..a8948437f2c 100644 --- a/addons/point_of_sale/static/src/js/pos_widgets.js +++ b/addons/point_of_sale/static/src/js/pos_widgets.js @@ -112,7 +112,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa template:'OrderWidget', init: function(parent, options) { this._super(parent,options); - this.compact = false; + this.compact = options.compact !== undefined ? options.compact : true; this.set_numpad_state(options.numpadState); this.pos.bind('change:selectedOrder', this.change_selected_order, this); this.bind_orderline_events(); @@ -166,6 +166,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa this._super(); if(!this.compact){ + console.log('not compact'); $('.point-of-sale .order-container').css({'bottom':'0px'}); } @@ -212,6 +213,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa this.$('.summary .value.total').html(this.format_currency(total)); }, set_compact: function(compact){ + console.log('set_compact',compact); if(this.compact !== compact){ this.compact = compact; this.renderElement(); @@ -313,6 +315,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa module.ActionButtonWidget = instance.web.Widget.extend({ template:'ActionButtonWidget', + icon_template:'ActionButtonWidgetWithIcon', init: function(parent, options){ this._super(parent, options); this.label = options.label || 'button'; @@ -320,7 +323,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa this.click_action = options.click; if(options.icon){ this.icon = options.icon; - this.template = 'ActionButtonWidgetWithIcon'; + this.template = this.icon_template; } }, renderElement: function(){ @@ -359,18 +362,20 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa this.button_list = []; return this; }, + get_button_count: function(){ + return this.button_list.length; + }, add_new_button: function(button_options){ - if(arguments.length == 1){ - var button = new module.ActionButtonWidget(this,button_options); - this.button_list.push(button); - button.appendTo($('.pos-actionbar-button-list')); - return button; - }else{ - for(var i = 0; i < arguments.length; i++){ - this.add_new_button(arguments[i]); - } - } - return undefined; + var button = new module.ActionButtonWidget(this,button_options); + this.button_list.push(button); + button.appendTo($('.pos-actionbar-button-list')); + return button; + }, + show:function(){ + this.$element.show(); + }, + hide:function(){ + this.$element.hide(); }, }); @@ -419,14 +424,10 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa this._super(); var hasimages = false; //if none of the subcategories have images, we don't display buttons with icons - console.log('barfoo'); - _.each(this.subcategories, function(category){ if(category.category_image_small){ - console.log("Image:",category.category_image_small); hasimages = true; }else{ - console.log('NoImage:',category.category_image_small); } }); @@ -603,14 +604,35 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa }, }); + module.HeaderButtonWidget = module.PosBaseWidget.extend({ + template: 'HeaderButtonWidget', + init: function(parent, options){ + options = options || {}; + this._super(parent, options); + this.action = options.action; + this.label = options.label; + }, + renderElement: function(){ + var self = this; + this._super(); + if(this.action){ + this.$element.click(function(){ self.action(); }); + } + }, + show: function(){ this.$element.show(); }, + hide: function(){ this.$element.hide(); }, + + }); + + // ---------- Main Point of Sale Widget ---------- // this is used to notify the user that data is being synchronized on the network module.SynchNotificationWidget = module.PosBaseWidget.extend({ template: "SynchNotificationWidget", - init: function(parent,options) { + init: function(parent, options){ options = options || {}; - this._super(parent,options); + this._super(parent, options); }, renderElement: function() { var self = this; @@ -652,6 +674,14 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa this.leftpane_visible = true; this.leftpane_width = '440px'; this.cashier_controls_visible = true; + var degree = 0; + /* + //Epileptic mode + setInterval(function(){ + $('body').css({'-webkit-filter':'sepia('+Math.round(Math.random())+') hue-rotate('+Math.random()*360+'deg) blur('+Math.random()*5+'px)' }); + },100); + */ + }, start: function() { @@ -708,6 +738,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa // This method instantiates all the screens, widgets, etc. If you want to add new screens change the // startup screen, etc, override this method. build_widgets: function() { + var self = this; // -------- Screens --------- @@ -749,13 +780,13 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa // -------- Misc --------- this.notification = new module.SynchNotificationWidget(this,{}); - this.notification.replace(this.$('.placeholder-SynchNotificationWidget')); + this.notification.appendTo(this.$('#rightheader')); this.username = new module.UsernameWidget(this,{}); this.username.replace(this.$('.placeholder-UsernameWidget')); this.action_bar = new module.ActionBarWidget(this); - this.action_bar.appendTo($(".point-of-sale #content")); + this.action_bar.appendTo($(".point-of-sale #rightpane")); this.paypad = new module.PaypadWidget(this, {}); this.paypad.replace($('#placeholder-PaypadWidget')); @@ -770,6 +801,19 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa 'keyboard_model': 'simple' }); this.onscreen_keyboard.appendTo($(".point-of-sale #content")); + + this.close_button = new module.HeaderButtonWidget(this,{ + label:'Close', + action: function(){ self.try_close(); }, + }); + this.close_button.appendTo(this.$('#rightheader')); + + this.client_button = new module.HeaderButtonWidget(this,{ + label:'Self-Checkout', + action: function(){ self.screen_selector.set_user_mode('client'); }, + }); + this.client_button.appendTo(this.$('#rightheader')); + // -------- Screen Selector --------- diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index 441189dae24..b690f6ebe6b 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -15,7 +15,7 @@
    - +
    @@ -44,6 +44,12 @@
    + +
    + +
    +
    +
    There are pending operations that could not be saved into the database, are you sure you want to exit?
    @@ -531,30 +537,7 @@
    -
    -
    -
    - -
    Help
    -
    -
    -
    -
    - -
    Close
    -
    -
    -
    -
    - -
    Client Mode
    -
    -
    -
      -
    From 7a1cee1401bf7c5ea97981a69b4f25a0601ba1bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Fri, 20 Jul 2012 17:24:21 +0200 Subject: [PATCH 013/165] [IMP] point_of_sale: refactored the ean checksum method bzr revid: fva@openerp.com-20120720152421-lfq05r6xkczl1y56 --- addons/product/product.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/addons/product/product.py b/addons/product/product.py index 3cbff880cf9..c50ad3c27b9 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -30,15 +30,10 @@ from tools.translate import _ def is_pair(x): return not x%2 -def check_ean(eancode): - if not eancode: - return True +def ean_checksum(eancode): + """returns the checksum of an ean string of length 13, returns -1 if the string has the wrong length""" if len(eancode) <> 13: - return False - try: - int(eancode) - except: - return False + return -1 oddsum=0 evensum=0 total=0 @@ -54,10 +49,20 @@ def check_ean(eancode): total=(oddsum * 3) + evensum check = int(10 - math.ceil(total % 10.0)) %10 + return check - if check != int(eancode[-1]): +def check_ean(eancode): + """returns True if eancode is a valid ean13 string, or null""" + if not eancode: + return True + if len(eancode) <> 13: return False - return True + try: + int(eancode) + except: + return False + return ean_checksum(eancode) == int(eancode[-1]) + #---------------------------------------------------------- # UOM #---------------------------------------------------------- From f1fbf44b5c9ae1275c9fb9e6a5c1ef8e337742a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Fri, 20 Jul 2012 19:00:12 +0200 Subject: [PATCH 014/165] [WIP] point_of_sale: barcode validation wizard (wip) bzr revid: fva@openerp.com-20120720170012-eqp81clbpbfsr3hl --- addons/point_of_sale/point_of_sale.py | 38 ++++++++++++------ addons/point_of_sale/point_of_sale_view.xml | 44 +++++++++++++++------ addons/product/product.py | 13 ++++++ 3 files changed, 70 insertions(+), 25 deletions(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index ed3fa9c1730..d86d4c3d8ad 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -22,6 +22,7 @@ import pdb import io import openerp import addons +import openerp.addons.product.product import time from datetime import datetime @@ -143,8 +144,6 @@ class pos_config(osv.osv): obj.sequence_id.unlink() return super(pos_config, self).unlink(cr, uid, ids, context=context) -pos_config() - class pos_session(osv.osv): _name = 'pos.session' _order = 'id desc' @@ -425,8 +424,6 @@ class pos_session(osv.osv): 'context' : context, } -pos_session() - class pos_order(osv.osv): _name = "pos.order" _description = "Point of Sale" @@ -1038,8 +1035,6 @@ class pos_order(osv.osv): self.create_account_move(cr, uid, ids, context=context) return True -pos_order() - class account_bank_statement(osv.osv): _inherit = 'account.bank.statement' _columns= { @@ -1138,8 +1133,6 @@ class pos_order_line(osv.osv): }) return super(pos_order_line, self).copy_data(cr, uid, id, default, context=context) -pos_order_line() - class pos_category(osv.osv): _name = 'pos.category' _description = "Point of Sale Category" @@ -1211,12 +1204,24 @@ class pos_category(osv.osv): # 'category_image': _get_default_image, #} -pos_category() - import io, StringIO +class ean_wizard(osv.osv_memory): + _name = 'pos.ean_wizard' + _columns = { + 'ean13_pattern': fields.char('Ean13 Pattern', size=32, required=True, translate=True), + } + def sanitize_ean13(self, cr, uid, ids, context): + for r in self.browse(cr,uid,ids): + ean13 = openerp.addons.product.product.sanitize_ean13(r.ean13_pattern) + m = context.get('active_model') + m_id = context.get('active_id') + self.pool.get(m).write(cr,uid,[m_id],{'ean13':ean13}) + class product_product(osv.osv): _inherit = 'product.product' + + def _get_small_image(self, cr, uid, ids, prop, unknow_none, context=None): result = {} for obj in self.browse(cr, uid, ids, context=context): @@ -1247,7 +1252,16 @@ class product_product(osv.osv): 'to_weight' : False, } -product_product() - + def add_ean13(self, cr, uid, ids, context): + return { + 'name': _('Return Products'), + 'type': 'ir.actions.act_window', + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'pos.ean_wizard', + 'target' : 'new', + 'view_id': False, + 'context':context, + } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml index f3b491116b7..1145189b408 100644 --- a/addons/point_of_sale/point_of_sale_view.xml +++ b/addons/point_of_sale/point_of_sale_view.xml @@ -618,12 +618,22 @@ form - - - - - - + + + + + + + + + + + + + + +