问题描述
我只想加载在 pos 的库存位置退出的产品。我尝试使用以下代码。但显示所有产品。我该怎么做?我尝试使用此模块 https://apps.odoo.com/apps/modules/13.0/pos_product_available/.But 该模块显示所有产品。我想要仅加载产品及其库存位置中的数量。
var rpc = require("web.rpc");
var models = require("point_of_sale.models");
var field_utils = require("web.field_utils");
models.load_fields("product.product",["qty_available","type"]);
var PosModelSuper = models.PosModel.prototype;
models.PosModel = models.PosModel.extend({
get_product_model: function() {
return _.find(this.models,function(model) {
return model.model === "product.product";
});
},initialize: function(session,attributes) {
// Compatibility with pos_cache module
// preserve product.product model data for future request
this.product_product_model = this.get_product_model(this.models);
PosModelSuper.initialize.apply(this,arguments);
},load_server_data: function() {
// Compatibility with pos_cache module
var self = this;
var loaded = PosModelSuper.load_server_data.call(this);
if (this.get_product_model(this.models)) {
return loaded;
}
// If product.product model is not presented in this.models after super was called then pos_cache module installed
return loaded.then(function() {
return rpc
.query({
model: "product.product",method: "search_read",args: [],fields: ["qty_available","type"],domain: self.product_product_model.domain,context: _.extend(self.product_product_model.context,{
location: self.config.default_location_src_id[0],}),})
.then(function(products) {
self.add_product_qty(products);
});
});
},
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)