Bhumi Thakkar (Open ERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.1-opw-577870-bth into
lp:openobject-addons/6.1.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-577870-bth/+merge/119329
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.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-577870-bth/+merge/119329
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.1-opw-577870-bth.
=== modified file 'point_of_sale/static/src/js/pos.js'
--- point_of_sale/static/src/js/pos.js 2012-05-05 16:09:02 +0000
+++ point_of_sale/static/src/js/pos.js 2012-08-13 11:15:26 +0000
@@ -30,7 +30,7 @@
get: function(key, _default) {
if (this.data[key] === undefined) {
var stored = localStorage['oe_pos_' + key];
- if (stored)
+ if (stored != "undefined")
this.data[key] = JSON.parse(stored);
else
return _default;
@@ -89,17 +89,20 @@
get_app_data: function() {
var self = this;
return $.when(new db.web.Model("sale.shop").get_func("search_read")([]).pipe(function(result) {
- self.set({'shop': result[0]});
- var company_id = result[0]['company_id'][0];
- return new db.web.Model("res.company").get_func("read")(company_id, ['currency_id', 'name', 'phone']).pipe(function(result) {
- self.set({'company': result});
- var currency_id = result['currency_id'][0]
- return new db.web.Model("res.currency").get_func("read")([currency_id],
+ if (result.length) {
+ self.set({'shop': result[0]});
+ var company_id = result[0]['company_id'][0];
+
+ return new db.web.Model("res.company").get_func("read")(company_id, ['currency_id', 'name', 'phone']).pipe(function(result) {
+ self.set({'company': result});
+ var currency_id = result['currency_id'][0]
+ return new db.web.Model("res.currency").get_func("read")([currency_id],
['symbol', 'position']).pipe(function(result) {
- self.set({'currency': result[0]});
-
+ self.set({'currency': result[0]});
+
+ });
});
- });
+ }
}), new db.web.Model("res.users").get_func("read")(this.session.uid, ['name']).pipe(function(result) {
self.set({'user': result});
}));
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp