Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
3710 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
1
Jul 24
3469
0
Jan 23
9
1
Nov 22
3401
2
Jul 22
2997
1
Jun 22
2555