Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
1566 Zobrazení

 def button_get_payments_attachments(self):        

​self.ensure_one()        

​ids=[]        

​for invoice in self.invoice_ids:          

​​print('----------------',invoice.payment_ids)            

​print('----------------',invoice.payment_id)            


no results

---------------- account.payment()

---------------- account.payment()



            

Avatar
Zrušit
Nejlepší odpověď

Hi,

You can use the following code to link a purchase order with its payments.


Python

from odoo import models


class PurchaseOrder(models.Model):
_inherit = 'purchase.order'

def button_get_payments_attachments(self):
self.ensure_one()
account_payment_ids = [
item['account_payment_id']
for payment in self.invoice_ids.mapped('invoice_payments_widget')
for item in payment.get('content', [])
]
return {
'type': 'ir.actions.act_window',
'name': 'Payments',
'res_model': 'account.payment',
'view_mode': 'tree,form',
'domain': [('id', 'in', account_payment_ids)],

}

Hope it helps

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
Odoo App Vyřešeno
1
lis 23
2184
0
kvě 24
1896
0
zář 23
2822
0
zář 23
2480
0
srp 23
2338