Merge lp:~guerrerocarlos/openobject-addons/point_of_sale_6.1_barcode__merge into lp:openobject-addons/6.1

Proposed by Carlos Guerrero
Status: Needs review
Proposed branch: lp:~guerrerocarlos/openobject-addons/point_of_sale_6.1_barcode__merge
Merge into: lp:openobject-addons/6.1
Diff against target: 44 lines (+13/-5)
1 file modified
point_of_sale/static/src/js/pos.js (+13/-5)
To merge this branch: bzr merge lp:~guerrerocarlos/openobject-addons/point_of_sale_6.1_barcode__merge
Reviewer Review Type Date Requested Status
Olivier Dony (Odoo) Abstain
Selami Demir (community) Approve
Roberto López López (community) Approve
Nhomar - Vauxoo (community) Approve
Antony Lesuisse (OpenERP) Pending
Review via email: mp+99129@code.launchpad.net

Description of the change

Solves 'OpenERP 6.1 POS: lookup by barcode (EAN13 or Reference)'[1] bug.

* [FIX] point_of_sale: Added product search by EAN13 or Reference in the POS

[1] https://bugs.launchpad.net/openobject-addons/+bug/949664

To post a comment you must log in.
Revision history for this message
Cristian Salamea (ovnicraft) wrote :

Hello thanks for fix it, so i have a question, is possible get on if for both evaluations ?

Regards,

Revision history for this message
Carlos Guerrero (guerrerocarlos) wrote :

Yes but then another if would be needed for selecting the right field
to apply the "toLowerCase" and "indexOf(s)", so I think that with two
separated "if" like it is right now, is the most efficient.

On Fri, Mar 23, 2012 at 4:27 PM, Cristian Salamea (Gnuthink)
<email address hidden> wrote:
> Hello thanks for fix it, so i have a question, is possible get on if for both evaluations ?
>
> Regards,
> --
> https://code.launchpad.net/~guerrerocarlos/openobject-addons/point_of_sale_6.1_barcode__merge/+merge/99129
> You are the owner of lp:~guerrerocarlos/openobject-addons/point_of_sale_6.1_barcode__merge.

--
Atte:
Carlos A. Guerrero M.
http://www.carlosguerrero.com

6703. By Carlos Guerrero

[FIX] Validation for searching of all three fields: "name", "ean13" and "code"

6704. By Carlos Guerrero

[IMP] point_of_sale: lookup by barcode in the same if

Revision history for this message
Carlos Guerrero (guerrerocarlos) wrote :

Now all the evaluations are in one same "if" as requested and has been proved to work as well.

6705. By Carlos Guerrero

[FIX] point_of_sale: Add product to order automatically with <Enter> from barcode reader

Revision history for this message
Carlos Guerrero (guerrerocarlos) wrote :

New improvement to the code, now the "if" has been removed at all, and the product is automatically added to the order when using a bar code reader.

6706. By Carlos Guerrero

[IMP] point_of_sale: Automatically clear the search box after <Enter> from bar code reader

Revision history for this message
Nhomar - Vauxoo (nhomar) wrote :

Hello.

Please core team, can you merge this improvement please.

Regards.

review: Approve
Revision history for this message
Roberto López López (bergensk) :
review: Approve
Revision history for this message
Selami Demir (sdemir) wrote :

Hi,

It is work now.

Thank you.

review: Approve
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Hello Carlos,

Well done, your change looks clean and simple enough to me. However I'm not an expert in 6.1 web modules, so I'm not sure if this is the best way to handle the <ENTER> event to autoselect a product.
I'll request a second review by someone from the web team.

Thanks for your good contribution!

review: Abstain
Revision history for this message
Antony Lesuisse (OpenERP) (al-openerp) wrote :

Could you rebase your patch on the latest 6.1 ?

Revision history for this message
Carlos Guerrero (guerrerocarlos) wrote :

There seems to be a merge in
http://bazaar.launchpad.net/~openerp/openobject-addons/6.1/revision/6726

But it is a very different amount of code, and doesn't include the "Reference" product field, but seems to be trying to solve the same issue.

Could someone enlight me about this?

Where can I see the "discussion" of that other [MERGE] ?

Revision history for this message
Lluis Gili Belmonte (tictacbum) wrote :

Hi, I am working on same issue, there's any update about this?
I tried applying Carlos patch, but sometimes OpenERP can't find products, and I have to close and reopen PoS to make it work.

Sometimes it also shows a warning message repeated several times (overlapped):

"Warningclose
The product could not be recognized. Please contact an employee."

Unmerged revisions

6706. By Carlos Guerrero

[IMP] point_of_sale: Automatically clear the search box after <Enter> from bar code reader

6705. By Carlos Guerrero

[FIX] point_of_sale: Add product to order automatically with <Enter> from barcode reader

6704. By Carlos Guerrero

[IMP] point_of_sale: lookup by barcode in the same if

6703. By Carlos Guerrero

[FIX] Validation for searching of all three fields: "name", "ean13" and "code"

6702. By Carlos Guerrero

[FIX] point_of_sale: Added product search by EAN13 or Reference in the POS

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'point_of_sale/static/src/js/pos.js'
--- point_of_sale/static/src/js/pos.js 2012-02-24 14:49:39 +0000
+++ point_of_sale/static/src/js/pos.js 2012-03-24 22:24:18 +0000
@@ -85,7 +85,7 @@
85 }, this));85 }, this));
86 }, this));86 }, this));
87 $.when(this.fetch('pos.category', ['name', 'parent_id', 'child_id']),87 $.when(this.fetch('pos.category', ['name', 'parent_id', 'child_id']),
88 this.fetch('product.product', ['name', 'list_price', 'pos_categ_id', 'taxes_id', 'product_image_small'], [['pos_categ_id', '!=', 'false']]),88 this.fetch('product.product', ['name','code','ean13', 'list_price', 'pos_categ_id', 'taxes_id', 'product_image_small'], [['pos_categ_id', '!=', 'false']]),
89 this.fetch('account.bank.statement', ['account_id', 'currency', 'journal_id', 'state', 'name'],89 this.fetch('account.bank.statement', ['account_id', 'currency', 'journal_id', 'state', 'name'],
90 [['state', '=', 'open'], ['user_id', '=', this.session.uid]]),90 [['state', '=', 'open'], ['user_id', '=', this.session.uid]]),
91 this.fetch('account.journal', ['auto_cash', 'check_dtls', 'currency', 'name', 'type']),91 this.fetch('account.journal', ['auto_cash', 'check_dtls', 'currency', 'name', 'type']),
@@ -1259,19 +1259,27 @@
1259 });1259 });
1260 (this.shop.get('products')).reset(products);1260 (this.shop.get('products')).reset(products);
1261 var self = this;1261 var self = this;
1262 $('.searchbox input').keyup(function() {1262 $('.searchbox input').keyup(function(event) {
1263 var m, s;1263 var m, s, myproduct;
1264 s = $(this).val().toLowerCase();1264 s = $(this).val().toLowerCase();
1265 if (s) {1265 if (s) {
1266 m = products.filter( function(p) {1266 m = products.filter( function(p) {
1267 return p.name.toLowerCase().indexOf(s) != -1;1267 return (String(p.code).toLowerCase().indexOf(s) != -1) || (String(p.ean13).toLowerCase().indexOf(s) != -1) || (p.name.toLowerCase().indexOf(s) != -1);
1268 });1268 });
1269 $('.search-clear').fadeIn();1269 $('.search-clear').fadeIn();
1270 } else {1270 } else {
1271 m = products;1271 m = products;
1272 $('.search-clear').fadeOut();1272 $('.search-clear').fadeOut();
1273 }1273 }
1274 return (self.shop.get('products')).reset(m);1274 if (m.length == 1 && event.keyCode == 13) {
1275 myproduct = self.shop.get('products').get(m[0]);
1276 self.shop.get('selectedOrder').addProduct(myproduct);
1277 $(this).val('');
1278 m = products;
1279 }
1280 return (self.shop.get('products')).reset(m);
1281
1282
1275 });1283 });
1276 return $('.search-clear').click( function() {1284 return $('.search-clear').click( function() {
1277 (this.shop.get('products')).reset(products);1285 (this.shop.get('products')).reset(products);