[IMP]GOLEM Resource Account : do not show create invoicde button when there is no linked product

This commit is contained in:
Fabien BOURGEOIS 2018-03-26 11:37:31 +02:00
parent 476c1b25b8
commit 64607e5758
2 changed files with 3 additions and 1 deletions

View File

@ -27,6 +27,7 @@ class GolemResourceReservation(models.Model):
""" GOLEM Resource Reservation Adaptation """
_inherit = 'golem.resource.reservation'
resource_product_id = fields.Many2one(related='resource_id.product_tmpl_id')
invoice_id = fields.Many2one('account.invoice')
invoicing_state = fields.Selection(related="invoice_id.state",
string="Invoicing Status", default="None")

View File

@ -41,8 +41,9 @@ 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="arch" type="xml">
<button name="state_rejected" position="after">
<field name="resource_product_id" invisible="1" />
<button name="create_invoice" type="object" string="Create Invoice" class="oe_highlight"
attrs="{'invisible': ['|', ('state', 'not in', 'validated'), ('id', '=', False)]}" />
attrs="{'invisible': ['|', ('state', '!=', 'validated'), ('resource_product_id', '=', False)]}" />
</button>
</field>
</record>