Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
6561 Lượt xem

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?


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

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.

Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 11 21
2149
1
thg 7 25
1918
4
thg 8 25
3175
1
thg 4 25
2075
0
thg 3 25
1224