Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd

Right now I'm trying to call programmatically, from another model, the action 'action_register_payment' that exists in the invoice details page as a button called 'Register & Payment' (I'm not able to post images).

I want to call that method, to pass the information to the action_create_payments method of the account.payment.register model

Avatar
Annuleer
Auteur Beste antwoord

Resolved. Create a method in the model account.move, inheriting the class

def payments_create(self):
invoice_object = self
cliente = self.env['res.partner'].search([('id','=', self.partner_id.id)])
ctx = dict(
active_ids=invoice_object.ids, # Use ids and not id (it has to be a list)
active_model='account.move',
)
values = {
'payment_type': 'inbound',
'partner_type': 'customer',
'partner_id': self.partner_id.id,
'payment_method_id': 1,
'amount': self.amount_total,
'payment_date': self.date,
'currency_id': 1,
'journal_id': 14,
'communication': self.name,
}
wizard = self.env['account.payment.register'].with_context(ctx).create(values)
wizard._create_payments()

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
sep. 21
4090
1
apr. 24
1831
3
okt. 23
8079
1
sep. 21
3266
1
jun. 25
2344