forked from Yaltik/golem
Affichage du facture apres sa création, automatiquemet et via bouton
This commit is contained in:
parent
5caa210dcc
commit
d620fb18b8
@ -39,24 +39,7 @@ class GolemResourceReservation(models.Model):
|
|||||||
return [('id', 'in', reservation.mapped('id'))]
|
return [('id', 'in', reservation.mapped('id'))]
|
||||||
else:
|
else:
|
||||||
return [('invoice_id.state', operator, value)]
|
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.multi
|
||||||
@api.depends('invoice_id')
|
@api.depends('invoice_id')
|
||||||
def _compute_invoicing_state(self):
|
def _compute_invoicing_state(self):
|
||||||
@ -67,6 +50,17 @@ class GolemResourceReservation(models.Model):
|
|||||||
else:
|
else:
|
||||||
reservation.invoicing_state = "None"
|
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
|
@api.multi
|
||||||
def create_invoice(self):
|
def create_invoice(self):
|
||||||
@ -87,8 +81,6 @@ class GolemResourceReservation(models.Model):
|
|||||||
_('There is no income account defined for this product: "%s". \
|
_('There is no income account defined for this product: "%s". \
|
||||||
You may have to install a chart of account from Accounting \
|
You may have to install a chart of account from Accounting \
|
||||||
app, settings menu.') % (product.name,))
|
app, settings menu.') % (product.name,))
|
||||||
|
|
||||||
|
|
||||||
reservation.invoice_id = inv_obj.create({
|
reservation.invoice_id = inv_obj.create({
|
||||||
'name': reservation.name,
|
'name': reservation.name,
|
||||||
#'origin': self.application_number,
|
#'origin': self.application_number,
|
||||||
|
@ -41,9 +41,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<field name='inherit_id' ref="golem_resource.golem_resource_reservation_view_form"/>
|
<field name='inherit_id' ref="golem_resource.golem_resource_reservation_view_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<button name="state_rejected" position="after">
|
<button name="state_rejected" position="after">
|
||||||
<button name="create_invoice" type="object" string="Create Invoice" class="oe_highlight"
|
<button name="create_invoice" type="object" string="Create New Invoice" class="oe_highlight"
|
||||||
attrs="{'invisible': ['|', ('state', 'not in', 'validated'), ('id', '=', False)]}" />
|
attrs="{'invisible': ['|', ('state', 'not in', 'validated'),
|
||||||
|
'|',('id', '=', False), ('invoicing_state', '=', 'paid')]}" />
|
||||||
|
<button name="voir_invoice" type="object" string="Voir Invoice" class="oe_highlight"
|
||||||
|
attrs="{'invisible': [('invoicing_state', '==', 'None')]}" />
|
||||||
</button>
|
</button>
|
||||||
|
<field name="partner_id" position="after">
|
||||||
|
<field name="invoicing_state" readonly="1" />
|
||||||
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
@ -78,3 +78,11 @@ class GolemReservationInvoiceWizard(models.TransientModel):
|
|||||||
'invoice_line_ids': lines,
|
'invoice_line_ids': lines,
|
||||||
})
|
})
|
||||||
self.reservation_ids.write({'invoice_id': invoice.id})
|
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'}
|
||||||
|
@ -48,6 +48,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<field name="reservation_ids" context="{'default_reservation_ids': active_ids}" />
|
<field name="reservation_ids" context="{'default_reservation_ids': active_ids}" />
|
||||||
</group>
|
</group>
|
||||||
<footer>
|
<footer>
|
||||||
|
<button name="create_invoices" string="Create and View Invoices" type="object"
|
||||||
|
context="{'open_invoices': True}" class="oe_highlight" />
|
||||||
<button name="create_invoices" string="Create Invoices" type="object"
|
<button name="create_invoices" string="Create Invoices" type="object"
|
||||||
class="oe_highlight" />
|
class="oe_highlight" />
|
||||||
<button string="Cancel" class="oe_link" special="cancel" />
|
<button string="Cancel" class="oe_link" special="cancel" />
|
||||||
@ -64,6 +66,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<form string="Reservation to invoice">
|
<form string="Reservation to invoice">
|
||||||
<label string="Invoices will be created in draft so that you can review them before validation" />
|
<label string="Invoices will be created in draft so that you can review them before validation" />
|
||||||
<footer>
|
<footer>
|
||||||
|
<button name="create_invoices" string="Create and View Invoices" type="object"
|
||||||
|
context="{'open_invoices': True}" class="oe_highlight" />
|
||||||
<button name="create_invoices" string="Create Invoices" type="object"
|
<button name="create_invoices" string="Create Invoices" type="object"
|
||||||
class="oe_highlight" />
|
class="oe_highlight" />
|
||||||
<button string="Cancel" class="oe_link" special="cancel" />
|
<button string="Cancel" class="oe_link" special="cancel" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user