콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

Dear all,

I am using Odoo 12 and lack of JavaScript knowledge to make some inheritances in Odoo 12 POS module.

In point_of_sale/static/src/js/models.js, at about line 368 we have the following code:

model:  'product.product',
        // todo remove list_price in master, it is unused
        fields: ['display_name', 'list_price', 'lst_price', 'standard_price', 'categ_id', 'pos_categ_id', 'taxes_id',
                 'barcode', 'default_code', 'to_weight', 'uom_id', 'description_sale', 'description',
                 'product_tmpl_id','tracking'],
        order:  _.map(['sequence','default_code','name'], function (name) { return {name: name}; }),
        domain: [['sale_ok','=',true],['available_in_pos','=',true]],
        context: function(self){ return { display_default_code: false }; },
        loaded: function(self, products){
            var using_company_currency = self.config.currency_id[0] === self.company.currency_id[0];
            var conversion_rate = self.currency.rate / self.company_currency.rate;
            self.db.add_products(_.map(products, function (product) {
                if (!using_company_currency) {
                    product.lst_price = round_pr(product.lst_price * conversion_rate, self.currency.rounding);
                }
                product.categ = _.findWhere(self.product_categories, {'id': product.categ_id[0]});
                return new exports.Product({}, product);
            }));
        },

I need to inherit this code in order to change the "domain" and add only products with the 'default_code' field which is already loaded on the same js portion of code.

Can anyone help me with a template js I can use in order to inherit this "domain" and change it according to my needs?

Thank you very much in advance

Best regards

Paulo

아바타
취소
베스트 답변

Hi, did you find a solution please ?

아바타
취소

Hello Safaa,

Unfortunately I have not found a solution to this problem.
Since it was a specific situation, I have made the change directly in point_of_sale module which is not the best solution.

Regards

Can you tell me how did you do please ? I tried a lot of things but none of them worked. 

Le mar. 23 août 2022 à 12:00, Paulo Matos <notifications@mail.odoo.com> a écrit :

Hello Safaa,

Unfortunately I have not found a solution to this problem.
Since it was a specific situation, I have made the change directly in point_of_sale module which is not the best solution.

Regards

Envoyé par Odoo S.A. utilisant Odoo.

Can you tell me how did you do please ? I tried a lot of things but none of them worked.

Hello Safaa,
As per my last message, I have directly edited core odoo file "point_of_sale/static/src/js/models.js" and changed the "domain: [['sale_ok','=',true],['available_in_pos','=',true]]," for the domain I wanted.

I have edited core Odoo code directly which is not a good practice.

Thank you

관련 게시물 답글 화면 활동
1
7월 25
3091
1
5월 20
2065
0
10월 19
2798
4
2월 25
2700
0
12월 24
18