Added auto category assigned at create from category tree view
bzr revid: fabian@tinyerp.com-20081028162302-i5z6cc06zhf08x3z
This commit is contained in:
parent
6851a15eca
commit
b7a4dffa63
|
@ -283,6 +283,11 @@ class product_template(osv.osv):
|
|||
res = cr.fetchone()
|
||||
return res and res[0] or False
|
||||
|
||||
def _default_category(self, cr, uid, context={}):
|
||||
if 'categ_id' in context and context['categ_id']:
|
||||
return context['categ_id']
|
||||
return False
|
||||
|
||||
_defaults = {
|
||||
'type': lambda *a: 'product',
|
||||
'list_price': lambda *a: 1,
|
||||
|
@ -298,6 +303,7 @@ class product_template(osv.osv):
|
|||
'uom_po_id': _get_uom_id,
|
||||
'uos_coeff' : lambda *a: 1.0,
|
||||
'mes_type' : lambda *a: 'fixed',
|
||||
'categ_id' : _default_category,
|
||||
}
|
||||
|
||||
def _check_uom(self, cursor, user, ids):
|
||||
|
|
|
@ -273,6 +273,11 @@ class task(osv.osv):
|
|||
def onchange_planned(self, cr, uid, ids, planned, effective):
|
||||
return {'value':{'remaining_hours': planned-effective}}
|
||||
|
||||
def _default_project(self, cr, uid, context={}):
|
||||
if 'project_id' in context and context['project_id']:
|
||||
return context['project_id']
|
||||
return False
|
||||
|
||||
#_sql_constraints = [
|
||||
# ('remaining_hours', 'CHECK (remaining_hours>=0)', 'Please increase and review remaining hours ! It can not be smaller than 0.'),
|
||||
#]
|
||||
|
@ -313,6 +318,7 @@ class task(osv.osv):
|
|||
'sequence': lambda *a: 10,
|
||||
'active': lambda *a: True,
|
||||
'date_start': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'project_id': _default_project,
|
||||
}
|
||||
_order = "sequence, priority, date_deadline, id"
|
||||
|
||||
|
|
|
@ -439,6 +439,7 @@
|
|||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,calendar,graph</field>
|
||||
<field name="domain">[('project_id', 'child_of', [active_id])]</field>
|
||||
<field name="context">{'project_id':active_id}</field>
|
||||
</record>
|
||||
<record id="ir_project_task_open" model="ir.values">
|
||||
<field eval=" 'tree_but_open'" name="key2"/>
|
||||
|
|
Loading…
Reference in New Issue