1 Answer
Existing Model in POS:
First add fields in python. For example, I inherit pos.order and add a new field “custom_field” .
class PosOrderInherit(models.Model):
_inherit = "pos.order"
custom_field = fields.Text(string="Custom Field")
Then loaded in the js file.
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 customization code
});
In Odoo16:
Adding fields in python for example I inherit pos.order and add a new field “custom_field” .
class PosOrderInherit(models.Model):
_inherit = "pos.order"
custom_field = fields.Text(string="Custom Field")
Then loaded in a python file.
def _loader_params_pos_order(self):
result = super()._loader_params_pos_order()
result['search_params']['fields'].extend(['custom_field'])
return result