Odoo Technical

Welcome!

This community is for professionals and enthusiasts of our products and services.
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

0

Adding new model into POS in V16-Please share more details

Avatar
Mohanraj
Avatar
Discard
1 Answer
0
Avatar
Gayathri
Best Answer

In Odoo 15:

First import models from point_of_sale

Then load the model skit.step.discount from python and get fields like id, discount_percentage, discount_name, is_fixed_discount and product_id.

In odoo15 models are loaded in js code.

var models = require('point_of_sale.models');

models.load_models({

model: 'skit.step.discount',

domain:[condition],

fields: ['id','discount_percentage','discount_name','is_fixed_discount','product_id'],

loaded: function (self,discount) {

self.discount = discount;

(condition)

},

});

});
In 

Odoo16:

  •  In odoo16 skit.step.discount models are loaded in python code.

def _pos_ui_models_to_load(self):

         result = super()._pos_ui_models_to_load()

         result+ = ['skit.step.discount']

         return result

  •  skit.step.discount models fields, domains are loaded in python code.

def _loader_params_skit_step_discount(self):

    return{

      'search_params': {

    Domain:[condition],

'fields': ['id','discount_percentage','discount_name','is_fixed_discount','product_id'],

       }

}       

def _get_pos_ui_skit_step_discount(self, params):

              return self.env['skit.step.discount'].search_read(**params['search_params'])


  •  loaded model in js file.

const NewPosGlobalState = (PosGlobalState) => class NewPosGlobalState  extends PosGlobalState {

    asyn _processData(loadedData) {

await super._processData(arguments):

this. skit_step_discount = loadedData['skit.step.discount '];

     }

   }

            Registries.Model.extend(PosGlobalState, NewPosGlobalState);


Avatar
Discard