in file js i add this code. Is there an error ???
var pos_model = require('point_of_sale.models'); pos_model.load_fields("res.company", ["new_fields"]);
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
in file js i add this code. Is there an error ???
var pos_model = require('point_of_sale.models'); pos_model.load_fields("res.company", ["new_fields"]);
Hello,
first you have to create one file under the following path
your_module/static/src/js/abc.js
in abc.js
odoo.define("your_module.abc", function(require){
"use strict";
var models = require("point_of_sale.models")
var existing_models = models.PosModel.prototype.models;
var product_index = _.findIndex(existing_models, function (model) {
return model.model === "product.product";
});
var product_model = existing_models[product_index];
models.load_fields("product.product", ["your_custom_field"]);
models.load_models([{
model: product_model.model,
fields: product_model.fields,
order: product_model.order,
domain: product_model.domain,
context: product_model.context,
loaded: function(self,companies){
}
}]);
var _super_orderline = models.Orderline.prototype;
models.Orderline = models.Orderline.extend({
export_for_printing: function(){
var receipt = _super_orderline.export_for_printing.apply(this,arguments);
receipt['your_custom_field'] = this.get_product().your_custom_field
return receipt
},
});
});
create new file under the following path in views/xyz.xml
and load the xyz.xml in the manifest file.
Thanks.
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 | |
|---|---|---|---|---|
|
3
thg 11 25
|
4397 | |||
|
2
thg 5 22
|
15140 | |||
|
1
thg 7 25
|
4778 | |||
|
10
thg 12 24
|
33961 | |||
|
1
thg 11 23
|
11145 |
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.
There is no error.