Merge lp:~openerp-dev/openobject-addons/6.1-opw-577870-bth into lp:openobject-addons/6.1

Proposed by Bhumi Thakkar (Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-577870-bth
Merge into: lp:openobject-addons/6.1
Diff against target: 42 lines (+13/-10)
1 file modified
point_of_sale/static/src/js/pos.js (+13/-10)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-577870-bth
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+119329@code.launchpad.net

Description of the change

Hello,

  In POS error coming 'result[0] is undefined' or 'unexpected token u' or 'JSON.parse: unexpected character'.

1. Settings => Users => Users => Multi companies is enabled.
2. Settings => Comapnies => Comapnies. one company is created.
3. Few products are added from Products and Select that created company in procurement & locations tab and Select pos category from information tab.
4. Create one user and select created company, give pos access rights, in allowed companies tab select created company.
5. I login to Pos user and click on Point of Sales

Observed: "JSON.parse: unexpected character " . sometimes the error
changes on next login to "syntax error : unexpected character token
u " . or "key pos.ui not found ."
Expected: Open POS Successfully with products.

In get_app_data method rsult[0] is used but result get [].
In Store, get method stored get undefined value and going to be parsed with json so got error.
put if condition for undefined value befpre going to parsed.

Thanks.

To post a comment you must log in.
6945. By Bhumi Thakkar (Open ERP)

[MERGE] Merge main addons branch.

6946. By Bhumi Thakkar (Open ERP)

[IMP] Modify condition.

Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Hello,

This bug was qualified as Not Relevant on Trunk (means that architecture on trunk has changed and so this bug has no meaning anymore). If this Merge Proposal could not be merged in v6.1 at the release of v7.0, it will be closed.

Thanks,
Naresh Soni

Unmerged revisions

6946. By Bhumi Thakkar (Open ERP)

[IMP] Modify condition.

6945. By Bhumi Thakkar (Open ERP)

[MERGE] Merge main addons branch.

6944. By Bhumi Thakkar (Open ERP)

[FIX] put condition for records length in POS.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'point_of_sale/static/src/js/pos.js'
2--- point_of_sale/static/src/js/pos.js 2012-05-05 16:09:02 +0000
3+++ point_of_sale/static/src/js/pos.js 2012-10-10 10:01:23 +0000
4@@ -30,7 +30,7 @@
5 get: function(key, _default) {
6 if (this.data[key] === undefined) {
7 var stored = localStorage['oe_pos_' + key];
8- if (stored)
9+ if (stored != undefined && stored != "undefined")
10 this.data[key] = JSON.parse(stored);
11 else
12 return _default;
13@@ -89,17 +89,20 @@
14 get_app_data: function() {
15 var self = this;
16 return $.when(new db.web.Model("sale.shop").get_func("search_read")([]).pipe(function(result) {
17- self.set({'shop': result[0]});
18- var company_id = result[0]['company_id'][0];
19- return new db.web.Model("res.company").get_func("read")(company_id, ['currency_id', 'name', 'phone']).pipe(function(result) {
20- self.set({'company': result});
21- var currency_id = result['currency_id'][0]
22- return new db.web.Model("res.currency").get_func("read")([currency_id],
23+ if (result.length) {
24+ self.set({'shop': result[0]});
25+ var company_id = result[0]['company_id'][0];
26+
27+ return new db.web.Model("res.company").get_func("read")(company_id, ['currency_id', 'name', 'phone']).pipe(function(result) {
28+ self.set({'company': result});
29+ var currency_id = result['currency_id'][0]
30+ return new db.web.Model("res.currency").get_func("read")([currency_id],
31 ['symbol', 'position']).pipe(function(result) {
32- self.set({'currency': result[0]});
33-
34+ self.set({'currency': result[0]});
35+
36+ });
37 });
38- });
39+ }
40 }), new db.web.Model("res.users").get_func("read")(this.session.uid, ['name']).pipe(function(result) {
41 self.set({'user': result});
42 }));