commit
955169f260
|
@ -29,21 +29,29 @@ from tools.translate import _
|
|||
class project_project(osv.osv):
|
||||
_inherit = 'project.project'
|
||||
|
||||
def _amt_to_invoice(self, cr, uid, ids,field_name, arg, context=None):
|
||||
def _to_invoice(self, cr, uid, ids,field_name, arg, context=None):
|
||||
res = {}
|
||||
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
|
||||
res[project.id] = {
|
||||
'amt_to_invoice': 0.0,
|
||||
'hrs_to_invoice': 0.0,
|
||||
}
|
||||
if line_ids:
|
||||
amt_to_invoice,hrs_to_invoice = 0.0,0.0
|
||||
for line in aal_pool.browse(cr,uid,line_ids,context=context):
|
||||
amt_to_invoice += line.amount
|
||||
res[project.id] = (amt_to_invoice)*-1
|
||||
hrs_to_invoice += line.unit_amount
|
||||
res[project.id]['amt_to_invoice'] = (amt_to_invoice)*-1
|
||||
res[project.id]['hrs_to_invoice'] = hrs_to_invoice
|
||||
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'timesheets' : fields.boolean('Timesheets',help = "If you check this field timesheets appears in kanban view"),
|
||||
'amt_to_invoice': fields.function(_amt_to_invoice,string="Amount to Invoice")
|
||||
'amt_to_invoice': fields.function(_to_invoice,string="Amount to Invoice",multi="sums"),
|
||||
'hrs_to_invoice': fields.function(_to_invoice,string="Hours to Invoice",multi="sums")
|
||||
}
|
||||
_defaults = {
|
||||
'timesheets' : True,
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<xpath expr="//field[@name='task']" position='after'>
|
||||
<field name="timesheets"/>
|
||||
<field name="amt_to_invoice" invisible="True"/>
|
||||
<field name="hrs_to_invoice" invisible="True"/>
|
||||
</xpath>
|
||||
|
||||
<field name="warn_customer" position="after">
|
||||
|
@ -30,11 +31,8 @@
|
|||
<field name="type">kanban</field>
|
||||
<field name="inherit_id" ref="project.view_project_kanban"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="task" position="after">
|
||||
<field name="task" position="after">
|
||||
<field name="timesheets"/>
|
||||
<field name="total_hours"/>
|
||||
<field name="effective_hours"/>
|
||||
<field name="amt_to_invoice"/>
|
||||
</field>
|
||||
<xpath expr="//t[@t-name='tasks']" position="after">
|
||||
<t t-name="timesheets">
|
||||
|
@ -64,7 +62,7 @@
|
|||
</div>
|
||||
<div class="sequence">
|
||||
<kbd class="user">Hours</kbd>
|
||||
<div class="manager"><b><t t-esc="Math.round(record.total_hours.raw_value-record.effective_hours.raw_value)"/> h</b></div>
|
||||
<div class="manager"><b><field name="hrs_to_invoice"/> h</b></div>
|
||||
</div>
|
||||
</td>
|
||||
</xpath>
|
||||
|
|
Loading…
Reference in New Issue