mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[ADD] Edit mode and button to payments modify
This commit is contained in:
@@ -327,26 +327,6 @@ class HotelFolio(models.Model):
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
@api.multi
|
||||
def action_payments(self):
|
||||
self.ensure_one()
|
||||
payments_obj = self.env['account.payment']
|
||||
payments = payments_obj.search([('folio_id', '=', self.id)])
|
||||
view_form_id = self.env.ref('hotel.account_payment_view_form_folio').id
|
||||
view_tree_id = self.env.ref('account.view_account_payment_tree').id
|
||||
# invoices = self.mapped('invoice_ids.id')
|
||||
return{
|
||||
'name': _('Payments'),
|
||||
'view_type': 'form',
|
||||
'views': [(view_tree_id, 'tree'),(view_form_id, 'form')],
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.payment',
|
||||
'target': 'new',
|
||||
'init_mode': 'edit',
|
||||
'type': 'ir.actions.act_window',
|
||||
'domain': [('id', 'in', payments.ids)],
|
||||
}
|
||||
|
||||
@api.multi
|
||||
def open_invoices_folio(self):
|
||||
invoices = self.mapped('invoice_ids')
|
||||
|
||||
@@ -48,14 +48,7 @@ class AccountPayment(models.Model):
|
||||
self.payment_date = self.save_date
|
||||
if self.save_journal_id:
|
||||
self.journal_id = self.env['account.journal'].browse(self.save_journal_id)
|
||||
return {
|
||||
'name': 'Folio Payment Return',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'payment.return',
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_id': return_pay.id,
|
||||
}
|
||||
return_pay.action_confirm()
|
||||
|
||||
@api.multi
|
||||
def modify(self):
|
||||
@@ -114,9 +107,26 @@ class AccountPayment(models.Model):
|
||||
|
||||
@api.multi
|
||||
def post(self):
|
||||
rec = super(AccountPayment,self).post()
|
||||
rec = super(AccountPayment, self).post()
|
||||
if rec and not self._context.get("ignore_notification_post", False):
|
||||
for pay in self:
|
||||
if pay.folio_id:
|
||||
msg = _("Payment of %s %s registered from %s using %s payment method") % (pay.amount, pay.currency_id.symbol, pay.communication, pay.journal_id.name)
|
||||
pay.folio_id.message_post(subject=_('Payment'), body=msg)
|
||||
|
||||
@api.multi
|
||||
def modify_payment(self):
|
||||
self.ensure_one()
|
||||
view_form_id = self.env.ref('hotel.account_payment_view_form_folio').id
|
||||
# invoices = self.mapped('invoice_ids.id')
|
||||
return{
|
||||
'name': _('Payment'),
|
||||
'view_type': 'form',
|
||||
'views': [(view_form_id, 'form')],
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.payment',
|
||||
'target': 'new',
|
||||
'init_mode': 'edit',
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_id': self.id,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user