跳至內容
選單
此問題已被標幟
1 回覆
1350 瀏覽次數

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);

頭像
捨棄
最佳答案

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

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
2月 25
1601
1
3月 24
1611
2
6月 24
2411
1
2月 24
1732
0
11月 23
1319