From 5307ae37c064464fc9d1ba2fe30757f33c0a053d Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Mon, 26 Mar 2018 12:35:12 +0200 Subject: [PATCH] [IMP]GOLEM Resource Account : linked to account line, computes account_id from line, improve search and attrs on form --- .../models/golem_resource_reservation.py | 7 ++++--- .../views/golem_resource_reservation_views.xml | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/golem_resource_account/models/golem_resource_reservation.py b/golem_resource_account/models/golem_resource_reservation.py index 2af1e32..cfa2b0d 100644 --- a/golem_resource_account/models/golem_resource_reservation.py +++ b/golem_resource_account/models/golem_resource_reservation.py @@ -28,11 +28,12 @@ class GolemResourceReservation(models.Model): _inherit = 'golem.resource.reservation' resource_product_id = fields.Many2one(related='resource_id.product_tmpl_id') - invoice_id = fields.Many2one('account.invoice', 'Invoice', index=True) - invoice_state = fields.Selection(related='invoice_id.state', store=True) - invoice_amount_total = fields.Monetary(related='invoice_id.amount_total') invoice_line_id = fields.Many2one('account.invoice.line') invoice_line_price_subtotal = fields.Monetary(related='invoice_line_id.price_subtotal') + invoice_id = fields.Many2one(related='invoice_line_id.invoice_id', + string='Invoice') + invoice_state = fields.Selection(related='invoice_id.state', store=True) + invoice_amount_total = fields.Monetary(related='invoice_id.amount_total') currency_id = fields.Many2one(related='invoice_id.currency_id') @api.multi diff --git a/golem_resource_account/views/golem_resource_reservation_views.xml b/golem_resource_account/views/golem_resource_reservation_views.xml index 37cc902..00590f1 100644 --- a/golem_resource_account/views/golem_resource_reservation_views.xml +++ b/golem_resource_account/views/golem_resource_reservation_views.xml @@ -47,6 +47,7 @@ along with this program. If not, see . + attrs="{'invisible': [('invoice_id', '=', False)]}"> @@ -66,7 +67,8 @@ along with this program. If not, see . ref="golem_resource.golem_resource_reservation_view_search"/> - +