[FIX] Remove also import and correct total invoiced on so by calculation of invoice lines
bzr revid: jco@openerp.com-20130327171243-zzagfabhf5i0bb90
This commit is contained in:
parent
7bf78a7097
commit
23d2c6d634
|
@ -206,15 +206,14 @@ class account_analytic_account(osv.osv):
|
|||
return res
|
||||
|
||||
if child_ids:
|
||||
cr.execute("SELECT account_analytic_line.account_id, COALESCE(SUM(amount), 0.0) \
|
||||
FROM account_analytic_line \
|
||||
JOIN account_analytic_journal \
|
||||
ON account_analytic_line.journal_id = account_analytic_journal.id \
|
||||
WHERE account_analytic_line.account_id IN %s \
|
||||
AND account_analytic_journal.type = 'sale' \
|
||||
GROUP BY account_analytic_line.account_id", (child_ids,))
|
||||
for account_id, sum in cr.fetchall():
|
||||
res[account_id] = round(sum,2)
|
||||
#Search all invoice lines not in cancelled state that refer to this analytic account
|
||||
inv_line_obj = self.pool.get("account.invoice.line")
|
||||
inv_lines = inv_line_obj.search(cr, uid, ['&', ('account_analytic_id', 'in', child_ids), ('invoice_id.state', '!=', 'cancel')], context=context)
|
||||
for line in inv_line_obj.browse(cr, uid, inv_lines, context=context):
|
||||
res[line.account_analytic_id.id] += line.price_subtotal
|
||||
for acc in self.browse(cr, uid, res.keys(), context=context):
|
||||
res[acc.id] = res[acc.id] - (acc.timesheet_ca_invoiced or 0.0)
|
||||
|
||||
res_final = res
|
||||
return res_final
|
||||
|
||||
|
|
|
@ -100,6 +100,8 @@ class account_analytic_account(osv.osv):
|
|||
|
||||
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
result = super(account_analytic_account, self)._ca_invoiced_calc(cr, uid, ids, name, arg, context=context)
|
||||
for acc in self.browse(cr, uid, result.keys(), context=context):
|
||||
result[acc.id] = result[acc.id] - (acc.expense_invoiced or 0.0)
|
||||
return result
|
||||
|
||||
_columns = {
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
import hr_timesheet_invoice_create
|
||||
import hr_timesheet_analytic_profit
|
||||
import hr_timesheet_final_invoice_create
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
Loading…
Reference in New Issue