|
|
@ -94,7 +94,7 @@ class AccountHoursBlock(orm.Model): |
|
|
|
for line in block.invoice_id.invoice_line: |
|
|
|
amount_bought = 0.0 |
|
|
|
if line.product_id: |
|
|
|
## We will now calculate the product_quantity |
|
|
|
# We will now calculate the product_quantity |
|
|
|
factor = line.uos_id.factor |
|
|
|
if factor == 0.0: |
|
|
|
factor = 1.0 |
|
|
@ -103,7 +103,8 @@ class AccountHoursBlock(orm.Model): |
|
|
|
result[block.id]['amount_hours_block'] += amount_bought |
|
|
|
|
|
|
|
# Compute total amount |
|
|
|
# Get ids of analytic line generated from timesheet associated to current block |
|
|
|
# Get ids of analytic line generated from timesheet associated to |
|
|
|
# current block |
|
|
|
cr.execute("SELECT al.id FROM account_analytic_line AS al," |
|
|
|
" account_analytic_journal AS aj" |
|
|
|
" WHERE aj.id = al.journal_id" |
|
|
@ -139,7 +140,8 @@ class AccountHoursBlock(orm.Model): |
|
|
|
for block_type in block_per_types: |
|
|
|
if block_type: |
|
|
|
func = getattr(self, "_compute_%s" % block_type) |
|
|
|
result.update(func(cr, uid, ids, fields, args, context=context)) |
|
|
|
result.update( |
|
|
|
func(cr, uid, ids, fields, args, context=context)) |
|
|
|
|
|
|
|
for block in result: |
|
|
|
result[block]['amount_hours_block_delta'] = \ |
|
|
@ -161,7 +163,8 @@ class AccountHoursBlock(orm.Model): |
|
|
|
block_ids = set() |
|
|
|
inv_obj = self.pool.get('account.invoice') |
|
|
|
for invoice in inv_obj.browse(cr, uid, ids, context=context): |
|
|
|
block_ids.update([inv.id for inv in invoice.account_hours_block_ids]) |
|
|
|
block_ids.update( |
|
|
|
[inv.id for inv in invoice.account_hours_block_ids]) |
|
|
|
return list(block_ids) |
|
|
|
|
|
|
|
def action_send_block(self, cr, uid, ids, context=None): |
|
|
@ -413,7 +416,7 @@ class AccountHoursBlock(orm.Model): |
|
|
|
|
|
|
|
|
|
|
|
############################################################################ |
|
|
|
## Add hours blocks on invoice |
|
|
|
# Add hours blocks on invoice |
|
|
|
############################################################################ |
|
|
|
class AccountInvoice(orm.Model): |
|
|
|
_inherit = 'account.invoice' |
|
|
|