Skip to Content
Menú
This question has been flagged
1 Respondre
1367 Vistes

I want to add the Order ref field in the POS Odoo 16 refund table as a column.


Order Ref should be added as one of the columns shown below.



Here is my code but it is still not working:

class PosOrder(models.Model):
_inherit = 'pos.order'

order_ref = fields.Char(string='Order Ref', compute="_getOrderRef")


@api.depends('name')
def _getOrderRef(self):
for rec in self:
rec.order_ref = rec.name
print("order_ref--->", rec.order_ref)

class PosSession(models.Model):
_inherit = 'pos.session'

def _pos_ui_pos_order(self):
         result = super()._pos_ui_pos_order()
         result.append('pos.order')
         print("result", result)
         return result

def _loader_params_pos_order(self):
      return {
            'search_params': {
            'fields': ['order_ref'],
             },
      }


def _get_pos_ui_pos_order(self, params):
       return self.env['pos.order'].search_read(**params['search_params'])


​JS code:
/** @odoo-module **/
import { PosGlobalState } from 'point_of_sale.models';
import Registries from 'point_of_sale.Registries';
const NewPosGlobalState = (PosGlobalState) => class NewPosGlobalState extends PosGlobalState {
     async _processData(loadedData) {
     await super._processData(...arguments);
     this.order_ref = loadedData['pos.order'];
    console.log(this.order_ref)
    }
}
Registries.Model.extend(PosGlobalState, NewPosGlobalState);

Avatar
Descartar
Best Answer

Hey Jay,


I hope you are doing well.


I'd like to provide you with some screenshots:

1. 


2. 


3. 

Note:- Add 'point_of_sale' in your customer module's depends.


Feel free to contact me if needed

Hope this will help you.

Thanks & Regards,
Email:  odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari

Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
de febr. 25
1627
1
de març 24
1683
2
de juny 24
2460
1
de febr. 24
1756
0
de nov. 23
1324