Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
3707 Widoki

Hello,

I would to customize Odoo V15 POS Screen to show on hand quantities of the respective warehouse on POS Screen.

Please kindly help me how to customize this feature


Thanks and Regards,

Zin Mar

09420097667

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

You can create a python file in the model, for inherits the pos config settings

class LocationInheritPos(models.Model):
_inherit = 'pos.config'

location = fields.Boolean(string='Display Warehouse Stock')
location_id = fields.Many2one('stock.location', string='Stock Location')

SRC folder-JS file

odoo.define('module_name.filename', function(require){
'use strict';

# inititlize the variables
var ProductItem = require('point_of_sale.ProductItem');
var Registries = require('point_of_sale.Registries');
var models = require('point_of_sale.models');

# load the models into pos
models.load_models({
model: 'stock.quant',
fields: ['location_id', 'product_id','available_quantity'],
domain: function(self){
return [['location_id', '=', self.config.location_id[0]]];
},
loaded: function(self, stock_quant) {
self.product_quantity = stock_quant;
}

})
# extend the product screen
const NewProductItem = ProductItem =>
class extends ProductItem {
get quantity() {
var qty = this.env.pos.product_quantity
for(var i=0; i < qty.length; i++)
{
// 
if(qty[i].product_id[0] == this.props.product.id){
return qty[i].available_quantity

}
// 
}
}
}
ProductItem.template = 'ProductItem';

Registries.Component.extend(ProductItem, NewProductItem);

return ProductItem;

});

IN XML file SRC folder

<template id="template" xml:space="preserve">


    <t t-name="ProductItem" t-inherit="point_of_sale.ProductItem" t-inherit-mode="extension" owl="1">


        <xpath expr="//div[hasclass('product-name')]" position="inside">


            <t t-if="quantity">


                <div>


                <t t-esc="quantity"/>


                    # you can add i class and text in the particular session


                </div>


            </t>


        </xpath>


    </t>


</template>


Regards

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
lip 24
3467
0
sty 23
9
1
lis 22
3401
2
lip 22
2996
1
cze 22
2554