summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authormra (Open ERP) <mra@tinyerp.com>2010-01-08 16:35:05 +0530
committermra (Open ERP) <mra@tinyerp.com>2010-01-08 16:35:05 +0530
commitdec803c5840e0417fbb4efeb4a7ceb9ca7de511e (patch)
treec2faf408566b6dafd99ac4358fc2336f89d6e8eb /addons
parent8fe7d4c0a7acc0c83020f4154c7fe0361b978e9a (diff)
[ADD] Add project_id and section_id on user object
[ADD] Add rules on crm, project, crm_project, sale_crm to open with user preference domain [IMP] section_id no more required=True now [ADD] add object message on project module [ADD] add default values for project and section with all objects related with it using user prefernce fields [IMP] overall changes on crm and project bzr revid: mra@tinyerp.com-20100108110505-pp2s1x0bjcy0edun
Diffstat (limited to 'addons')
-rwxr-xr-xaddons/crm/crm.py24
-rw-r--r--addons/crm/crm_claim.py42
-rw-r--r--addons/crm/crm_helpdesk.py26
-rw-r--r--addons/crm/crm_meeting.py190
-rw-r--r--addons/crm/crm_phonecall.py44
-rw-r--r--addons/crm/crm_view.xml32
-rw-r--r--addons/crm/security/crm_security.xml125
-rw-r--r--addons/crm_project/__terp__.py1
-rw-r--r--addons/crm_project/crm_project_bug.py47
-rw-r--r--addons/crm_project/crm_project_feature.py43
-rw-r--r--addons/crm_project/security/crm_project_security.xml34
-rw-r--r--addons/project/project.py55
-rw-r--r--addons/project/project_view.xml76
-rw-r--r--addons/project/security/project_security.xml55
-rw-r--r--addons/sale_crm/__terp__.py10
-rw-r--r--addons/sale_crm/sale_crm.py15
-rw-r--r--addons/sale_crm/sale_crm_view.xml2
-rw-r--r--addons/sale_crm/security/sale_crm_security.xml32
18 files changed, 628 insertions, 225 deletions
diff --git a/addons/crm/crm.py b/addons/crm/crm.py
index 172e150740d..a58a50028a5 100755
--- a/addons/crm/crm.py
+++ b/addons/crm/crm.py
@@ -73,7 +73,7 @@ class crm_case_section(osv.osv):
'user_id': fields.many2one('res.users', 'Responsible User'),
'reply_to': fields.char('Reply-To', size=64, help="The email address put in the 'Reply-To' of all emails sent by Open ERP about cases in this section"),
'parent_id': fields.many2one('crm.case.section', 'Parent Section'),
- 'child_ids': fields.one2many('crm.case.section', 'parent_id', 'Child Sections'),
+ 'child_ids': fields.one2many('crm.case.section', 'parent_id', 'Child Sections'),
'calendar' : fields.boolean('Calendar', help='Allows to show calendar'),
}
_defaults = {
@@ -408,6 +408,11 @@ class crm_case(osv.osv):
if context.get('portal', False):
return False
return uid
+
+ def _get_section(self, cr, uid, context):
+ user = self.pool.get('res.users').browse(cr, uid, uid)
+ return user.section_id.id
+
_defaults = {
'active': lambda *a: 1,
'user_id': _get_default_user,
@@ -417,6 +422,7 @@ class crm_case(osv.osv):
'state': lambda *a: 'draft',
'priority': lambda *a: AVAILABLE_PRIORITIES[2][0],
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
+ 'section_id': _get_section,
}
_order = 'priority, date_deadline desc, date desc,id desc'
@@ -818,8 +824,8 @@ class crm_case(osv.osv):
data['user_id'] = uid
self.write(cr, uid, ids, data)
self._action(cr,uid, cases, 'open')
- return True
-
+ return True
+
def case_cancel(self, cr, uid, ids, *args):
cases = self.browse(cr, uid, ids)
@@ -946,5 +952,15 @@ class crm_email_add_cc_wizard(osv.osv_memory):
return {}
crm_email_add_cc_wizard()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+class res_users(osv.osv):
+ _inherit = "res.users"
+ _description = "users"
+
+ _columns = {
+ 'section_id': fields.many2one('crm.case.section', 'Sales Section', required=False)
+ }
+
+res_users()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file
diff --git a/addons/crm/crm_claim.py b/addons/crm/crm_claim.py
index 1cddafaeca8..0606e39a052 100644
--- a/addons/crm/crm_claim.py
+++ b/addons/crm/crm_claim.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@@ -30,15 +30,15 @@ class crm_claim(osv.osv):
_name = "crm.claim"
_description = "Claim Cases"
_order = "id desc"
- _inherits = {'crm.case':"inherit_case_id"}
- _columns = {
+ _inherits = {'crm.case':"inherit_case_id"}
+ _columns = {
'inherit_case_id': fields.many2one('crm.case','Case',ondelete='cascade'),
}
def _map_ids(self, method, cr, uid, ids, *args, **argv):
if isinstance(ids, (str, int, long)):
select = [ids]
else:
- select = ids
+ select = ids
case_data = self.browse(cr, uid, select)
new_ids = []
for case in case_data:
@@ -61,25 +61,25 @@ class crm_claim(osv.osv):
def onchange_categ_id(self, cr, uid, ids, *args, **argv):
return self._map_ids('onchange_categ_id',cr,uid,ids,*args,**argv)
def case_close(self,cr, uid, ids, *args, **argv):
- return self._map_ids('case_close',cr,uid,ids,*args,**argv)
+ return self._map_ids('case_close',cr,uid,ids,*args,**argv)
def case_open(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_open',cr,uid,ids,*args,**argv)
def case_cancel(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_cancel',cr,uid,ids,*args,**argv)
def case_reset(self,cr, uid, ids, *args, **argv):
- return self._map_ids('case_reset',cr,uid,ids,*args,**argv)
- def case_escalate(self,cr, uid, ids, *args, **argv):
- return self._map_ids('case_escalate',cr,uid,ids,*args,**argv)
- def case_pending(self,cr, uid, ids, *args, **argv):
- return self._map_ids('case_pending',cr,uid,ids,*args,**argv)
+ return self._map_ids('case_reset',cr,uid,ids,*args,**argv)
+ def case_escalate(self,cr, uid, ids, *args, **argv):
+ return self._map_ids('case_escalate',cr,uid,ids,*args,**argv)
+ def case_pending(self,cr, uid, ids, *args, **argv):
+ return self._map_ids('case_pending',cr,uid,ids,*args,**argv)
- def msg_new(self, cr, uid, msg):
+ def msg_new(self, cr, uid, msg):
mailgate_obj = self.pool.get('mail.gateway')
msg_body = mailgate_obj.msg_body_get(msg)
data = {
- 'name': msg['Subject'],
+ 'name': msg['Subject'],
'email_from': msg['From'],
- 'email_cc': msg['Cc'],
+ 'email_cc': msg['Cc'],
'user_id': False,
'description': msg_body['body'],
'history_line': [(0, 0, {'description': msg_body['body'], 'email': msg['From'] })],
@@ -87,15 +87,15 @@ class crm_claim(osv.osv):
res = mailgate_obj.partner_get(cr, uid, msg['From'])
if res:
data.update(res)
- res = self.create(cr, uid, data)
+ res = self.create(cr, uid, data)
return res
def msg_update(self, cr, uid, ids, *args, **argv):
return self._map_ids('msg_update',cr, uid, ids, *args, **argv)
def emails_get(self, cr, uid, ids, *args, **argv):
return self._map_ids('emails_get',cr, uid, ids, *args, **argv)
- def msg_send(self, cr, uid, ids, *args, **argv):
- return self._map_ids('msg_send',cr, uid, ids, *args, **argv)
+ def msg_send(self, cr, uid, ids, *args, **argv):
+ return self._map_ids('msg_send',cr, uid, ids, *args, **argv)
crm_claim()
@@ -103,7 +103,7 @@ class crm_claim_assign_wizard(osv.osv_memory):
_name = 'crm.claim.assign_wizard'
_columns = {
- 'section_id': fields.many2one('crm.case.section', 'Section', required=True),
+ 'section_id': fields.many2one('crm.case.section', 'Section', required=False),
'user_id': fields.many2one('res.users', 'Responsible'),
}
@@ -133,18 +133,18 @@ class crm_claim_assign_wizard(osv.osv_memory):
'section_id':res.get('section_id',False),
'user_id':res.get('user_id',False),
'case_id' : case.inherit_case_id.id
- }, context=context)
+ }, context=context)
case_obj.case_close(cr, uid, [case_id])
data_obj = self.pool.get('ir.model.data')
result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_claims_filter')
search_view = data_obj.read(cr, uid, result, ['res_id'])
- value = {
+ value = {
'name': _('Claims'),
'view_type': 'form',
'view_mode': 'form,tree',
'res_model': 'crm.claim',
- 'res_id': int(new_case_id),
+ 'res_id': int(new_case_id),
'type': 'ir.actions.act_window',
'search_view_id': search_view['res_id']
}
diff --git a/addons/crm/crm_helpdesk.py b/addons/crm/crm_helpdesk.py
index b4ecbc728d2..4cf4b951e53 100644
--- a/addons/crm/crm_helpdesk.py
+++ b/addons/crm/crm_helpdesk.py
@@ -36,16 +36,16 @@ class crm_helpdesk(osv.osv):
_name = "crm.helpdesk"
_description = "Helpdesk Cases"
_order = "id desc"
- _inherits = {'crm.case':"inherit_case_id"}
- _columns = {
+ _inherits = {'crm.case':"inherit_case_id"}
+ _columns = {
'inherit_case_id':fields.many2one('crm.case','Case'),
}
-
+
def _map_ids(self, method, cr, uid, ids, *args, **argv):
if isinstance(ids, (str, int, long)):
select = [ids]
else:
- select = ids
+ select = ids
case_data = self.browse(cr, uid, select)
new_ids = []
for case in case_data:
@@ -66,21 +66,21 @@ class crm_helpdesk(osv.osv):
def onchange_categ_id(self, cr, uid, ids, *args, **argv):
return self._map_ids('onchange_categ_id',cr,uid,ids,*args,**argv)
def case_close(self,cr, uid, ids, *args, **argv):
- return self._map_ids('case_close',cr,uid,ids,*args,**argv)
+ return self._map_ids('case_close',cr,uid,ids,*args,**argv)
def case_open(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_open',cr,uid,ids,*args,**argv)
def case_cancel(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_cancel',cr,uid,ids,*args,**argv)
def case_reset(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_reset',cr,uid,ids,*args,**argv)
-
- def msg_new(self, cr, uid, msg):
+
+ def msg_new(self, cr, uid, msg):
mailgate_obj = self.pool.get('mail.gateway')
msg_body = mailgate_obj.msg_body_get(msg)
data = {
- 'name': msg['Subject'],
+ 'name': msg['Subject'],
'email_from': msg['From'],
- 'email_cc': msg['Cc'],
+ 'email_cc': msg['Cc'],
'user_id': False,
'description': msg_body['body'],
'history_line': [(0, 0, {'description': msg_body['body'], 'email': msg['From'] })],
@@ -88,15 +88,15 @@ class crm_helpdesk(osv.osv):
res = mailgate_obj.partner_get(cr, uid, msg['From'])
if res:
data.update(res)
- res = self.create(cr, uid, data)
+ res = self.create(cr, uid, data)
return res
def msg_update(self, cr, uid, ids, *args, **argv):
return self._map_ids('msg_update',cr, uid, ids, *args, **argv)
def emails_get(self, cr, uid, ids, *args, **argv):
return self._map_ids('emails_get',cr, uid, ids, *args, **argv)
- def msg_send(self, cr, uid, ids, *args, **argv):
- return self._map_ids('msg_send',cr, uid, ids, *args, **argv)
+ def msg_send(self, cr, uid, ids, *args, **argv):
+ return self._map_ids('msg_send',cr, uid, ids, *args, **argv)
crm_helpdesk()
@@ -104,7 +104,7 @@ class crm_helpdesk_assign_wizard(osv.osv_memory):
_name = 'crm.helpdesk.assign_wizard'
_columns = {
- 'section_id': fields.many2one('crm.case.section', 'Section', required=True),
+ 'section_id': fields.many2one('crm.case.section', 'Section', required=False),
'user_id': fields.many2one('res.users', 'Responsible'),
}
diff --git a/addons/crm/crm_meeting.py b/addons/crm/crm_meeting.py
index 7f34c90d4e3..f58bdf77f20 100644
--- a/addons/crm/crm_meeting.py
+++ b/addons/crm/crm_meeting.py
@@ -35,41 +35,41 @@ class crm_meeting(osv.osv):
_order = "id desc"
_inherits = {'crm.case': "inherit_case_id"}
__attribute__ = {
- 'class': {'field': 'class', 'type': 'selection'},
+ 'class': {'field': 'class', 'type': 'selection'},
'created': {'field': 'create_date', 'type': 'datetime'}, # keep none for now
- 'description': {'field': 'description', 'type': 'text'},
- 'dtstart': {'field': 'date', 'type': 'datetime'},
- 'location': {'field': 'location', 'type': 'text'},
+ 'description': {'field': 'description', 'type': 'text'},
+ 'dtstart': {'field': 'date', 'type': 'datetime'},
+ 'location': {'field': 'location', 'type': 'text'},
#'organizer': {'field': 'partner_id', 'sub-field': 'name', 'type': 'many2one'},
- 'priority': {'field': 'priority', 'type': 'int'},
- 'dtstamp' : {'field': 'date', 'type': 'datetime'},
- 'seq': None,
+ 'priority': {'field': 'priority', 'type': 'int'},
+ 'dtstamp' : {'field': 'date', 'type': 'datetime'},
+ 'seq': None,
'status': {'field': 'state', 'type': 'selection', 'mapping': {'tentative': 'draft', \
- 'confirmed': 'open' , 'cancelled': 'cancel'}},
- 'summary': {'field': 'name', 'type': 'text'},
- 'transp': {'field': 'transparent', 'type': 'text'},
- 'uid': {'field': 'id', 'type': 'text'},
- 'url': {'field': 'caldav_url', 'type': 'text'},
- 'recurid': None,
+ 'confirmed': 'open' , 'cancelled': 'cancel'}},
+ 'summary': {'field': 'name', 'type': 'text'},
+ 'transp': {'field': 'transparent', 'type': 'text'},
+ 'uid': {'field': 'id', 'type': 'text'},
+ 'url': {'field': 'caldav_url', 'type': 'text'},
+ 'recurid': None,
# 'attach': {'field': 'attachment_ids', 'sub-field': 'datas', 'type': 'list'},
- 'attendee': {'field': 'attendee_ids', 'type': 'many2many', 'object': 'calendar.attendee'},
+ 'attendee': {'field': 'attendee_ids', 'type': 'many2many', 'object': 'calendar.attendee'},
# 'categories': {'field': 'categ_id', 'sub-field': 'name'},
'categories': {'field': 'categ_id', 'type': 'many2one', 'object': 'crm.case.categ'},
- 'comment': None,
- 'contact': None,
- 'exdate' : {'field': 'exdate', 'type': 'datetime'},
- 'exrule' : {'field': 'exrule', 'type': 'text'},
- 'rstatus': None,
- 'related': None,
- 'resources': None,
- 'rdate': None,
- 'rrule': {'field': 'rrule', 'type': 'text'},
- 'x-openobject-model': {'value': _name, 'type': 'text'},
+ 'comment': None,
+ 'contact': None,
+ 'exdate' : {'field': 'exdate', 'type': 'datetime'},
+ 'exrule' : {'field': 'exrule', 'type': 'text'},
+ 'rstatus': None,
+ 'related': None,
+ 'resources': None,
+ 'rdate': None,
+ 'rrule': {'field': 'rrule', 'type': 'text'},
+ 'x-openobject-model': {'value': _name, 'type': 'text'},
# 'duration': {'field': 'duration'},
- 'dtend': {'field': 'date_deadline', 'type': 'datetime'},
- 'valarm': {'field': 'caldav_alarm_id', 'type': 'many2one', 'object': 'calendar.alarm'},
+ 'dtend': {'field': 'date_deadline', 'type': 'datetime'},
+ 'valarm': {'field': 'caldav_alarm_id', 'type': 'many2one', 'object': 'calendar.alarm'},
}
-
+
def _get_attendee_data(self, cr, uid, ids, name, arg, context):
result = {}
for id in ids:
@@ -79,84 +79,84 @@ class crm_meeting(osv.osv):
att_data = map(lambda x: x.cn or '', eventdata.attendee_ids)
result[id] = ', '.join(att_data)
return result
-
+
def _set_attendee_data(self, cr, uid, id, name, value, arg, context):
if not value:
- return
+ return
eventdata = self.browse(cr, uid, id, context=context)
att_len = len(eventdata.attendee_ids)
if att_len == len(value.split(',')):
- return
+ return
if att_len > len(value.split(',')):
for attendee in eventdata.attendee_ids[len(value.split(',')):]:
self.write(cr, uid, id, {'attendee_ids': [(3, attendee.id)]})
- return
- attendee_obj = self.pool.get('calendar.attendee')
+ return
+ attendee_obj = self.pool.get('calendar.attendee')
for val in value.split(',')[att_len:]:
attendee_id = attendee_obj.create(cr, uid, {'cn': val.strip()})
self.write(cr, uid, id, {'attendee_ids': [(4, attendee_id)]})
- return
+ return
_columns = {
'inherit_case_id': fields.many2one('crm.case', 'Case', ondelete='cascade'),
'class': fields.selection([('public', 'Public'), ('private', 'Private'), \
- ('confidential', 'Confidential')], 'Privacy'),
- 'location': fields.char('Location', size=264, help="Gives Location of Meeting"),
- 'freebusy': fields.text('FreeBusy'),
+ ('confidential', 'Confidential')], 'Privacy'),
+ 'location': fields.char('Location', size=264, help="Gives Location of Meeting"),
+ 'freebusy': fields.text('FreeBusy'),
'show_as': fields.selection([('free', 'Free'), \
('busy', 'Busy')],
- 'show_as'),
- 'caldav_url': fields.char('Caldav URL', size=264),
+ 'show_as'),
+ 'caldav_url': fields.char('Caldav URL', size=264),
'exdate': fields.text('Exception Date/Times', help="This property defines the list\
- of date/time exceptions for arecurring calendar component."),
+ of date/time exceptions for arecurring calendar component."),
'exrule': fields.char('Exception Rule', size=352, help="defines a rule or repeating pattern\
- for anexception to a recurrence set"),
- 'rrule': fields.char('Recurrent Rule', size=352, invisible="True"),
+ for anexception to a recurrence set"),
+ 'rrule': fields.char('Recurrent Rule', size=352, invisible="True"),
'rrule_type' : fields.selection([('none', 'None'), ('daily', 'Daily'), \
- ('weekly', 'Weekly'), ('monthly', 'Monthly'), ('yearly', 'Yearly'), ('custom','Custom')], 'Recurrency'),
+ ('weekly', 'Weekly'), ('monthly', 'Monthly'), ('yearly', 'Yearly'), ('custom','Custom')], 'Recurrency'),
'attendees': fields.function(_get_attendee_data, method=True,\
- fnct_inv=_set_attendee_data, string='Attendees', type="text"),
- 'alarm_id': fields.many2one('res.alarm', 'Alarm'),
- 'caldav_alarm_id': fields.many2one('calendar.alarm', 'Alarm'),
+ fnct_inv=_set_attendee_data, string='Attendees', type="text"),
+ 'alarm_id': fields.many2one('res.alarm', 'Alarm'),
+ 'caldav_alarm_id': fields.many2one('calendar.alarm', 'Alarm'),
'attendee_ids': fields.many2many('calendar.attendee', 'crm_attendee_rel', 'case_id', \
- 'attendee_id', 'Attendees'),
+ 'attendee_id', 'Attendees'),
}
_defaults = {
- 'class': lambda *a: 'public',
+ 'class': lambda *a: 'public',
}
def do_alarm_create(self, cr, uid, ids, context={}):
alarm_obj = self.pool.get('calendar.alarm')
model_obj = self.pool.get('ir.model')
model_id = model_obj.search(cr, uid, [('model','=',self._name)])[0]
-
- for meeting in self.browse(cr, uid, ids):
+
+ for meeting in self.browse(cr, uid, ids):
self.do_alarm_unlink(cr, uid, [meeting.id])
basic_alarm = meeting.alarm_id
if basic_alarm:
vals = {
- 'action': 'display',
- 'description': meeting.description,
- 'name': meeting.name,
+ 'action': 'display',
+ 'description': meeting.description,
+ 'name': meeting.name,
'attendee_ids': [(6,0, map(lambda x:x.id, meeting.attendee_ids))],
- 'trigger_related': basic_alarm.trigger_related,
- 'trigger_duration': basic_alarm.trigger_duration,
- 'trigger_occurs': basic_alarm.trigger_occurs,
- 'trigger_interval': basic_alarm.trigger_interval,
- 'duration': basic_alarm.duration,
- 'repeat': basic_alarm.repeat,
+ 'trigger_related': basic_alarm.trigger_related,
+ 'trigger_duration': basic_alarm.trigger_duration,
+ 'trigger_occurs': basic_alarm.trigger_occurs,
+ 'trigger_interval': basic_alarm.trigger_interval,
+ 'duration': basic_alarm.duration,
+ 'repeat': basic_alarm.repeat,
'state' : 'run',
- 'event_date' : meeting.date,
- 'res_id' : meeting.id,
+ 'event_date' : meeting.date,
+ 'res_id' : meeting.id,
'model_id' : model_id,
- 'user_id' : uid
- }
+ 'user_id' : uid
+ }
alarm_id = alarm_obj.create(cr, uid, vals)
cr.execute('Update crm_meeting set caldav_alarm_id=%s where id=%s' % (alarm_id, meeting.id))
cr.commit()
- return True
-
+ return True
+
def do_alarm_unlink(self, cr, uid, ids, context={}):
alarm_obj = self.pool.get('calendar.alarm')
model_obj = self.pool.get('ir.model')
@@ -212,7 +212,7 @@ class crm_meeting(osv.osv):
crm_alarm = self.pool.get('calendar.alarm')
alarm_obj.__attribute__.update(crm_alarm.__attribute__)
vals = event_obj.import_ical(cr, uid, file_content)
- for val in vals:
+ for val in vals:
is_exists = common.uid2openobjectid(cr, val['id'], self._name)
if val.has_key('create_date'): val.pop('create_date')
val['caldav_url'] = context.get('url') or ''
@@ -271,14 +271,14 @@ class crm_meeting(osv.osv):
value = until_date
new_rule = '%s=%s' % (name, value)
new_rrule_str.append(new_rule)
- if not is_until and until_date:
+ if not is_until and until_date:
until_date = until_date.strftime("%Y%m%d%H%M%S")
value = until_date
name = "UNTIL"
new_rule = '%s=%s' % (name, value)
new_rrule_str.append(new_rule)
new_rrule_str = ';'.join(new_rrule_str)
- start_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S")
+ start_date = datetime.datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S")
rdates = event_obj.get_recurrent_dates(str(new_rrule_str), exdate, start_date)
for rdate in rdates:
idval = common.real_id2caldav_id(data['id'], rdate)
@@ -287,7 +287,7 @@ class crm_meeting(osv.osv):
ids = result
return ids
- def search(self, cr, uid, args, offset=0, limit=100, order=None,
+ def search(self, cr, uid, args, offset=0, limit=100, order=None,
context=None, count=False):
args_without_date = []
start_date = False
@@ -301,7 +301,7 @@ class crm_meeting(osv.osv):
elif arg[1] in ('<', '<='):
until_date = arg[2]
- res = super(crm_meeting, self).search(cr, uid, args_without_date, offset,
+ res = super(crm_meeting, self).search(cr, uid, args_without_date, offset,
limit, order, context, count)
return self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit)
@@ -405,18 +405,18 @@ class crm_meeting(osv.osv):
if isinstance(ids, (str, int, long)) and isinstance(res, list):
return res and res[0] or False
return res
-
+
def onchange_rrule_type(self, cr, uid, ids, type, *args, **argv):
if type == 'none':
- return {'value': {'rrule': ''}}
+ return {'value': {'rrule': ''}}
if type == 'custom':
return {}
rrule = self.pool.get('caldav.set.rrule')
rrulestr = rrule.compute_rule_string(cr, uid, {'freq': type.upper(),\
'interval': 1})
- return {'value': {'rrule': rrulestr}}
-
-
+ return {'value': {'rrule': rrulestr}}
+
+
def onchange_case_id(self, cr, uid, ids, *args, **argv):
return self._map_ids('onchange_case_id', cr, uid, ids, *args, **argv)
def onchange_partner_id(self, cr, uid, ids, *args, **argv):
@@ -438,12 +438,12 @@ class crm_meeting(osv.osv):
mailgate_obj = self.pool.get('mail.gateway')
msg_body = mailgate_obj.msg_body_get(msg)
data = {
- 'name': msg['Subject'],
- 'email_from': msg['From'],
- 'email_cc': msg['Cc'],
- 'user_id': False,
- 'description': msg_body['body'],
- 'history_line': [(0, 0, {'description': msg_body['body'], 'email': msg['From'] })],
+ 'name': msg['Subject'],
+ 'email_from': msg['From'],
+ 'email_cc': msg['Cc'],
+ 'user_id': False,
+ 'description': msg_body['body'],
+ 'history_line': [(0, 0, {'description': msg_body['body'], 'email': msg['From'] })],
}
res = mailgate_obj.partner_get(cr, uid, msg['From'])
if res:
@@ -465,8 +465,8 @@ class crm_meeting_generic_wizard(osv.osv_memory):
_name = 'crm.meeting.generic_wizard'
_columns = {
- 'section_id': fields.many2one('crm.case.section', 'Section', required=True),
- 'user_id': fields.many2one('res.users', 'Responsible'),
+ 'section_id': fields.many2one('crm.case.section', 'Section', required=False),
+ 'user_id': fields.many2one('res.users', 'Responsible'),
}
def _get_default_section(self, cr, uid, context):
@@ -492,8 +492,8 @@ class crm_meeting_generic_wizard(osv.osv_memory):
raise osv.except_osv(_('Error !'), _('You can not assign Closed Case.'))
new_case_id = case_obj.copy(cr, uid, case_id, default=
{
- 'section_id': res.get('section_id', False),
- 'user_id': res.get('user_id', False),
+ 'section_id': res.get('section_id', False),
+ 'user_id': res.get('user_id', False),
'case_id': case.inherit_case_id.id
}, context=context)
case_obj.case_close(cr, uid, [case_id])
@@ -502,11 +502,11 @@ class crm_meeting_generic_wizard(osv.osv_memory):
search_view = data_obj.read(cr, uid, result, ['res_id'])
new_case = case_obj.read(cr, uid, new_case_id, ['id'])
value = {
- 'name': _('Meetings'),
- 'view_type': 'form',
- 'view_mode': 'calendar, tree, form',
- 'res_model': 'crm.meeting',
- 'type': 'ir.actions.act_window',
+ 'name': _('Meetings'),
+ 'view_type': 'form',
+ 'view_mode': 'calendar, tree, form',
+ 'res_model': 'crm.meeting',
+ 'type': 'ir.actions.act_window',
'search_view_id': search_view['res_id']
}
return value
@@ -515,7 +515,7 @@ crm_meeting_generic_wizard()
class res_users(osv.osv):
_inherit = 'res.users'
-
+
def _get_user_avail(self, cr, uid, ids, name, args, context=None):
res={}
if not context or not context.get('model'):
@@ -533,7 +533,7 @@ class res_users(osv.osv):
+ c.duration * interval '1 hour') as end \
from crm_meeting m \
join crm_case c on (c.id=m.inherit_case_id)\
- where c.user_id = %s
+ where c.user_id = %s
and m.id not in (""" % (datas['id']) + str(context['active_id']) +")")
dates = cr.dictfetchall()
overlaps = False
@@ -546,11 +546,11 @@ class res_users(osv.osv):
over = cr.fetchone()[0]
if over:
overlaps = True
-
+
# check for attendee added already
cr.execute("""select att.user_id , c.id
- from calendar_attendee att
- inner join crm_attendee_rel rel on (rel.attendee_id=att.id)
+ from calendar_attendee att
+ inner join crm_attendee_rel rel on (rel.attendee_id=att.id)
join crm_meeting m on (rel.case_id=m.id)
join crm_case c on (m.inherit_case_id = c.id )
where (c.date, c.date::timestamp + c.duration * interval '1 hour') overlaps\
@@ -563,7 +563,7 @@ class res_users(osv.osv):
else:
res[id] = 'free'
return res
-
+
_columns = {
'availability': fields.function(_get_user_avail, type='selection', \
selection=[('free', 'Free'), ('busy', 'Busy')], \
diff --git a/addons/crm/crm_phonecall.py b/addons/crm/crm_phonecall.py
index 40527dcb017..c2bbf77e19f 100644
--- a/addons/crm/crm_phonecall.py
+++ b/addons/crm/crm_phonecall.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@@ -34,16 +34,16 @@ class crm_phonecall(osv.osv):
_name = "crm.phonecall"
_description = "Phonecall Cases"
_order = "id desc"
- _inherits = {'crm.case':"inherit_case_id"}
- _columns = {
+ _inherits = {'crm.case':"inherit_case_id"}
+ _columns = {
'inherit_case_id': fields.many2one('crm.case','Case',ondelete='cascade'),
}
-
+
def _map_ids(self, method, cr, uid, ids, *args, **argv):
if isinstance(ids, (str, int, long)):
select = [ids]
else:
- select = ids
+ select = ids
case_data = self.browse(cr, uid, select)
new_ids = []
for case in case_data:
@@ -64,25 +64,25 @@ class crm_phonecall(osv.osv):
def onchange_categ_id(self, cr, uid, ids, *args, **argv):
return self._map_ids('onchange_categ_id',cr,uid,ids,*args,**argv)
def case_close(self,cr, uid, ids, *args, **argv):
- return self._map_ids('case_close',cr,uid,ids,*args,**argv)
+ return self._map_ids('case_close',cr,uid,ids,*args,**argv)
def case_open(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_open',cr,uid,ids,*args,**argv)
def case_cancel(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_cancel',cr,uid,ids,*args,**argv)
def case_reset(self,cr, uid, ids, *args, **argv):
- return self._map_ids('case_reset',cr,uid,ids,*args,**argv)
- def case_escalate(self,cr, uid, ids, *args, **argv):
- return self._map_ids('case_escalate',cr,uid,ids,*args,**argv)
- def case_pending(self,cr, uid, ids, *args, **argv):
+ return self._map_ids('case_reset',cr,uid,ids,*args,**argv)
+ def case_escalate(self,cr, uid, ids, *args, **argv):
+ return self._map_ids('case_escalate',cr,uid,ids,*args,**argv)
+ def case_pending(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_pending',cr,uid,ids,*args,**argv)
- def msg_new(self, cr, uid, msg):
+ def msg_new(self, cr, uid, msg):
mailgate_obj = self.pool.get('mail.gateway')
msg_body = mailgate_obj.msg_body_get(msg)
data = {
- 'name': msg['Subject'],
+ 'name': msg['Subject'],
'email_from': msg['From'],
- 'email_cc': msg['Cc'],
+ 'email_cc': msg['Cc'],
'user_id': False,
'description': msg_body['body'],
'history_line': [(0, 0, {'description': msg_body['body'], 'email': msg['From'] })],
@@ -90,16 +90,16 @@ class crm_phonecall(osv.osv):
res = mailgate_obj.partner_get(cr, uid, msg['From'])
if res:
data.update(res)
- res = self.create(cr, uid, data)
+ res = self.create(cr, uid, data)
return res
def msg_update(self, cr, uid, ids, *args, **argv):
return self._map_ids('msg_update',cr, uid, ids, *args, **argv)
def emails_get(self, cr, uid, ids, *args, **argv):
return self._map_ids('emails_get',cr, uid, ids, *args, **argv)
- def msg_send(self, cr, uid, ids, *args, **argv):
- return self._map_ids('msg_send',cr, uid, ids, *args, **argv)
-
+ def msg_send(self, cr, uid, ids, *args, **argv):
+ return self._map_ids('msg_send',cr, uid, ids, *args, **argv)
+
crm_phonecall()
@@ -107,7 +107,7 @@ class crm_phonecall_assign_wizard(osv.osv_memory):
_name = 'crm.phonecall.assign_wizard'
_columns = {
- 'section_id': fields.many2one('crm.case.section', 'Section', required=True),
+ 'section_id': fields.many2one('crm.case.section', 'Section', required=False),
'user_id': fields.many2one('res.users', 'Responsible'),
}
@@ -137,17 +137,17 @@ class crm_phonecall_assign_wizard(osv.osv_memory):
'section_id':res.get('section_id',False),
'user_id':res.get('user_id',False),
'case_id' : case.inherit_case_id.id
- }, context=context)
+ }, context=context)
case_obj.case_close(cr, uid, [case_id])
data_obj = self.pool.get('ir.model.data')
result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_phonecalls_filter')
search_view = data_obj.read(cr, uid, result, ['res_id'])
- value = {
+ value = {
'name': _('Phone Calls'),
'view_type': 'form',
'view_mode': 'form,tree',
'res_model': 'crm.phonecall',
- 'res_id': int(new_case_id),
+ 'res_id': int(new_case_id),
'type': 'ir.actions.act_window',
'search_view_id': search_view['res_id']
}
diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml
index 2ad03e93263..4a5016108ac 100644
--- a/addons/crm/crm_view.xml
+++ b/addons/crm/crm_view.xml
@@ -3,7 +3,7 @@
<data>
<menuitem icon="terp-crm" id="menu_crm" name="CRM &amp; SRM"/>
<menuitem id="menu_crm_configuration" name="Configuration" parent="crm.menu_crm" sequence="0"/>
-
+
<wizard id="wizard_crm_send_mail" model="crm.case.history" name="crm.send.mail" string="Send Mail" menu="False"/>
<wizard id="wizard_crm_new_send_mail" model="crm.case" name="crm.new.send.mail" string="Send New Mail" menu="False"/>
@@ -42,7 +42,7 @@
<field name="allow_unlink" select="2"/>
<field name="calendar" select="2"/>
</group>
- <field name="reply_to" select="2"/>
+ <field name="reply_to" select="2"/>
</page>
</notebook>
</form>
@@ -78,7 +78,7 @@
<field name="view_type">tree</field>
<field name="view_id" ref="crm_case_section_view_tree"/>
</record>
- <menuitem action="crm_case_section_act_tree" id="menu_crm_case_section_act_tree" parent="next_id_52"/>
+ <menuitem action="crm_case_section_act_tree" id="menu_crm_case_section_act_tree" parent="next_id_52"/>
<!-- Case Categories -->
<record id="crm_case_categ-view" model="ir.ui.view">
@@ -624,5 +624,31 @@
<act_window domain="[('user_id', '=', active_id),('state','&lt;&gt;','done'),('state','&lt;&gt;','cancel'),('state','&lt;&gt;','pending')]" id="act_res_users_2_crm_case_opened" name="Open cases" res_model="crm.case" src_model="res.users" view_mode="tree,form,calendar" view_type="form"/>
+
+ <record model="ir.ui.view" id="view_users_form_simple_modif_inherited1">
+ <field name="name">view.users.form.crm.modif.inherited1</field>
+ <field name="model">res.users</field>
+ <field name="inherit_id" ref="base.view_users_form_simple_modif" />
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <page string="Current Activity" position="inside">
+ <field name="section_id" widget="selection"/>
+ </page>
+ </field>
+ </record>
+
+ <record id="view_users_form_simple_modif_inherited2" model="ir.ui.view">
+ <field name="name">view.users.form.crm.modif.inherited2</field>
+ <field name="model">res.users</field>
+ <field name="type">form</field>
+ <field name="inherit_id" ref="base.view_users_form"/>
+ <field eval="18" name="priority"/>
+ <field name="arch" type="xml">
+ <field name="password" position="after">
+ <field name="section_id" widget="selection" />
+ </field>
+ </field>
+ </record>
+
</data>
</openerp>
diff --git a/addons/crm/security/crm_security.xml b/addons/crm/security/crm_security.xml
index a097147fec2..73951681fb7 100644
--- a/addons/crm/security/crm_security.xml
+++ b/addons/crm/security/crm_security.xml
@@ -18,5 +18,130 @@
<field name="groups_id" eval="[(6,0,[ref('group_crm_manager')])]"/>
</record>
+ <!--rule for meeting-->
+ <record model="ir.rule.group" id="crm_meeting_rule_group">
+ <field name="name">crm.meeting.rule</field>
+ <field name="model_id" search="[('model','=','crm.meeting')]" model="ir.model"/>
+ <field name="global" eval="True"/>
+ </record>
+ <record id="crm_meeting_rule" model="ir.rule">
+ <field model="ir.model.fields" name="field_id" search="[('model','=','crm.case'),('name','=','section_id')]"/>
+ <field name="operator">=</field>
+ <field name="operand">user.section_id.id</field>
+ <field name="domain_force">['|',('section_id','=',False),('section_id','=',[user.section_id.id])]</field>
+ <field name="rule_group" ref="crm_meeting_rule_group"/>
+ </record>
+
+ <!--rule for Claims-->
+ <record model="ir.rule.group" id="crm_claim_rule_group">
+ <field name="name">crm.claim.rule</field>
+ <field name="model_id" search="[('model','=','crm.claim')]" model="ir.model"/>
+ <field name="global" eval="True"/>
+ </record>
+ <record id="crm_claim_rule" model="ir.rule">
+ <field model="ir.model.fields" name="field_id" search="[('model','=','crm.case'),('name','=','section_id')]"/>
+ <field name="operator">=</field>
+ <field name="operand">user.section_id.id</field>
+ <field name="domain_force">['|',('section_id','=',False),('section_id','=',[user.section_id.id])]</field>
+ <field name="rule_group" ref="crm_claim_rule_group"/>
+ </record>
+
+ <!--rule for Fund Raising-->
+ <record model="ir.rule.group" id="crm_fundraising_rule_group">
+ <field name="name">crm.fundraising.rule</field>
+ <field name="model_id" search="[('model','=','crm.fundraising')]" model="ir.model"/>
+ <field name="global" eval="True"/>
+ </record>
+ <record id="crm_fundraising_rule" model="ir.rule">
+ <field model="ir.model.fields" name="field_id" search="[('model','=','crm.case'),('name','=','section_id')]"/>
+ <field name="operator">=</field>
+ <field name="operand">user.section_id.id</field>
+ <field name="domain_force">['|',('section_id','=',False),('section_id','=',[user.section_id.id])]</field>
+ <field name="rule_group" ref="crm_fundraising_rule_group"/>
+ </record>
+
+ <!--rule for HelpDesk-->
+ <record model="ir.rule.group" id="crm_helpdesk_rule_group">
+ <field name="name">crm.helpdesk.rule</field>
+ <field name="model_id" search="[('model','=','crm.helpdesk')]" model="ir.model"/>
+ <field name="global" eval="True"/>
+ </record>
+ <record id="crm_helpdesk_rule" model="ir.rule">
+ <field model="ir.model.fields" name="field_id" search="[('model','=','crm.case'),('name','=','section_id')]"/>
+ <field name="operator">=</field>
+ <field name="operand">user.section_id.id</field>
+ <field name="domain_force">['|',('section_id','=',False),('section_id','=',[user.section_id.id])]</field>
+ <field name="rule_group" ref="crm_helpdesk_rule_group"/>
+ </record>
+
+ <!--rule for Jobs-->
+ <record model="ir.rule.group" id="crm_job_rule_group">
+ <field name="name">crm.meeting.rule</field>
+ <field name="model_id" search="[('model','=','crm.job')]" model="ir.model"/>
+ <field name="global" eval="True"/>
+ </record>
+ <record id="crm_job_rule" model="ir.rule">
+ <field model="ir.model.fields" name="field_id" search="[('model','=','crm.case'),('name','=','section_id')]"/>
+ <field name="operator">=</field>
+ <field name="operand">user.section_id.id</field>
+ <field name="domain_force">['|',('section_id','=',False),('section_id','=',[user.section_id.id])]</field>
+ <field name="rule_group" ref="crm_job_rule_group"/>
+ </record>
+
+ <!--rule for leads-->
+ <record model="ir.rule.group" id="crm_leads_rule_group">
+ <field name="name">crm.leads.rule</field>
+ <field name="model_id" search="[('model','=','crm.lead')]" model="ir.model"/>
+ <field name="global" eval="True"/>
+ </record>
+ <record id="crm_leads_rule" model="ir.rule">
+ <field model="ir.model.fields" name="field_id" search="[('model','=','crm.case'),('name','=','section_id')]"/>
+ <field name="operator">=</field>
+ <field name="operand">user.section_id.id</field>
+ <field name="domain_force">['|',('section_id','=',False),('section_id','=',[user.section_id.id])]</field>
+ <field name="rule_group" ref="crm_leads_rule_group"/>
+ </record>
+
+ <!--rule for business opportunities-->
+ <record model="ir.rule.group" id="crm_opportunities_rule_group">
+ <field name="name">crm.opportunities.rule</field>
+ <field name="model_id" search="[('model','=','crm.opportunity')]" model="ir.model"/>
+ <field name="global" eval="True"/>
+ </record>
+ <record id="crm_opportunities_rule" model="ir.rule">
+ <field model="ir.model.fields" name="field_id" search="[('model','=','crm.case'),('name','=','section_id')]"/>
+ <field name="operator">=</field>
+ <field name="operand">user.section_id.id</field>
+ <field name="domain_force">['|',('section_id','=',False),('section_id','=',[user.section_id.id])]</field>
+ <field name="rule_group" ref="crm_opportunities_rule_group"/>
+ </record>
+
+ <!--rule for phone calls-->
+ <record model="ir.rule.group" id="crm_phone_calls_rule_group">
+ <field name="name">crm.phone.calls.rule</field>
+ <field name="model_id" search="[('model','=','crm.phonecall')]" model="ir.model"/>
+ <field name="global" eval="True"/>
+ </record>
+ <record id="crm_phone_calls_rule" model="ir.rule">
+ <field model="ir.model.fields" name="field_id" search="[('model','=','crm.case'),('name','=','section_id')]"/>
+ <field name="operator">=</field>
+ <field name="operand">user.section_id.id</field>
+ <field name="domain_force">['|',('section_id','=',False),('section_id','=',[user.section_id.id])]</field>
+ <field name="rule_group" ref="crm_phone_calls_rule_group"/>
+ </record>
+
+ <!--rule for cases-->
+ <record model="ir.rule.group" id="crm_case_rule_group">
+ <field name="name">crm.case.rule</field>
+ <field name="model_id" search="[('model','=','crm.case')]" model="ir.model"/>
+ <field name="global" eval="True"/>
+ </record>
+ <record id="crm_case_rule" model="ir.rule">
+ <field model="ir.model.fields" name="field_id" search="[('model','=','crm.case'),('name','=','section_id')]"/>
+ <field name="operator">=</field>
+ <field name="operand">user.section_id.id</field>
+ <field name="domain_force">['|',('section_id','=',False),('section_id','=',[user.section_id.id])]</field>
+ <field name="rule_group" ref="crm_case_rule_group"/>
+ </record>
</data>
</openerp>
diff --git a/addons/crm_project/__terp__.py b/addons/crm_project/__terp__.py
index 0d4c71a548d..e4c0ef2adcc 100644
--- a/addons/crm_project/__terp__.py
+++ b/addons/crm_project/__terp__.py
@@ -39,6 +39,7 @@
'crm_bugs_menu.xml',
'crm_feature_view.xml',
'crm_feature_menu.xml',
+ 'security/crm_project_security.xml'
],
'demo_xml': ['crm_bugs_demo.xml'],
'installable': True,
diff --git a/addons/crm_project/crm_project_bug.py b/addons/crm_project/crm_project_bug.py
index 997980181c0..ecc1167372a 100644
--- a/addons/crm_project/crm_project_bug.py
+++ b/addons/crm_project/crm_project_bug.py
@@ -36,17 +36,24 @@ class crm_project_bug(osv.osv):
_name = "crm.project.bug"
_description = "Project Bug Cases"
_order = "id desc"
- _inherits = {'crm.case':"inherit_case_id"}
- _columns = {
+ _inherits = {'crm.case':"inherit_case_id"}
+ _columns = {
'inherit_case_id':fields.many2one('crm.case','Case'),
'project_id':fields.many2one('project.project', 'Project'),
}
-
+
+ def _get_project(self, cr, uid, context):
+ user = self.pool.get('res.users').browse(cr, uid, uid)
+ return user.project_id.id
+
+ _defaults = {
+ 'project_id':_get_project
+ }
def _map_ids(self, method, cr, uid, ids, *args, **argv):
if isinstance(ids, (str, int, long)):
select = [ids]
else:
- select = ids
+ select = ids
case_data = self.browse(cr, uid, select)
new_ids = []
for case in case_data:
@@ -69,25 +76,25 @@ class crm_project_bug(osv.osv):
def onchange_categ_id(self, cr, uid, ids, *args, **argv):
return self._map_ids('onchange_categ_id',cr,uid,ids,*args,**argv)
def case_close(self,cr, uid, ids, *args, **argv):
- return self._map_ids('case_close',cr,uid,ids,*args,**argv)
+ return self._map_ids('case_close',cr,uid,ids,*args,**argv)
def case_open(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_open',cr,uid,ids,*args,**argv)
def case_cancel(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_cancel',cr,uid,ids,*args,**argv)
def case_reset(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_reset',cr,uid,ids,*args,**argv)
- def case_escalate(self,cr, uid, ids, *args, **argv):
- return self._map_ids('case_escalate',cr,uid,ids,*args,**argv)
- def case_pending(self,cr, uid, ids, *args, **argv):
+ def case_escalate(self,cr, uid, ids, *args, **argv):
+ return self._map_ids('case_escalate',cr,uid,ids,*args,**argv)
+ def case_pending(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_pending',cr,uid,ids,*args,**argv)
- def msg_new(self, cr, uid, msg):
+ def msg_new(self, cr, uid, msg):
mailgate_obj = self.pool.get('mail.gateway')
msg_body = mailgate_obj.msg_body_get(msg)
data = {
- 'name': msg['Subject'],
+ 'name': msg['Subject'],
'email_from': msg['From'],
- 'email_cc': msg['Cc'],
+ 'email_cc': msg['Cc'],
'user_id': False,
'description': msg_body['body'],
'history_line': [(0, 0, {'description': msg_body['body'], 'email': msg['From'] })],
@@ -95,16 +102,16 @@ class crm_project_bug(osv.osv):
res = mailgate_obj.partner_get(cr, uid, msg['From'])
if res:
data.update(res)
- res = self.create(cr, uid, data)
+ res = self.create(cr, uid, data)
return res
def msg_update(self, cr, uid, ids, *args, **argv):
return self._map_ids('msg_update',cr, uid, ids, *args, **argv)
def emails_get(self, cr, uid, ids, *args, **argv):
return self._map_ids('emails_get',cr, uid, ids, *args, **argv)
- def msg_send(self, cr, uid, ids, *args, **argv):
- return self._map_ids('msg_send',cr, uid, ids, *args, **argv)
-
+ def msg_send(self, cr, uid, ids, *args, **argv):
+ return self._map_ids('msg_send',cr, uid, ids, *args, **argv)
+
crm_project_bug()
@@ -143,20 +150,20 @@ class crm_bug_assign_wizard(osv.osv_memory):
'section_id':res.get('section_id',False),
'user_id':res.get('user_id',False),
'case_id' : case.inherit_case_id.id
- }, context=context)
+ }, context=context)
case_obj.case_close(cr, uid, [case_id])
data_obj = self.pool.get('ir.model.data')
result = data_obj._get_id(cr, uid, 'crm_project', 'view_crm_case_bugs_filter')
search_view = data_obj.read(cr, uid, result, ['res_id'])
- value = {
+ value = {
'name': _('Bugs'),
'view_type': 'form',
'view_mode': 'form,tree',
'res_model': 'crm.project.bug',
- 'res_id': int(new_case_id),
- 'type': 'ir.actions.act_window',
- 'search_view_id': search_view['res_id']
+ 'res_id': int(new_case_id),
+ 'type': 'ir.actions.act_window',
+ 'search_view_id': search_view['res_id']
}
return value
diff --git a/addons/crm_project/crm_project_feature.py b/addons/crm_project/crm_project_feature.py
index c0333c8a921..dbf04814057 100644
--- a/addons/crm_project/crm_project_feature.py
+++ b/addons/crm_project/crm_project_feature.py
@@ -36,17 +36,22 @@ class crm_project_future_request(osv.osv):
_name = "crm.project.future"
_description = "Project Future Request"
_order = "id desc"
- _inherits = {'crm.case':"inherit_case_id"}
- _columns = {
+ _inherits = {'crm.case':"inherit_case_id"}
+ _columns = {
'inherit_case_id':fields.many2one('crm.case','Case'),
'project_id':fields.many2one('project.project', 'Project'),
}
-
+ def _get_project(self, cr, uid, context):
+ user = self.pool.get('res.users').browse(cr,uid,uid)
+ return user.project_id.id
+ _defaults = {
+ 'project_id':_get_project
+ }
def _map_ids(self, method, cr, uid, ids, *args, **argv):
if isinstance(ids, (str, int, long)):
select = [ids]
else:
- select = ids
+ select = ids
case_data = self.browse(cr, uid, select)
new_ids = []
for case in case_data:
@@ -69,25 +74,25 @@ class crm_project_future_request(osv.osv):
def onchange_categ_id(self, cr, uid, ids, *args, **argv):
return self._map_ids('onchange_categ_id',cr,uid,ids,*args,**argv)
def case_close(self,cr, uid, ids, *args, **argv):
- return self._map_ids('case_close',cr,uid,ids,*args,**argv)
+ return self._map_ids('case_close',cr,uid,ids,*args,**argv)
def case_open(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_open',cr,uid,ids,*args,**argv)
def case_cancel(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_cancel',cr,uid,ids,*args,**argv)
def case_reset(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_reset',cr,uid,ids,*args,**argv)
- def case_escalate(self,cr, uid, ids, *args, **argv):
- return self._map_ids('case_escalate',cr,uid,ids,*args,**argv)
- def case_pending(self,cr, uid, ids, *args, **argv):
+ def case_escalate(self,cr, uid, ids, *args, **argv):
+ return self._map_ids('case_escalate',cr,uid,ids,*args,**argv)
+ def case_pending(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_pending',cr,uid,ids,*args,**argv)
- def msg_new(self, cr, uid, msg):
+ def msg_new(self, cr, uid, msg):
mailgate_obj = self.pool.get('mail.gateway')
msg_body = mailgate_obj.msg_body_get(msg)
data = {
- 'name': msg['Subject'],
+ 'name': msg['Subject'],
'email_from': msg['From'],
- 'email_cc': msg['Cc'],
+ 'email_cc': msg['Cc'],
'user_id': False,
'description': msg_body['body'],
'history_line': [(0, 0, {'description': msg_body['body'], 'email': msg['From'] })],
@@ -95,15 +100,15 @@ class crm_project_future_request(osv.osv):
res = mailgate_obj.partner_get(cr, uid, msg['From'])
if res:
data.update(res)
- res = self.create(cr, uid, data)
+ res = self.create(cr, uid, data)
return res
def msg_update(self, cr, uid, ids, *args, **argv):
return self._map_ids('msg_update',cr, uid, ids, *args, **argv)
def emails_get(self, cr, uid, ids, *args, **argv):
return self._map_ids('emails_get',cr, uid, ids, *args, **argv)
- def msg_send(self, cr, uid, ids, *args, **argv):
- return self._map_ids('msg_send',cr, uid, ids, *args, **argv)
+ def msg_send(self, cr, uid, ids, *args, **argv):
+ return self._map_ids('msg_send',cr, uid, ids, *args, **argv)
crm_project_future_request()
@@ -142,20 +147,20 @@ class crm_future_request_assign_wizard(osv.osv_memory):
'section_id':res.get('section_id',False),
'user_id':res.get('user_id',False),
'case_id' : case.inherit_case_id.id
- }, context=context)
+ }, context=context)
case_obj.case_close(cr, uid, [case_id])
data_obj = self.pool.get('ir.model.data')
result = data_obj._get_id(cr, uid, 'crm_project', 'view_crm_case_future_filter')
search_view = data_obj.read(cr, uid, result, ['res_id'])
- value = {
+ value = {
'name': _('Future Requests'),
'view_type': 'form',
'view_mode': 'form,tree',
'res_model': 'crm.project.future',
- 'res_id': int(new_case_id),
- 'type': 'ir.actions.act_window',
- 'search_view_id': search_view['res_id']
+ 'res_id': int(new_case_id),
+ 'type': 'ir.actions.act_window',
+ 'search_view_id': search_view['res_id']
}
return value
diff --git a/addons/crm_project/security/crm_project_security.xml b/addons/crm_project/security/crm_project_security.xml
new file mode 100644
index 00000000000..85ff137e177
--- /dev/null
+++ b/addons/crm_project/security/crm_project_security.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data noupdate="1">
+
+
+
+ <record model="ir.rule.group" id="crm_project_bug_rule_group">
+ <field name="name">crm.project.bug.rule.group</field>
+ <field name="model_id" search="[('model','=','crm.project.bug')]" model="ir.model"/>
+ <field name="global" eval="True"/>
+ </record>
+ <record id="crm_project_bug_rule" model="ir.rule">
+ <field model="ir.model.fields" name="field_id" search="[('model','=','crm.project.bug'),('name','=','project_id')]"/>
+ <field name="operator">=</field>
+ <field name="operand">user.project_id.id</field>
+ <field name="domain_force">['|',('project_id','=',False),('project_id','=',[user.project_id.id])]</field>
+ <field name="rule_group" ref="crm_project_bug_rule_group"/>
+ </record>
+
+ <record model="ir.rule.group" id="crm_project_feature_rule_group">
+ <field name="name">crm.project.feature.rule.group</field>
+ <field name="model_id" search="[('model','=','crm.project.future')]" model="ir.model"/>
+ <field name="global" eval="True"/>
+ </record>
+ <record id="crm_project_feature_rule" model="ir.rule">
+ <field model="ir.model.fields" name="field_id" search="[('model','=','crm.project.future'),('name','=','project_id')]"/>
+ <field name="operator">=</field>
+ <field name="operand">user.project_id.id</field>
+ <field name="domain_force">['|',('project_id','=',False),('project_id','=',[user.project_id.id])]</field>
+ <field name="rule_group" ref="crm_project_feature_rule_group"/>
+ </record>
+
+ </data>
+</openerp>
diff --git a/addons/project/project.py b/addons/project/project.py
index d47f92dbb42..4567ba1c4b0 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@@ -61,7 +61,7 @@ class project(osv.osv):
cr.execute('''SELECT
project_id, sum(planned_hours), sum(total_hours), sum(effective_hours)
FROM
- project_task
+ project_task
WHERE
project_id in ('''+','.join(map(str,ids2))+''') AND
state<>'cancelled'
@@ -137,7 +137,7 @@ class project(osv.osv):
# toggle activity of projects, their sub projects and their tasks
def set_template(self, cr, uid, ids, context={}):
- res = self.setActive(cr, uid, ids, value=False, context=context)
+ res = self.setActive(cr, uid, ids, value=False, context=context)
return res
def set_done(self, cr, uid, ids, context={}):
@@ -192,17 +192,17 @@ class project(osv.osv):
raise osv.except_osv(_('Operation Done'), _('A new project has been created !\nWe suggest you to close this one and work on this new project.'))
# set active value for a project, its sub projects and its tasks
- def setActive(self, cr, uid, ids, value=True, context={}):
- for proj in self.browse(cr, uid, ids, context):
+ def setActive(self, cr, uid, ids, value=True, context={}):
+ for proj in self.browse(cr, uid, ids, context):
self.write(cr, uid, [proj.id], {'state': value and 'open' or 'template'}, context)
cr.execute('select id from project_task where project_id=%s', (proj.id,))
tasks_id = [x[0] for x in cr.fetchall()]
if tasks_id:
self.pool.get('project.task').write(cr, uid, tasks_id, {'active': value}, context)
- cr.execute('select id from project_project where parent_id=%s', (proj.id,))
- project_ids = [x[0] for x in cr.fetchall()]
+ cr.execute('select id from project_project where parent_id=%s', (proj.id,))
+ project_ids = [x[0] for x in cr.fetchall()]
for child in project_ids:
- self.setActive(cr, uid, [child], value, context)
+ self.setActive(cr, uid, [child], value, context)
return True
project()
@@ -269,7 +269,7 @@ 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 copy_data(self, cr, uid, id, default={},context={}):
default = default or {}
default['work_ids'] = []
@@ -318,7 +318,7 @@ class task(osv.osv):
'active': lambda *a: True,
'date_start': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'project_id': _default_project,
- 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'project.task', context=c)
+ 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'project.task', context=c)
}
_order = "sequence, priority, date_deadline, id"
@@ -335,22 +335,22 @@ class task(osv.osv):
return res
eview = etree.fromstring(res['arch'])
-
+
def _check_rec(eview):
if eview.attrib.get('widget','') == 'float_time':
eview.set('widget','float')
for child in eview:
_check_rec(child)
return True
-
+
_check_rec(eview)
-
+
res['arch'] = etree.tostring(eview)
-
+
for f in res['fields']:
if 'Hours' in res['fields'][f]['string']:
res['fields'][f]['string'] = res['fields'][f]['string'].replace('Hours',tm)
-
+
return res
def do_close(self, cr, uid, ids, *args):
@@ -485,7 +485,7 @@ class config_compute_remaining(osv.osv_memory):
_defaults = {
'remaining_hours': _get_remaining
}
-
+
def compute_hours(self, cr, uid, ids, context=None):
if 'active_id' in context:
remaining_hrs=self.browse(cr,uid,ids)[0].remaining_hours
@@ -495,5 +495,24 @@ class config_compute_remaining(osv.osv_memory):
}
config_compute_remaining()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+class message(osv.osv):
+ _name = "project.message"
+ _description = "Message"
+ _columns = {
+ 'subject': fields.char('Subject', size=128),
+ 'description': fields.char('Description', size =128),
+ 'project_id': fields.many2one('project.project', 'Project', ondelete='cascade'),
+ 'date': fields.date('Date'),
+ 'user_id': fields.many2one('res.users', 'User'),
+ }
+message()
+class users(osv.osv):
+ _inherit = 'res.users'
+ _description ="User"
+ _columns = {
+ 'project_id': fields.many2one('project.project', 'Project'),
+ }
+
+users()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml
index d074da533bf..3b4eee97adc 100644
--- a/addons/project/project_view.xml
+++ b/addons/project/project_view.xml
@@ -484,7 +484,6 @@
<field name="view_mode">tree,form,calendar,gantt,graph</field>
<field eval="False" name="view_id"/>
<field eval="True" name="filter"/>
- <field name="search_view_id" ref="view_task_search_form"/>
</record>
<menuitem action="action_view_task" id="menu_action_view_task" parent="project.menu_tasks"/>
@@ -560,7 +559,7 @@
<field name="search_view_id" ref="view_task_search_form"/>
<field name="domain">[('state','=','open')]</field>
</record>
-
+menu_main
<record id="action_view_task7" model="ir.actions.act_window">
<field name="name">Unassigned Tasks</field>
<field name="res_model">project.task</field>
@@ -661,9 +660,80 @@
</field>
</record>
+
+ <!-- User Form-->
+ <record id="view_project_users_form_simple" model="ir.ui.view">
+ <field name="name">res.users.project.form1</field>
+ <field name="model">res.users</field>
+ <field name="type">form</field>
+ <field name="inherit_id" ref="base.view_users_form"/>
+ <field eval="18" name="priority"/>
+ <field name="arch" type="xml">
+ <field name="password" position="after">
+ <field name="project_id" widget="selection" />
+ </field>
+ </field>
+ </record>
+
+ <record model="ir.ui.view" id="view_users_form_project_modif_inherited1">
+ <field name="name">view.users.form.project.modif.inherited1</field>
+ <field name="model">res.users</field>
+ <field name="inherit_id" ref="base.view_users_form_simple_modif" />
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <page string="Current Activity" position="inside">
+ <field name="project_id" widget="selection"/>
+ </page>
+ </field>
+ </record>
+
+<!--- Messages-->
+ <record id="view_project_message_form" model="ir.ui.view">
+ <field name="name">project.message.form</field>
+ <field name="model">project.message</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Messages">
+ <group colspan="6">
+ <field name="subject" select="1"/>
+ <field name="description"/>
+ <field name="project_id" />
+ <field name="date" select="2"/>
+ <field name="user_id" select="1"/>
+ </group>
+ </form>
+ </field>
+ </record>
+
+ <record id="view_project_message_tree" model="ir.ui.view">
+ <field name="name">project.message.form</field>
+ <field name="model">project.message</field>
+ <field name="type">tree</field>
+ <field name="arch" type="xml">
+ <tree string="Messages">
+ <field name="subject" select="1"/>
+ <field name="description" select="1"/>
+ <field name="project_id" select="1"/>
+ <field name="date" select="1"/>
+ <field name="user_id" select="1"/>
+ </tree>
+ </field>
+ </record>
+
+ <record id="action_view_project_messages_tree" model="ir.actions.act_window">
+ <field name="name">Messages</field>
+ <field name="res_model">project.message</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,form</field>
+ <field name="view_id" ref="view_project_message_tree"/>
+ </record>
+
+ <menuitem id="menu_message_main" name="Message" parent="menu_main"/>
+ <menuitem action="action_view_project_messages_tree" id="menu_message_tree" parent="menu_message_main"/>
+
<act_window domain="[('user_id', '=', active_id),('state', '&lt;&gt;', 'cancelled'),('state', '&lt;&gt;', 'done')]" id="act_res_users_2_project_task_opened" name="Assigned tasks" res_model="project.task" src_model="res.users" view_mode="tree,form,gantt,calendar,graph" view_type="form"/>
<act_window domain="[('user_id', '=', active_id),('date', '&gt;=', 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>
+</openerp> \ No newline at end of file
diff --git a/addons/project/security/project_security.xml b/addons/project/security/project_security.xml
index 779ec43bc24..8c1be345402 100644
--- a/addons/project/security/project_security.xml
+++ b/addons/project/security/project_security.xml
@@ -36,5 +36,60 @@
<field name="rule_group" ref="task_comp_rule_group"/>
</record>
+
+ <!--rule for Tasks-->
+ <record model="ir.rule.group" id="project_task_rule_group">
+ <field name="name">project.task.rule.group</field>
+ <field name="model_id" search="[('model','=','project.task')]" model="ir.model"/>
+ <field name="global" eval="True"/>
+ </record>
+ <record id="project_task_rule" model="ir.rule">
+ <field model="ir.model.fields" name="field_id" search="[('model','=','project.task'),('name','=','project_id')]"/>
+ <field name="operator">=</field>
+ <field name="operand">user.project_id.id</field>
+ <field name="domain_force">['|',('project_id','=',False),('project_id','=',[user.project_id.id])]</field>
+ <field name="rule_group" ref="project_task_rule_group"/>
+ </record>
+
+ <record model="ir.rule.group" id="project_task_work_rule_group">
+ <field name="name">project.task.work.rule.group</field>
+ <field name="model_id" search="[('model','=','project.task.work')]" model="ir.model"/>
+ <field name="global" eval="True"/>
+ </record>
+ <record id="project_task_work_rule" model="ir.rule">
+ <field model="ir.model.fields" name="field_id" search="[('model','=','project.task.work'),('name','=','task_id.project_id')]"/>
+ <field name="operator">=</field>
+ <field name="operand">user.project_id.id</field>
+ <field name="domain_force">['|',('task_id.project_id','=',False),('task_id.project_id','=',[user.project_id.id])]</field>
+ <field name="rule_group" ref="project_task_work_rule_group"/>
+ </record>
+
+ <record model="ir.rule.group" id="project_project_rule_group">
+ <field name="name">project.project.work.rule.group</field>
+ <field name="model_id" search="[('model','=','project.project')]" model="ir.model"/>
+ <field name="global" eval="True"/>
+ </record>
+ <record id="project_project_rule" model="ir.rule">
+ <field model="ir.model.fields" name="field_id" search="[('model','=','project.project'),('name','=','id')]"/>
+ <field name="operator">=</field>
+ <field name="operand">user.project_id.id</field>
+ <field name="domain_force">['|',('id','=',False),('id','=',[user.project_id.id])]</field>
+ <field name="rule_group" ref="project_project_rule_group"/>
+ </record>
+
+ <record model="ir.rule.group" id="project_message_rule_group">
+ <field name="name">project.project.work.rule.group</field>
+ <field name="model_id" search="[('model','=','project.message')]" model="ir.model"/>
+ <field name="global" eval="True"/>
+ </record>
+ <record id="project_message_rule" model="ir.rule">
+ <field model="ir.model.fields" name="field_id" search="[('model','=','project.message'),('name','=','project_id')]"/>
+ <field name="operator">=</field>
+ <field name="operand">user.project_id.id</field>
+ <field name="domain_force">['|',('project_id','=',False),('project_id','=',[user.project_id.id])]</field>
+ <field name="rule_group" ref="project_message_rule_group"/>
+ </record>
+
+
</data>
</openerp>
diff --git a/addons/sale_crm/__terp__.py b/addons/sale_crm/__terp__.py
index 26b50e586e8..c1b59468ce5 100644
--- a/addons/sale_crm/__terp__.py
+++ b/addons/sale_crm/__terp__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@@ -38,7 +38,11 @@ crm modules.
'website': 'http://www.openerp.com',
'depends': ['sale', 'crm'],
'init_xml': [],
- 'update_xml': ['sale_crm_wizard.xml', 'sale_crm_view.xml', 'process/sale_crm_process.xml'],
+ 'update_xml': ['sale_crm_wizard.xml',
+ 'sale_crm_view.xml',
+ 'process/sale_crm_process.xml',
+ 'security/sale_crm_security.xml',
+ ],
'demo_xml': [],
'installable': True,
'active': False,
diff --git a/addons/sale_crm/sale_crm.py b/addons/sale_crm/sale_crm.py
index e01a9f192b9..5972d253025 100644
--- a/addons/sale_crm/sale_crm.py
+++ b/addons/sale_crm/sale_crm.py
@@ -23,10 +23,19 @@ from osv import osv,fields
class sale_order(osv.osv):
_inherit = 'sale.order'
+ _description = 'Sale orders'
_columns = {
'section_id': fields.many2one('crm.case.section', 'Section'),
- }
-sale_order()
+ }
+
+ def _get_section(self, cr, uid, context):
+ user = self.pool.get('res.users').browse(cr,uid,uid)
+ return user.section_id.id
+ _defaults = {
+ 'section_id':_get_section
+ }
+
+sale_order()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file
diff --git a/addons/sale_crm/sale_crm_view.xml b/addons/sale_crm/sale_crm_view.xml
index 1b611ca7414..a6f6868dc21 100644
--- a/addons/sale_crm/sale_crm_view.xml
+++ b/addons/sale_crm/sale_crm_view.xml
@@ -25,7 +25,7 @@
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="/form/notebook/page[@string='Other data']/field[@name='company_id']" position="after">
- <field name="section_id"/>
+ <field name="section_id" widget='selection'/>
</xpath>
</field>
</record>
diff --git a/addons/sale_crm/security/sale_crm_security.xml b/addons/sale_crm/security/sale_crm_security.xml
new file mode 100644
index 00000000000..8bcde374937
--- /dev/null
+++ b/addons/sale_crm/security/sale_crm_security.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data noupdate="0">
+
+ <record model="ir.rule.group" id="sale_order_crm_rule_group">
+ <field name="name">Sale Order sale_crm</field>
+ <field name="model_id" search="[('model','=','sale.order')]" model="ir.model"/>
+ <field name="global" eval="True"/>
+ </record>
+ <record model="ir.rule" id="sale_order_comp_rule">
+ <field name="field_id" search="[('model','=','sale.order'),('name','=','section_id')]" model="ir.model.fields"/>
+ <field name="operator">=</field>
+ <field name="operand">user.section_id.id</field>
+ <field name="rule_group" ref="sale_order_crm_rule_group"/>
+ <field name="domain_force">['|',('section_id','=',False),('section_id','=',[user.section_id.id])]</field>
+ </record>
+
+ <record model="ir.rule.group" id="sale_order_line_crm_rule_group">
+ <field name="name">Sale Order Line sale_crm</field>
+ <field name="model_id" search="[('model','=','sale.order.line')]" model="ir.model"/>
+ <field name="global" eval="True"/>
+ </record>
+ <record model="ir.rule" id="sale_order_line_comp_rule">
+ <field name="field_id" search="[('model','=','sale.order.line'),('name','=','order_id.section_id')]" model="ir.model.fields"/>
+ <field name="operator">=</field>
+ <field name="operand">user.section_id.id</field>
+ <field name="rule_group" ref="sale_order_line_crm_rule_group"/>
+ <field name="domain_force">['|',('order_id.section_id','=',False),('order_id.section_id','=',[user.section_id.id])]</field>
+ </record>
+
+</data>
+</openerp>