Dear all,
I am using Odoo 12 Point of Sale, and have found on several modules, references to "at least" 3 methods.
For instance:
var _super_orderline = models.Orderline.prototype;
models.Orderline = models.Orderline.extend
({ initialize: function(attr, options)
{ _super_orderline.initialize.call(this,attr,options);
this.product_variants = this.product_variants || [];
},
init_from_JSON: function(json)
{ _super_orderline.init_from_JSON.apply(this,arguments);
this.product_variants = json.product_variants || [];
},
export_as_JSON: function ()
{ var json = _super_orderline.export_as_JSON.apply(this, arguments);
json.product_variants = this.product_variants || [];
return json;
},
});
My question are:
- What is the "initialize", "init_from_JSON" and "export_as_JSON" functions and when we should be using them?
- Are those functions applied to both Order and orderline?
Thank you very mucu in advance
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
odoo POS use backbone model to store and manipulate data/record as model/collection ref: https://backbonejs.org/#Model-extend
initialize: it initializes the black object like order or orderline
POS can work offline so when you create any record it stores in browser local storage and continues sync with the server.
init_from_JSON: it gets record from local storage and initializes it if any (while reload the pos in offline mode)
export_as_JSON: it stores data to local storage as well send data to server in JSON formate
- Are those functions applied to both Order and orderline?
yes it applies to both with many other business models
Dear @Ravi Gadhia,
Thank you very much for your clean and easy to understand explanation.
Best regards
PM
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 8 21
|
2868 | ||
|
3
thg 11 19
|
9850 | ||
|
1
thg 2 19
|
6004 | ||
|
2
thg 4 21
|
6938 | ||
|
0
thg 3 20
|
3492 |
Sorry for mistyping: *Thank you very much in advance (unable to edit my own post - access denied)