diff --git a/cash_daily_report/data/menus.xml b/cash_daily_report/data/menus.xml index 492483b7b..f87b3fccd 100644 --- a/cash_daily_report/data/menus.xml +++ b/cash_daily_report/data/menus.xml @@ -4,6 +4,5 @@ - diff --git a/hotel/models/hotel_folio.py b/hotel/models/hotel_folio.py index c42565b98..891abf2a6 100644 --- a/hotel/models/hotel_folio.py +++ b/hotel/models/hotel_folio.py @@ -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') diff --git a/hotel/models/inherited_account_payment.py b/hotel/models/inherited_account_payment.py index b4f5e2103..fe59e4932 100644 --- a/hotel/models/inherited_account_payment.py +++ b/hotel/models/inherited_account_payment.py @@ -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, + } diff --git a/hotel/views/hotel_folio_views.xml b/hotel/views/hotel_folio_views.xml index d32007463..9dbbd7d5c 100644 --- a/hotel/views/hotel_folio_views.xml +++ b/hotel/views/hotel_folio_views.xml @@ -171,11 +171,12 @@ + context="{'tree_view_ref':'hotel.account_payment_view_tree_folio', 'form_view_ref':'hotel.account_payment_view_form_folio'}" + options="{'no_create': True}" /> + options="{'no_create': True}" /> diff --git a/hotel/views/inherited_account_payment_views.xml b/hotel/views/inherited_account_payment_views.xml index 1d469e064..b1f1dd3c8 100644 --- a/hotel/views/inherited_account_payment_views.xml +++ b/hotel/views/inherited_account_payment_views.xml @@ -17,20 +17,20 @@ account.payment.folio.form account.payment + 20
-
@@ -90,4 +90,27 @@ + + account.payment.folio.tree + account.payment + 20 + + + + + + + + + + + + +