forked from Yaltik/golem
[IMP]GOLEM Resource Account : better coherence for quantities and UoM, using XMLIDS
This commit is contained in:
parent
c89cc9a2ed
commit
1a66cbd81c
@ -20,7 +20,7 @@
|
|||||||
'name': 'GOLEM resources invoicing',
|
'name': 'GOLEM resources invoicing',
|
||||||
'summary': 'GOLEM resources invoicing',
|
'summary': 'GOLEM resources invoicing',
|
||||||
'description': ''' GOLEM resources invoicing ''',
|
'description': ''' GOLEM resources invoicing ''',
|
||||||
'version': '10.0.0.2.0',
|
'version': '10.0.0.3.0',
|
||||||
'category': 'GOLEM',
|
'category': 'GOLEM',
|
||||||
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
|
@ -75,11 +75,13 @@ class GolemResourceReservation(models.Model):
|
|||||||
product.categ_id.property_account_income_categ_id.id
|
product.categ_id.property_account_income_categ_id.id
|
||||||
delta = fields.Datetime.from_string(reservation.date_stop) - \
|
delta = fields.Datetime.from_string(reservation.date_stop) - \
|
||||||
fields.Datetime.from_string(reservation.date_start)
|
fields.Datetime.from_string(reservation.date_start)
|
||||||
quantity = 1
|
quantity = 1.0
|
||||||
if product.uom_id.name == 'Hour(s)' or product.uom_id.name == 'Unit(s)':
|
# Make quantity coherent with UoM
|
||||||
quantity = int((delta.days * 24) + (delta.seconds/3600.0))
|
if product.uom_id in (self.env.ref('product.product_uom_hour'),
|
||||||
elif product.uom_id.name == 'Day(s)':
|
self.env.ref('product.product_uom_unit')):
|
||||||
quantity = int(delta.days + (delta.seconds/86400.0))#number of seconds in a day
|
quantity = int(round((delta.days * 24.0) + (delta.seconds/3600.0)))
|
||||||
|
elif product.uom_id == self.env.ref('product.product_uom_day'):
|
||||||
|
quantity = int(round(delta.days + (delta.seconds/86400.0)))
|
||||||
line_id = self.env['account.invoice.line'].create({
|
line_id = self.env['account.invoice.line'].create({
|
||||||
'invoice_id': invoice_id.id,
|
'invoice_id': invoice_id.id,
|
||||||
'name': product.name,
|
'name': product.name,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user