[FIX] Timesheets invoiced as expenses are and correction removed in invoiced calculation

bzr revid: jco@openerp.com-20130327103833-ekjzi3e0alkpod35
This commit is contained in:
Josse Colpaert 2013-03-27 11:38:33 +01:00
parent 958369f2a3
commit 8548a69f73
3 changed files with 21 additions and 8 deletions

View File

@ -211,12 +211,10 @@ class account_analytic_account(osv.osv):
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,))
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)
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
@ -543,6 +541,23 @@ class account_analytic_account(osv.osv):
pass
return result
def hr_to_invoice_timesheets(self, cr, uid, ids, context=None):
domain = [('invoice_id','=',False),('to_invoice','!=',False), ('journal_id.type', '=', 'general'), ('account_id', 'in', ids)]
names = [record.name for record in self.browse(cr, uid, ids, context=context)]
name = _('Timesheets to Invoice of %s') % ','.join(names)
return {
'type': 'ir.actions.act_window',
'name': name,
'view_type': 'form',
'view_mode': 'tree,form',
'domain' : domain,
'res_model': 'account.analytic.line',
'nodestroy': True,
}
class account_analytic_account_summary_user(osv.osv):
_name = "account_analytic_analysis.summary.user"
_description = "Hours Summary by User"

View File

@ -98,8 +98,8 @@
<field class="oe_inline" name="ca_to_invoice" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
</td><td class="oe_timesheet_action" attrs="{'invisible': ['|',('invoice_on_timesheets','=',False),('type','=','template')]}">
<span attrs="{'invisible': [('ca_to_invoice','=',0.0)]}" class="oe_grey">
<button name="%(hr_timesheet_invoice.action_hr_timesheet_invoice_create_final)d"
type="action"
<button name="hr_to_invoice_timesheets"
type="object"
class="oe_link"
string="⇒ Invoice"/>
or view

View File

@ -100,8 +100,6 @@ 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 = {