commit
7c0f37cf82
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>openobject-addons</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.python.pydev.PyDevBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.python.pydev.pythonNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -25,12 +25,8 @@ from osv import fields,osv
|
|||
|
||||
# Overloaded sale_order to manage carriers :
|
||||
class sale_order(osv.osv):
|
||||
_name = "sale.order"
|
||||
_inherit = 'sale.order'
|
||||
_description = "Sale Order"
|
||||
|
||||
_columns = {
|
||||
'id': fields.integer('ID', readonly=True,invisible=True),
|
||||
'carrier_id':fields.many2one("delivery.carrier","Delivery method", help="Complete this field if you plan to invoice the shipping based on packings made."),
|
||||
}
|
||||
|
||||
|
|
|
@ -246,6 +246,15 @@ class task(osv.osv):
|
|||
#_sql_constraints = [
|
||||
# ('remaining_hours', 'CHECK (remaining_hours>=0)', 'Please increase and review remaining hours ! It can not be smaller than 0.'),
|
||||
#]
|
||||
|
||||
def _button_dummy(self, cr, uid, ids, context={}):
|
||||
tot_work=0
|
||||
for obj in self.browse(cr,uid,ids):
|
||||
for work in obj.work_ids:
|
||||
tot_work+=work.hours
|
||||
final_val = obj.planned_hours - tot_work
|
||||
self.write(cr,uid,ids[0],{'remaining_hours':final_val})
|
||||
return True
|
||||
|
||||
def copy(self, cr, uid, id, default={},context={}):
|
||||
default = default or {}
|
||||
|
@ -408,23 +417,8 @@ class project_work(osv.osv):
|
|||
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
}
|
||||
_order = "date desc"
|
||||
def create(self, cr, uid, vals, *args, **kwargs):
|
||||
if 'task_id' in vals:
|
||||
cr.execute('update project_task set remaining_hours=remaining_hours+%.2f where id=%d', (-vals.get('hours',0.0), vals['task_id']))
|
||||
return super(project_work,self).create(cr, uid, vals, *args, **kwargs)
|
||||
|
||||
def write(self, cr, uid, ids,vals,context={}):
|
||||
for work in self.browse(cr, uid, ids, context):
|
||||
cr.execute('update project_task set remaining_hours=remaining_hours+%.2f+(%.2f) where id=%d', (-vals.get('hours',0.0), work.hours, work.task_id.id))
|
||||
return super(project_work,self).write(cr, uid, ids, vals, context)
|
||||
|
||||
def unlink(self, cr, uid, ids, *args, **kwargs):
|
||||
for work in self.browse(cr, uid, ids):
|
||||
cr.execute('update project_task set remaining_hours=remaining_hours+%.2f where id=%d', (work.hours, work.task_id.id))
|
||||
return super(project_work,self).unlink(cr, uid, ids,*args, **kwargs)
|
||||
project_work()
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
<field model="res.users" name="user_id" search="[('login','=','demo')]"/>
|
||||
<field name="project_id" ref="project_project_21"/>
|
||||
<field name="name">Internal testing + Software Install</field>
|
||||
<field name="date_deadline">2007-06-06</field>
|
||||
<field name="date_deadline">2008-06-06</field>
|
||||
</record>
|
||||
<record id="project_task_188" model="project.task">
|
||||
<field name="sequence">17</field>
|
||||
|
|
|
@ -220,7 +220,8 @@
|
|||
widget="float_time"
|
||||
on_change="onchange_planned(planned_hours,effective_hours)"/>
|
||||
<field name="delay_hours" widget="float_time"/>
|
||||
<field name="remaining_hours" select="2" widget="float_time"/>
|
||||
<field name="remaining_hours" select="2" widget="float_time" attrs="{'readonly':[('state','!=','draft')]}" colspan="1"/>
|
||||
<button name="_button_dummy" string="Compute" type="object" colspan="1"/>
|
||||
<field name="effective_hours" widget="float_time"/>
|
||||
|
||||
<field colspan="4" name="description" nolabel="1" select="2"/>
|
||||
|
@ -507,6 +508,6 @@
|
|||
<act_window domain="[('user_id', '=', active_id),('state', '<>', 'cancelled'),('state', '<>', 'done')]" id="act_res_users_2_project_task_opened" name="Assigned tasks" res_model="project.task" src_model="res.users" view_mode="tree,form" view_type="form"/>
|
||||
|
||||
<act_window domain="[('user_id', '=', active_id),('date', '>=', time.strftime('%Y-%m-01'))]" id="act_res_users_2_project_task_work_month" name="Month works" res_model="project.task.work" src_model="res.users" view_mode="tree,form" view_type="form"/>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue