You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.0 KiB
Python
37 lines
1.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
from collections import defaultdict
|
|
|
|
from odoo import models, fields, api, _
|
|
from odoo.exceptions import UserError
|
|
from odoo.tools import frozendict
|
|
|
|
|
|
class AccountPaymentRegister(models.TransientModel):
|
|
_inherit = 'account.payment.register'
|
|
|
|
def action_create_payments(self):
|
|
payments = self._create_payments()
|
|
|
|
payments.partner_type = self.partner_type
|
|
|
|
if self._context.get('dont_redirect_to_payments'):
|
|
return True
|
|
|
|
action = {
|
|
'name': _('Payments'),
|
|
'type': 'ir.actions.act_window',
|
|
'res_model': 'account.payment',
|
|
'context': {'create': False},
|
|
}
|
|
if len(payments) == 1:
|
|
action.update({
|
|
'view_mode': 'form',
|
|
'res_id': payments.id,
|
|
})
|
|
else:
|
|
action.update({
|
|
'view_mode': 'tree,form',
|
|
'domain': [('id', 'in', payments.ids)],
|
|
})
|
|
return action
|