Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
10461 Lượt xem

How can I extend pos order model to add a new field in it .

odoo.define('custom_module', function (require) {
    "use strict";   
    var screens = require('point_of_sale.screens');
    var models = require('point_of_sale.models');

    var OrderSuper = models.Order;
    models.Order = models.Order.extend({
        initialize: function(){
            // Add new field (status) in order model
            OrderSuper.prototype.initialize.apply(this, arguments);          
        },
    });
       
    });

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

Define the custom field first inside the pos.order model by inheriting it.

class PosOrderInherit(models.Model):
    _inherit = "pos.order"    custom_field = fields.Text(string="Custom Field")

Next, inside the javascript use the load_fields() to load the new field into the pos session.

odoo.define('custom_module', function (require) {
    "use strict";
    var screens = require('point_of_sale.screens');
    var models = require('point_of_sale.models');    models.load_fields('pos.order', ['custom_field']);    //Add the customisation code
});

Hope it helps

Ảnh đại diện
Huỷ bỏ

This does not work in Odoo 15.

Câu trả lời hay nhất

Hi,

I have 4 POS in my Odoo community version, how to costomize screen and receipt for each POS please?

Thanks

Ảnh đại diện
Huỷ bỏ

you need to create 4 different custom reports for each screen and receipt so then you can choose your model when you print

Thank you so much for your reply,
However, how to link custom receipts for each POS please?

Thanks


Le mar. 3 août 2021 à 04:50, DOUA Yanis <danielle55@hotmail.fr> a écrit :

you need to create 4 different custom reports for each screen and receipt so then you can choose your model when you print

Envoyé par Odoo S.A. utilisant Odoo.

Thanks DOUA Yanis for your reply,
However, how to link custom receipts for each POS please?
Thanks

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 3 19
3401
0
thg 6 18
3166
6
thg 1 18
5235
3
thg 4 25
1341
1
thg 8 24
2098