diff --git a/golem_resource_account/models/golem_resource_reservation.py b/golem_resource_account/models/golem_resource_reservation.py
index 393e14b..a91c4c7 100644
--- a/golem_resource_account/models/golem_resource_reservation.py
+++ b/golem_resource_account/models/golem_resource_reservation.py
@@ -39,24 +39,7 @@ class GolemResourceReservation(models.Model):
return [('id', 'in', reservation.mapped('id'))]
else:
return [('invoice_id.state', operator, value)]
-
- """
- print '________________________________'
- print("kelri")
-
- if self.invoice_id:
- invoicing_state = self.invoice_id.state
- print "_____________________1"
- print invoicing_state
- return [('invoicing_state', operator, value)]
- else:
- invoicing_state = "None"
- print '_____________________2'
- print invoicing_state
- return [('invoicing_state', operator, value)]
- print invoicing_state
- """
@api.multi
@api.depends('invoice_id')
def _compute_invoicing_state(self):
@@ -67,6 +50,17 @@ class GolemResourceReservation(models.Model):
else:
reservation.invoicing_state = "None"
+ @api.multi
+ def voir_invoice(self):
+ for reservation in self:
+ if reservation.invoice_id:
+ return {'name' : _('Reservation Invoice'),
+ 'type' : 'ir.actions.act_window',
+ 'res_model' : 'account.invoice',
+ 'res_id' : reservation.invoice_id.id,
+ 'view_mode': 'form',
+ 'target': 'current'}
+
@api.multi
def create_invoice(self):
@@ -87,8 +81,6 @@ class GolemResourceReservation(models.Model):
_('There is no income account defined for this product: "%s". \
You may have to install a chart of account from Accounting \
app, settings menu.') % (product.name,))
-
-
reservation.invoice_id = inv_obj.create({
'name': reservation.name,
#'origin': self.application_number,
diff --git a/golem_resource_account/views/golem_resource_reservation_views.xml b/golem_resource_account/views/golem_resource_reservation_views.xml
index 4999ede..a4e742e 100644
--- a/golem_resource_account/views/golem_resource_reservation_views.xml
+++ b/golem_resource_account/views/golem_resource_reservation_views.xml
@@ -41,9 +41,15 @@ along with this program. If not, see .
+
+
+
diff --git a/golem_resource_account/wizard/golem_reservation_invoice.py b/golem_resource_account/wizard/golem_reservation_invoice.py
index 8afb0ec..27a02e8 100644
--- a/golem_resource_account/wizard/golem_reservation_invoice.py
+++ b/golem_resource_account/wizard/golem_reservation_invoice.py
@@ -78,3 +78,11 @@ class GolemReservationInvoiceWizard(models.TransientModel):
'invoice_line_ids': lines,
})
self.reservation_ids.write({'invoice_id': invoice.id})
+ if self._context.get('open_invoices', False):
+ return {'name' : _('Reservation Invoice'),
+ 'type' : 'ir.actions.act_window',
+ 'res_model' : 'account.invoice',
+ 'res_id' : invoice.id,
+ 'view_mode': 'form',
+ 'target': 'current'}
+ return {'type': 'ir.actions.act_window_close'}
diff --git a/golem_resource_account/wizard/golem_reservation_invoice.xml b/golem_resource_account/wizard/golem_reservation_invoice.xml
index 2b724a0..365746f 100644
--- a/golem_resource_account/wizard/golem_reservation_invoice.xml
+++ b/golem_resource_account/wizard/golem_reservation_invoice.xml
@@ -48,6 +48,8 @@ along with this program. If not, see .