Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
3710 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
čvc 24
3469
0
led 23
9
1
lis 22
3401
2
čvc 22
2997
1
čvn 22
2555