[FIX] project_long_term: quick hacks to avoid crash at project phase creation
This is broken by design, and crashes now that the "Day" UOM was renamed to "Day(s)". Needs to be reviewed correctly, there are other things that will break. bzr revid: odo@openerp.com-20121211180202-df5ngpmzkp2sfdkd
This commit is contained in:
parent
078bc8585e
commit
533399ff20
|
@ -123,7 +123,6 @@ class project_phase(osv.osv):
|
|||
_defaults = {
|
||||
'state': 'draft',
|
||||
'sequence': 10,
|
||||
'product_uom': lambda self,cr,uid,c: self.pool.get('product.uom').search(cr, uid, [('name', '=', _('Day'))], context=c)[0]
|
||||
}
|
||||
_order = "project_id, date_start, sequence"
|
||||
_constraints = [
|
||||
|
@ -169,11 +168,12 @@ class project_phase(osv.osv):
|
|||
for phase in phases:
|
||||
if phase.state in ('done','cancelled'):
|
||||
continue
|
||||
# FIXME: brittle and not working if context['lang'] != 'en_US'
|
||||
duration_uom = {
|
||||
'days': 'd', 'day': 'd', 'd':'d',
|
||||
'months': 'm', 'month':'month', 'm':'m',
|
||||
'weeks': 'w', 'week': 'w', 'w':'w',
|
||||
'hours': 'H', 'hour': 'H', 'h':'H',
|
||||
'day(s)': 'd', 'days': 'd', 'day': 'd', 'd':'d',
|
||||
'month(s)': 'm', 'months': 'm', 'month':'month', 'm':'m',
|
||||
'week(s)': 'w', 'weeks': 'w', 'week': 'w', 'w':'w',
|
||||
'hour(s)': 'H', 'hours': 'H', 'hour': 'H', 'h':'H',
|
||||
}.get(phase.product_uom.name.lower(), "H")
|
||||
duration = str(phase.duration) + duration_uom
|
||||
result += '''
|
||||
|
|
Loading…
Reference in New Issue