Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
The question has been closed iz razloga: Question / Code not indented
by Ihab El Zareif na 17. 03. 2024 14:18:14
1518 Prikazi

What am I missing? Based on pos_hr:
from odoo import models, fields
class PosOrderReport(models.Model):
_inherit = "report.pos.order"
employee_id = fields.Many2one(
'hr.employee', string='Employee', readonly=True)
def _select(self):
return super(PosOrderReport, self)._select() + ',s.employee_id AS employee_id'
def _group_by(self):
return super(PosOrderReport, self)._group_by() + ',s.employee_id'

I thought I could add payment methods to the POS orders pivot table (report.pos.order):
from odoo import models, fields
class PosOrderReport(models.Model):
_inherit = "report.pos.order"
payment_method_id = fields.Many2one(
'pos.order', string='payment_method_id', readonly=True)
def _select(self):
return super(PosOrderReport, self)._select() + ',s.payment_method_id AS payment_method_id'
def _group_by(self):
return super(PosOrderReport, self)._group_by() + ',s.payment_method_id'

But I get the error:
File "/opt/odoo16/odoo/sql_db.py", line 313, in execute
res = self._obj.execute(query, params)
psycopg2.errors.UndefinedColumn: column s.payment_method_id does not exist
LINE 32: ,s.payment_method_id AS payment_method_id
^

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
0
feb. 25
1210
2
nov. 23
3477
1
okt. 23
2025
0
nov. 23
1282
0
apr. 23
1150