Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4491 มุมมอง

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

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ย. 21
4177
1
เม.ย. 24
1935
3
ต.ค. 23
8185
Manual Invoice Sequence แก้ไขแล้ว
1
ก.ย. 21
3360
1
มิ.ย. 25
2404