@@ -26,19 +26,17 @@
|
||||
<form string="Meetings">
|
||||
<group col="6" colspan="4">
|
||||
<field name="name" select="1" string="Summary"
|
||||
required="1" colspan="2" />
|
||||
required="1" />
|
||||
<field name="categ_id" widget="selection"
|
||||
string="Meeting Type"
|
||||
groups="base.group_extended"
|
||||
string="Meeting Type" groups="base.group_extended"
|
||||
domain="[('object_id.model', '=', 'crm.meeting')]" />
|
||||
<field name="allday" colspan="2" on_change="onchange_allday(allday)" />
|
||||
<field name="allday" on_change="onchange_allday(allday)" />
|
||||
<newline/>
|
||||
<field name="date" string="Start Date" required="1"
|
||||
on_change="onchange_dates(date,duration,False,allday)" />
|
||||
<field name="duration" widget="float_time"
|
||||
on_change="onchange_dates(date,duration,False,allday)" />
|
||||
<field name="date_deadline" string="End Date"
|
||||
required="1"
|
||||
<field name="date_deadline" string="End Date" required="1"
|
||||
on_change="onchange_dates(date,False,date_deadline)" />
|
||||
<field name="location" />
|
||||
<field name="alarm_id" string="Reminder"
|
||||
|
||||
@@ -154,7 +154,7 @@ class email_server(osv.osv):
|
||||
for num in range(1, numMsgs + 1):
|
||||
(header, msges, octets) = pop_server.retr(num)
|
||||
msg = '\n'.join(msges)
|
||||
res_id = email_tool.process_email(cr, uid, server.object_id.model, data[0][1], attach=server.attach, context=context)
|
||||
res_id = email_tool.process_email(cr, uid, server.object_id.model, msg, attach=server.attach, context=context)
|
||||
if res_id and server.action_id:
|
||||
action_pool = self.pool.get('ir.actions.server')
|
||||
action_pool.run(cr, uid, [server.action_id.id], {'active_id': res_id, 'active_ids':[res_id]})
|
||||
|
||||
+3
-4
@@ -19,8 +19,8 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import itertools
|
||||
import operator
|
||||
from itertools import groupby
|
||||
from operator import itemgetter
|
||||
from datetime import datetime
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
@@ -358,12 +358,11 @@ class many2many_domain(fields.many2many):
|
||||
|
||||
move_obj = obj.pool.get('stock.move')
|
||||
res = {}.fromkeys(ids, [])
|
||||
key = operator.itemgetter(0)
|
||||
valid_move_ids = move_obj.search(cr, user, self._domain) # move ids relative to domain argument
|
||||
cr.execute("SELECT production_id, move_id from mrp_production_move_ids where production_id in %s and move_id in %s",
|
||||
[tuple(ids), tuple(valid_move_ids)])
|
||||
related_move_map = cr.fetchall()
|
||||
related_move_dict = dict((k, list(set([v[1] for v in itr]))) for k, itr in itertools.groupby(related_move_map, key))
|
||||
related_move_dict = dict((k, list(set([v[1] for v in itr]))) for k, itr in groupby(related_move_map, itemgetter(0)))
|
||||
res.update(related_move_dict)
|
||||
|
||||
return res
|
||||
|
||||
+23
-19
@@ -22,12 +22,14 @@
|
||||
from lxml import etree
|
||||
import time
|
||||
from datetime import datetime, date
|
||||
from operator import itemgetter
|
||||
from itertools import groupby
|
||||
|
||||
from tools.misc import flatten
|
||||
from tools.translate import _
|
||||
from osv import fields, osv
|
||||
from tools import email_send as email
|
||||
|
||||
from operator import itemgetter
|
||||
|
||||
class project_task_type(osv.osv):
|
||||
_name = 'project.task.type'
|
||||
@@ -77,20 +79,6 @@ class project(osv.osv):
|
||||
pricelist_id = pricelist.get('property_product_pricelist', False) and pricelist.get('property_product_pricelist')[0] or False
|
||||
return {'value':{'contact_id': addr['contact'], 'pricelist_id': pricelist_id}}
|
||||
|
||||
def get_all_child_projects(self, cr, uid, ids, context=None):
|
||||
# Calculate child project for Given project id => For progress rate + planned time + Time spent
|
||||
cr.execute('''SELECT prpc.id AS id from account_analytic_account AS p
|
||||
JOIN account_analytic_account AS c ON p.id = c.parent_id
|
||||
JOIN project_project AS prp ON prp.analytic_account_id = p.id
|
||||
JOIN project_project AS prpc ON prpc.analytic_account_id = c.id
|
||||
WHERE prp.id IN %s''',(tuple(ids),))
|
||||
|
||||
child_ids = cr.fetchall()
|
||||
if child_ids:
|
||||
child_ids = [x[0] for x in child_ids]
|
||||
child_ids = self.get_all_child_projects(cr, uid, child_ids)
|
||||
return ids + child_ids
|
||||
|
||||
def _get_user_and_default_uom_ids(self, cr, uid):
|
||||
users_obj = self.pool.get('res.users')
|
||||
model_data_obj = self.pool.get('ir.model.data')
|
||||
@@ -102,17 +90,33 @@ class project(osv.osv):
|
||||
return user_uom, default_uom
|
||||
|
||||
def _progress_rate(self, cr, uid, ids, names, arg, context=None):
|
||||
def _get_all_child_projects(ids):
|
||||
"""Recursively get child project ids"""
|
||||
child_ids = flatten([project_hierarchy.get(idn, []) for idn in ids])
|
||||
if child_ids:
|
||||
child_ids = _get_all_child_projects(child_ids)
|
||||
return ids + child_ids
|
||||
# END _get_all_child_projects
|
||||
|
||||
res = {}.fromkeys(ids, 0.0)
|
||||
progress = {}
|
||||
if not ids:
|
||||
return res
|
||||
|
||||
par_child_projects={}
|
||||
par_child_projects = {}
|
||||
all_projects = list(ids)
|
||||
|
||||
# get project hierarchy:
|
||||
cr.execute('''SELECT prp.id AS pr_parent_id, prpc.id AS pr_child_id
|
||||
FROM account_analytic_account AS p
|
||||
JOIN account_analytic_account AS c ON p.id = c.parent_id
|
||||
JOIN project_project AS prp ON prp.analytic_account_id = p.id
|
||||
JOIN project_project AS prpc ON prpc.analytic_account_id = c.id''')
|
||||
|
||||
project_hierarchy = dict((k, list(set([v[1] for v in itr]))) for k, itr in groupby(cr.fetchall(), itemgetter(0)))
|
||||
|
||||
for id in ids:
|
||||
child_projects = self.get_all_child_projects(cr, uid, [id], context)
|
||||
child_projects = [x for x in child_projects]
|
||||
child_projects = _get_all_child_projects([id])
|
||||
par_child_projects[id] = child_projects
|
||||
all_projects.extend(child_projects)
|
||||
|
||||
@@ -466,7 +470,7 @@ class task(osv.osv):
|
||||
cr.execute('SELECT DISTINCT task_id '\
|
||||
'FROM project_task_parent_rel '\
|
||||
'WHERE parent_id IN %s', (tuple(ids),))
|
||||
child_ids = map(itemgetter(0), cr.fetchall())
|
||||
child_ids = map(lambda x: x[0], cr.fetchall())
|
||||
c_ids = child_ids
|
||||
if (list(set(parent_ids).intersection(set(c_ids)))) or (obj_task.id in c_ids):
|
||||
return False
|
||||
|
||||
@@ -140,7 +140,7 @@ class project_scrum_sprint(osv.osv):
|
||||
if default is None:
|
||||
default = {}
|
||||
default.update({'backlog_ids': [], 'meeting_ids': []})
|
||||
return super(scrum_sprint, self).copy(cr, uid, id, default=default, context=context)
|
||||
return super(project_scrum_sprint, self).copy(cr, uid, id, default=default, context=context)
|
||||
|
||||
def onchange_project_id(self, cr, uid, ids, project_id=False):
|
||||
v = {}
|
||||
|
||||
Reference in New Issue
Block a user