parent
e88de50eb8
commit
53e1f2a427
|
@ -29,23 +29,21 @@ from tools.translate import _
|
|||
class project_project(osv.osv):
|
||||
_inherit = 'project.project'
|
||||
|
||||
def _amt_to_invoiced(self, cr, uid, ids,field_name, arg, context=None):
|
||||
def _amt_to_invoice(self, cr, uid, ids,field_name, arg, context=None):
|
||||
res = {}
|
||||
task_pool=self.pool.get('project.task')
|
||||
for id in ids:
|
||||
task_ids = task_pool.search(cr, uid, [('project_id', '=', id)])
|
||||
total = 0.0
|
||||
project_record = self.browse(cr,uid,id)
|
||||
acc_model = self.pool.get("account.analytic.line")
|
||||
acc_id = acc_model.search(cr, uid, [('account_id', '=', project_record.analytic_account_id.id),('to_invoice', '=', 1),('invoice_id', '=', False)])
|
||||
if acc_id:
|
||||
for record in acc_model.browse(cr,uid,acc_id):
|
||||
total += record.amount
|
||||
res[id]= total
|
||||
aal_pool = self.pool.get("account.analytic.line")
|
||||
for project in self.browse(cr,uid,ids,context=context):
|
||||
line_ids = aal_pool.search(cr, uid, [('account_id','=',project.analytic_account_id.id),('to_invoice','=',1),('invoice_id','=',False)])
|
||||
amt_to_invoice = 0.0
|
||||
if line_ids:
|
||||
for line in aal_pool.browse(cr,uid,line_ids,context=context):
|
||||
amt_to_invoice += line.amount
|
||||
res[project.id] = (amt_to_invoice)*-1
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'timesheets' : fields.boolean('Timesheets',help = "If you check this field timesheets appears in kanban view"),
|
||||
'to_amt_invoice': fields.function(_amt_to_invoiced,string="Open Tasks")
|
||||
'amt_to_invoice': fields.function(_amt_to_invoice,string="Amount to Invoice")
|
||||
}
|
||||
_defaults = {
|
||||
'timesheets' : True,
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='task']" position='after'>
|
||||
<field name="timesheets"/>
|
||||
<field name="to_amt_invoice" invisible="True"/>
|
||||
<field name="amt_to_invoice" invisible="True"/>
|
||||
</xpath>
|
||||
|
||||
<field name="warn_customer" position="after">
|
||||
|
@ -34,7 +34,7 @@
|
|||
<field name="timesheets"/>
|
||||
<field name="total_hours"/>
|
||||
<field name="effective_hours"/>
|
||||
<field name="to_amt_invoice"/>
|
||||
<field name="amt_to_invoice"/>
|
||||
</field>
|
||||
<xpath expr="//t[@t-name='tasks']" position="after">
|
||||
<t t-name="timesheets">
|
||||
|
@ -54,13 +54,12 @@
|
|||
<t t-if="record.timesheets.raw_value">
|
||||
<button name="open_timesheets" class="oe_project_buttons" type="object" tooltip="timesheets"><img src="/project_timesheet/static/src/img/timesheet_icon.png" class="project_icon"/></button>
|
||||
</t>
|
||||
<t t-esc = "to_amt_invoice"/>
|
||||
</xpath>
|
||||
<xpath expr="//td[@class='td_name']" position="after">
|
||||
<td class="td_deadline">
|
||||
<div class="sequence">
|
||||
<kbd class="user">To invoice</kbd>
|
||||
<div class="manager"><b><field name="to_amt_invoice"/> <field name="currency_id"/></b></div>
|
||||
<div class="manager"><b><field name="amt_to_invoice"/> <field name="currency_id"/></b></div>
|
||||
</div>
|
||||
<div class="sequence">
|
||||
<kbd class="user">Rem. Hours</kbd>
|
||||
|
|
Loading…
Reference in New Issue