Skip to Content
Menu
This question has been flagged
1 Odpoveď
6549 Zobrazenia

I am trying to add the payment method into the tree view of Point of Sale > Orders > Orders. After a good 2 hours of trying, I cannot seem to get it to show.. I believe the field name is supposed to be statement_ids.journal_id but this doesn't work and I've attempted so many others. I feel like a dumb dumb :*(

Does any one know the correct field name for this to put me out of my misery?


Avatar
Zrušiť
Best Answer

yes you are right statement_ids.journal_id pos payment method

but on pos.order `statement_ids` one2many field and journal_id is many2one field of statement_ids ('account.bank.statement.line), so it will not directly access by reference 

so if you add 

     <field name="statement_ids"/>  it will display like records(2) in list as per number of line in statement_ids

another option is defined compute field on pos.order

payment_methods = fields.Char(compute="compute_payment_methos")

def compute_payment_methos(self):
      for order in self:
          order.payment_methods = ",".join(order.mapped('statement_ids.journal_id.name'))

add <field name="payment_methods"/> in tree view

Avatar
Zrušiť
Autor

Thank you so much for your response! I was too sad to work any more lol Will try this out when I am back :) Thanks again.

Autor

This worked a treat! Thank you so much Ravi :) Just in case someone else needs this, here is what you need to do:

In the pos.order model, add a custom field:

Field Name = x_payment_method

Field Label = Payment Method

Model = Point of Sale Orders

Field Type = many2one

Object Relation = account.journal

Related Field = statement_ids.journal_id

Dependencies = statement_ids.journal_id.name

Compute = payment_methods = fields.Char(compute="compute_payment_methods")

def compute_payment_methods(self):

for order in self:

order.payment_methods = ",".join(order.mapped('statement_ids.journal_id.name'))

Related Posts Replies Zobrazenia Aktivita
0
nov 21
2140
1
júl 25
1915
4
aug 25
3171
1
apr 25
2069
0
mar 25
1221