I add fields in 'acoount_move' and in 'account_register_payment' .
so, I want to show what is in the field 'acoount_move' in the field 'account_register-payment'.
I add fields in 'acoount_move' and in 'account_register_payment' .
so, I want to show what is in the field 'acoount_move' in the field 'account_register-payment'.
You can override the action_register_payment method
def action_register_payment(self):
''' Open the account.payment.register wizard to pay the selected journal entries.
:return: An action opening the account.payment.register wizard.
'''
return {
'name': _('Register Payment'),
'res_model': 'account.payment.register',
'view_mode': 'form',
'context': {
'active_model': 'account.move',
'active_ids': self.ids,
},
'target': 'new',
'type': 'ir.actions.act_window',
}
Pass the field value in the context and prefix the field name with default_ so the field in the payment register wizard will be automatically set for you.
In the following example, we suppose you have a reference (char field) in the account move model and you want to pass its value to the payment wizard, we take into consideration that the action_register_payment method is multi-record (self could be a recordset with multiple account moves)
Example:
def action_register_payment(self):
res = super(AccountMove, self).action_register_payment()
res['context']['default_reference'] = ', '.join(rec.reference for rec in self)
return res