[IMP] account_analytic_analysis, analytic_contract_hr_expense: remaining to invoice is max(old_remaining, current not invoice)

bzr revid: qdp-launchpad@openerp.com-20120614133728-7qbwcpdr811oaj7q
This commit is contained in:
Quentin (OpenERP) 2012-06-14 15:37:28 +02:00
parent eb5a048493
commit 80be8440fa
2 changed files with 5 additions and 14 deletions

View File

@ -260,12 +260,7 @@ class account_analytic_account(osv.osv):
def _remaining_hours_to_invoice_calc(self, cr, uid, ids, name, arg, context=None):
res = {}
for account in self.browse(cr, uid, ids, context=context):
if account.quantity_max != 0:
res[account.id] = account.quantity_max - account.hours_qtt_invoiced
else:
res[account.id] = 0.0
for id in ids:
res[id] = round(res.get(id, 0.0),2)
res[account.id] = max(account.hours_qtt_est - account.hours_qtt_invoiced, account.hours_qtt_non_invoiced)
return res
def _hours_qtt_invoiced_calc(self, cr, uid, ids, name, arg, context=None):
@ -306,11 +301,9 @@ class account_analytic_account(osv.osv):
res = {}
for account in self.browse(cr, uid, ids, context=context):
if account.amount_max != 0:
res[account.id] = account.amount_max - account.ca_invoiced
res[account.id] = max(account.amount_max - account.ca_invoiced, account.ca_to_invoice)
else:
res[account.id]=0.0
for id in ids:
res[id] = round(res.get(id, 0.0),2)
return res
def _real_margin_calc(self, cr, uid, ids, name, arg, context=None):
@ -365,7 +358,7 @@ class account_analytic_account(osv.osv):
if account.fix_price_invoices:
total_remaining += account.remaining_ca
if account.invoice_on_timesheets:
total_remaining += account.remaining_hours
total_remaining += account.remaining_hours_to_invoice
return total_remaining
def _get_total_toinvoice(self, account):

View File

@ -48,7 +48,7 @@ class account_analytic_account(osv.osv):
total_remaining += account.remaining_expense
return total_remaining
def _get_total_remaining(self, account):
def _get_total_toinvoice(self, account):
total_toinvoice = super(account_analytic_account, self)._get_total_toinvoice(account)
if account.charge_expenses:
total_toinvoice += account.expense_to_invoice
@ -58,11 +58,9 @@ class account_analytic_account(osv.osv):
res = {}
for account in self.browse(cr, uid, ids, context=context):
if account.est_expenses != 0:
res[account.id] = account.est_expenses - account.expense_invoiced
res[account.id] = max(account.est_expenses - account.expense_invoiced, account.expense_to_invoice)
else:
res[account.id]=0.0
for id in ids:
res[id] = round(res.get(id, 0.0),2)
return res
def _expense_to_invoice_calc(self, cr, uid, ids, name, arg, context=None):