Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
3723 Представления

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

Аватар
Отменить
Лучший ответ

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

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
июл. 24
3472
0
янв. 23
9
1
нояб. 22
3406
2
июл. 22
2999
1
июн. 22
2562