Skip to Content
Menú
This question has been flagged
1 Respondre
3725 Vistes

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

Avatar
Descartar
Best Answer

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

Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
de jul. 24
3476
0
de gen. 23
9
1
de nov. 22
3409
2
de jul. 22
3009
1
de juny 22
2573