From 3c2ce0ceba2a381e525d1ca991f939e71e0877d5 Mon Sep 17 00:00:00 2001 From: eloyoussef Date: Mon, 9 Apr 2018 18:49:50 +0200 Subject: [PATCH] =?UTF-8?q?modification=20du=20calcul=20du=20quantit=C3=A9?= =?UTF-8?q?=20selon=20uom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/golem_resource_reservation.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/golem_resource_account/models/golem_resource_reservation.py b/golem_resource_account/models/golem_resource_reservation.py index a18ad91..c91bf71 100644 --- a/golem_resource_account/models/golem_resource_reservation.py +++ b/golem_resource_account/models/golem_resource_reservation.py @@ -75,8 +75,11 @@ class GolemResourceReservation(models.Model): product.categ_id.property_account_income_categ_id.id delta = fields.Datetime.from_string(reservation.date_stop) - \ fields.Datetime.from_string(reservation.date_start) - quantity = (delta.days * 24) + (delta.seconds/3600.0) - + quantity = 1 + if product.uom_id.name == 'Hour(s)' or product.uom_id.name == 'Unit(s)': + quantity = int((delta.days * 24) + (delta.seconds/3600.0)) + elif product.uom_id.name == 'Day(s)': + quantity = int(delta.days + (delta.seconds/86400.0))#number of seconds in a day line_id = self.env['account.invoice.line'].create({ 'invoice_id': invoice_id.id, 'name': product.name,