跳至内容
菜单
此问题已终结
2 回复
10652 查看

I am working on odoo11 point of sale, and want the user not to sell out of stock or negative stock items, where if the user selects the particular product, a warning should pop up that 'there is no stocks available for this product,

I know this is a simple one but I dont know where to apply the condition,

also I dont want to use any third party apps


形象
丢弃
最佳答案

Hello Suhaib, 

Currently Odoo only have this setting for Odoo E-Commerce not for POS

for E-commerce you can enable from website setting

"Website Setting -> Inventory"

https://prnt.sc/rlnmo5

For POS you can use below extension to restrict user for negative stock

https://store.webkul.com/Odoo-POS-Stock.html 

https://www.odoo.com/apps/modules/12.0/pos_stocks/

Thanks

形象
丢弃
编写者

thank you, but I dont want to use any extra addons instead custom myself, do you have any alternate solution?

Hi Suhaib,

in order to achieve this feature

You needs to override "models" JS file from Point of Sale module

like below

odoo.define('module_name.your_js_file', function (require) {

"use strict";

var inherit_models = require('point_of_sale.models');

var inherit_super_prototype = inherit_models.PosModel.prototype;

inherit_models.PosModel = inherit_models.PosModel.extend({

initialize: function (session, attributes) {

// your_defination

inherit_super_prototype.initialize.call(this, session, attributes);

}

});

});

Thanks

最佳答案

Hi,

A few custom addons can be found for this purpose. Haven't used or tested it yet. Anyway have a look at this modules,

* Restrict out-of-stock POS Orders  -- this is paid module, but you can check their github repository and download it, https://github.com/it-projects-llc/pos-addons


Thanks
形象
丢弃

Thanks.. I got my problem's Solution.

编写者

thank you, but I dont want to use any extra addons instead custom myself, do you have any alternate solution?

Hello !

You can check available quantity of particular product when you click on product.

There is a function in point_of_sale/static/src/js/model.js - addProduct()

Here you can check with attr.qty_available field.

var prod_qty = attr.qty_available;

if (prod_qty <= 0 ) {

alert('Not enough stock for this product');

}

Hope this will work for you.

Thanks,

Skype: mani.448

mmanisarwar@gmail.com

编写者

Ok sir, can I do the same from front end? if yes how?

For that. You need to installed Module. Which you have already denied to installed. With out custom code or already developed module you are not able to achieve that.