forked from Yaltik/golem
[IMP]GOLEM Resource Account : add header button to go to invoice directly
This commit is contained in:
parent
471e9f35c7
commit
abcdcb1748
@ -77,3 +77,15 @@ class GolemResourceReservation(models.Model):
|
||||
})]
|
||||
})
|
||||
reservation.invoice_line_id = reservation.invoice_id.invoice_line_ids[0]
|
||||
|
||||
@api.multi
|
||||
def show_invoice(self):
|
||||
""" Redirects to linked invoice """
|
||||
self.ensure_one()
|
||||
reservation = self[0]
|
||||
if reservation.invoice_id:
|
||||
return {'type': 'ir.actions.act_window',
|
||||
'res_model': 'account.invoice',
|
||||
'res_id': reservation.invoice_id.id,
|
||||
'view_mode': 'form',
|
||||
'view_id': self.env.ref('account.invoice_form').id}
|
||||
|
@ -44,6 +44,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<button name="state_rejected" position="after">
|
||||
<button name="create_invoice" type="object" string="Create Invoice" class="oe_highlight"
|
||||
attrs="{'invisible': ['|', ('state', '!=', 'validated'), '|', ('resource_product_id', '=', False), ('invoice_id', '!=', False)]}" />
|
||||
<button name="show_invoice" type="object" string="Show invoice" class="oe_highlight"
|
||||
attrs="{'invisible': [('invoice_id', '=', False)]}" />
|
||||
</button>
|
||||
<group name="reservation" position="after">
|
||||
<group name="invoicing" string="Invoicing"
|
||||
|
Loading…
Reference in New Issue
Block a user