[IMP]GOLEM Resource Account : add header button to go to invoice directly

This commit is contained in:
Fabien BOURGEOIS 2018-03-26 12:36:42 +02:00
parent 471e9f35c7
commit abcdcb1748
2 changed files with 14 additions and 0 deletions

View File

@ -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}

View File

@ -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"