[MERGE] Sync with trunk.

bzr revid: tde@openerp.com-20121120090512-82lyg9jotfvlim0n
This commit is contained in:
Thibault Delavallée 2012-11-20 10:05:12 +01:00
commit b9c07b1019
10 changed files with 99 additions and 66 deletions

View File

@ -50,7 +50,7 @@ class crm_lead(base_stage, format_address, osv.osv):
def _get_default_stage_id(self, cr, uid, context=None):
""" Gives default stage_id """
section_id = self._get_default_section_id(cr, uid, context=context)
return self.stage_find(cr, uid, [], section_id, [('state', '=', 'draft'), ('type', '=', 'both')], context=context)
return self.stage_find(cr, uid, [], section_id, [('state', '=', 'draft')], context=context)
def _resolve_section_id_from_context(self, cr, uid, context=None):
""" Returns ID of section based on the value of 'section_id'
@ -224,11 +224,7 @@ class crm_lead(base_stage, format_address, osv.osv):
multi='day_close', type="float", store=True),
'state': fields.related('stage_id', 'state', type="selection", store=True,
selection=crm.AVAILABLE_STATES, string="Status", readonly=True,
help='The Status is set to \'Draft\', when a case is created.\
If the case is in progress the Status is set to \'Open\'.\
When the case is over, the Status is set to \'Done\'.\
If the case needs to be reviewed then the Status is \
set to \'Pending\'.'),
help='The Status is set to \'Draft\', when a case is created. If the case is in progress the Status is set to \'Open\'. When the case is over, the Status is set to \'Done\'. If the case needs to be reviewed then the Status is set to \'Pending\'.'),
# Only used for type opportunity
'probability': fields.float('Success Rate (%)',group_operator="avg"),
@ -328,7 +324,7 @@ class crm_lead(base_stage, format_address, osv.osv):
cases = self.browse(cr, uid, ids2, context=context)
return self._action(cr, uid, cases, False, context=context)
def stage_find(self, cr, uid, cases, section_id, domain=[], order='sequence', context=None):
def stage_find(self, cr, uid, cases, section_id, domain=None, order='sequence', context=None):
""" Override of the base.stage method
Parameter of the stage search taken from the lead:
- type: stage type must be the same or 'both'
@ -341,6 +337,9 @@ class crm_lead(base_stage, format_address, osv.osv):
# collect all section_ids
section_ids = []
types = ['both']
if not cases :
type = context.get('default_type')
types += [type]
if section_id:
section_ids.append(section_id)
for lead in cases:
@ -833,7 +832,7 @@ class crm_lead(base_stage, format_address, osv.osv):
}
for line in msg.get('body', '').split('\n'):
line = line.strip()
res = tools.misc.command_re.match(line)
res = tools.command_re.match(line)
if res and maps.get(res.group(1).lower()):
key = maps.get(res.group(1).lower())
update_vals[key] = res.group(2).lower()

View File

@ -14,9 +14,9 @@
<record id="action_crm_lead_unread" model="ir.values">
<field name="name">action_crm_lead_unread</field>
<field name="action_id" ref="actions_server_crm_lead_unread"/>
<field name="value" eval="'ir.actions.server,' + str(ref('actions_server_crm_lead_unread'))" />
<field name="value" eval="'ir.actions.server,' + str(ref('actions_server_crm_lead_unread'))"/>
<field name="key">action</field>
<field name="model_id" ref="model_crm_lead" />
<field name="model_id" ref="model_crm_lead"/>
<field name="model">crm.lead</field>
<field name="key2">client_action_multi</field>
</record>
@ -32,9 +32,9 @@
<record id="action_crm_lead_read" model="ir.values">
<field name="name">action_crm_lead_read</field>
<field name="action_id" ref="actions_server_crm_lead_read"/>
<field name="value" eval="'ir.actions.server,' + str(ref('actions_server_crm_lead_read'))" />
<field name="value" eval="'ir.actions.server,' + str(ref('actions_server_crm_lead_read'))"/>
<field name="key">action</field>
<field name="model_id" ref="model_crm_lead" />
<field name="model_id" ref="model_crm_lead"/>
<field name="model">crm.lead</field>
<field name="key2">client_action_multi</field>
</record>
@ -143,7 +143,7 @@
<div class="oe_right oe_button_box" name="buttons">
<button type="action"
name="%(act_crm_opportunity_crm_phonecall_new)d"
string="Phone Calls" />
string="Phone Calls"/>
</div>
<div class="oe_title">
<label for="name" class="oe_edit_only" string="Lead Description"/>
@ -167,13 +167,13 @@
</div>
</group>
<group>
<label for="contact_name" />
<label for="contact_name"/>
<div>
<field name="contact_name" class="oe_inline"/>,
<field name="title" placeholder="Title" domain="[('domain', '=', 'contact')]" class="oe_inline" options='{"no_open": True}'/>
</div>
<field name="email_from" widget="email"/>
<field name="function" />
<field name="function"/>
<field name="phone"/>
<field name="mobile"/>
<field name="fax"/>
@ -209,14 +209,14 @@
<group string="Categorization">
<field name="company_id"
groups="base.group_multi_company"
widget="selection" colspan="2" />
widget="selection" colspan="2"/>
<field name="type_id" widget="selection"/>
<field name="channel_id" widget="selection"/>
<field name="referred"/>
<field name="state" groups="base.group_no_one"/>
</group>
<group string="Mailings">
<field name="opt_out" />
<field name="opt_out"/>
</group>
</group>
</page>
@ -253,12 +253,12 @@
<field name="create_date" groups="base.group_no_one"/>
<field name="name"/>
<field name="contact_name"/>
<field name="country_id" invisible="context.get('invisible_country', True)" />
<field name="country_id" invisible="context.get('invisible_country', True)"/>
<field name="email_from"/>
<field name="phone"/>
<field name="stage_id"/>
<field name="user_id" invisible="1"/>
<field name="section_id" invisible="context.get('invisible_section', True)" />
<field name="section_id" invisible="context.get('invisible_section', True)"/>
<field name="state" invisible="1"/>
<field name="type_id" invisible="1"/>
<field name="referred" invisible="1"/>
@ -276,8 +276,8 @@
<field name="arch" type="xml">
<calendar string="Leads Generation"
date_start="date_action" color="user_id">
<field name="name" />
<field name="partner_name" />
<field name="name"/>
<field name="partner_name"/>
</calendar>
</field>
</record>
@ -354,14 +354,14 @@
<field name="arch" type="xml">
<search string="Search Leads">
<field name="name" string="Lead / Customer" filter_domain="['|','|',('partner_name','ilike',self),('email_from','ilike',self),('name','ilike',self)]"/>
<field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike',self)]" />
<field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike',self)]"/>
<field name="create_date"/>
<filter icon="terp-mail-message-new" string="Unread Messages" help="Unread messages" name="message_unread" domain="[('message_unread','=',True)]"/>
<separator/>
<filter icon="terp-check" string="New" name="new" help="New Leads" domain="[('state','=','draft')]"/>
<filter icon="terp-camera_test" string="In Progress" name="open" domain="[('state','=','open')]"/>
<separator/>
<filter string="Unassigned Leads" icon="terp-personal-" domain="[('user_id','=', False)]" help="Unassigned Leads" />
<filter string="Unassigned Leads" icon="terp-personal-" domain="[('user_id','=', False)]" help="Unassigned Leads"/>
<separator/>
<filter string="Leads Assigned to Me or My Team(s)" icon="terp-personal+" context="{'invisible_section': False}"
domain="['|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
@ -373,8 +373,8 @@
<filter string="Salesperson" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Team" icon="terp-personal+" domain="[]" context="{'group_by':'section_id'}"/>
<filter string="Referrer" icon="terp-personal" domain="[]" context="{'group_by':'referred'}"/>
<filter string="Campaign" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'type_id'}" />
<filter string="Channel" icon="terp-call-start" domain="[]" context="{'group_by':'channel_id'}" />
<filter string="Campaign" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'type_id'}"/>
<filter string="Channel" icon="terp-call-start" domain="[]" context="{'group_by':'channel_id'}"/>
<separator orientation="vertical"/>
<filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>
<filter string="Creation" help="Create date" icon="terp-go-month" domain="[]" context="{'group_by':'create_date'}" groups="base.group_no_one"/>
@ -415,7 +415,7 @@
name="action_makeMeeting"
type="object"
context="{'search_default_attendee_id': active_id, 'default_attendee_id' : active_id}"
/>
/>
</div>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
@ -452,7 +452,7 @@
<label for="section_id"/>
<div>
<field name="section_id" widget="selection"/>
<button name="case_escalate" string="Escalate" type="object" states="draft,open,pending" />
<button name="case_escalate" string="Escalate" type="object" states="draft,open,pending"/>
</div>
</group>
<group>
@ -485,12 +485,12 @@
</group>
<group>
<label for="contact_name" />
<label for="contact_name"/>
<div>
<field name="contact_name" class="oe_inline"/>
<field name="title" placeholder="Title" domain="[('domain', '=', 'contact')]" options='{"no_open": True}' class="oe_inline"/>
</div>
<field name="function" />
<field name="function"/>
<field name="mobile"/>
<field name="fax"/>
</group>
@ -500,7 +500,7 @@
<field name="channel_id" widget="selection"/>
</group>
<group string="Mailings">
<field name="opt_out" />
<field name="opt_out"/>
</group>
<group string="Misc">
<field name="active"/>
@ -542,15 +542,15 @@
<field name="create_date" groups="base.group_no_one"/>
<field name="name" string="Opportunity"/>
<field name="partner_id" string="Customer"/>
<field name="country_id" invisible="context.get('invisible_country', True)" />
<field name="country_id" invisible="context.get('invisible_country', True)"/>
<field name="date_action"/>
<field name="title_action" />
<field name="title_action"/>
<field name="channel_id" invisible="1"/>
<field name="type_id" invisible="1"/>
<field name="stage_id"/>
<field name="planned_revenue" sum="Expected Revenues"/>
<field name="probability" widget="progressbar" avg="Avg. of Probability"/>
<field name="section_id" invisible="context.get('invisible_section', True)" />
<field name="section_id" invisible="context.get('invisible_section', True)"/>
<field name="user_id"/>
<field name="priority" invisible="1"/>
<field name="state" groups="base.group_no_one"/>
@ -568,30 +568,30 @@
<search string="Search Opportunities">
<field name="name" string="Opportunity / Customer"
filter_domain="['|','|','|',('partner_id','ilike',self),('partner_name','ilike',self),('email_from','ilike',self),('name', 'ilike', self)]"/>
<field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike', self)]" />
<field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike', self)]"/>
<filter icon="terp-mail-message-new" string="Unread Messages" help="Unread messages" name="message_unread" domain="[('message_unread','=',True)]"/>
<separator/>
<filter icon="terp-check" string="New" help="New Opportunities" name="new" domain="[('state','=','draft')]"/>
<filter icon="terp-camera_test" string="In Progress" help="Open Opportunities" name="open" domain="[('state','=','open')]"/>
<separator/>
<filter string="Unassigned Opportunities" icon="terp-personal-" domain="[('user_id','=', False)]" help="Unassigned Opportunities" />
<filter string="Unassigned Opportunities" icon="terp-personal-" domain="[('user_id','=', False)]" help="Unassigned Opportunities"/>
<separator/>
<filter string="Opportunities Assigned to Me or My Team(s)" icon="terp-personal+"
domain="['|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]" context="{'invisible_section': False}"
help="Opportunities that are assigned to either me or one of the sale teams I manage" />
help="Opportunities that are assigned to either me or one of the sale teams I manage"/>
<field name="user_id"/>
<field name="section_id" context="{'invisible_section': False, 'default_section_id': self}"/>
<field name="partner_id"/>
<group expand="0" string="Group By..." colspan="16">
<filter string="Salesperson" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}" />
<filter string="Salesperson" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Team" help="Sales Team" icon="terp-personal+" domain="[]" context="{'group_by':'section_id'}"/>
<filter string="Customer" help="Partner" icon="terp-personal+" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}" />
<filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}" />
<filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/>
<filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}"/>
<filter string="Campaign" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'type_id'}"/>
<filter string="Channel" icon="terp-call-start" domain="[]" context="{'group_by':'channel_id'}" />
<filter string="Channel" icon="terp-call-start" domain="[]" context="{'group_by':'channel_id'}"/>
<filter string="Creation" icon="terp-go-month" domain="[]" context="{'group_by':'create_date'}" groups="base.group_no_one"/>
<filter string="Exp.Closing" icon="terp-go-month" help="Expected Closing" domain="[]" context="{'group_by':'date_deadline'}" />
<filter string="Exp.Closing" icon="terp-go-month" help="Expected Closing" domain="[]" context="{'group_by':'date_deadline'}"/>
</group>
<group string="Display">
<filter string="Show Sales Team" icon="terp-personal+" context="{'invisible_section': False}" domain="[]" help="Show Sales Team"/>

View File

@ -224,7 +224,7 @@ class crm_claim(base_stage, osv.osv):
}
for line in msg['body'].split('\n'):
line = line.strip()
res = tools.misc.command_re.match(line)
res = tools.command_re.match(line)
if res and maps.get(res.group(1).lower()):
key = maps.get(res.group(1).lower())
update_vals[key] = res.group(2).lower()

View File

@ -133,7 +133,7 @@ class crm_helpdesk(base_state, base_stage, osv.osv):
}
for line in msg['body'].split('\n'):
line = line.strip()
res = tools.misc.command_re.match(line)
res = tools.command_re.match(line)
if res and maps.get(res.group(1).lower()):
key = maps.get(res.group(1).lower())
update_vals[key] = res.group(2).lower()

View File

@ -356,7 +356,8 @@ class hr_applicant(base_stage, osv.Model):
"""
if isinstance(ids, (str, int, long)):
ids = [ids]
if update_vals is None: vals = {}
if update_vals is None:
update_vals = {}
update_vals.update({
'description': msg.get('body'),
@ -373,12 +374,12 @@ class hr_applicant(base_stage, osv.Model):
}
for line in msg.get('body', '').split('\n'):
line = line.strip()
res = tools.misc.command_re.match(line)
res = tools.command_re.match(line)
if res and maps.get(res.group(1).lower(), False):
key = maps.get(res.group(1).lower())
update_vals[key] = res.group(2).lower()
return super(hr_applicant, self).message_update(cr, uids, ids, update_vals=update_vals, context=context)
return super(hr_applicant, self).message_update(cr, uid, ids, msg, update_vals=update_vals, context=context)
def create(self, cr, uid, vals, context=None):
obj_id = super(hr_applicant, self).create(cr, uid, vals, context=context)
@ -420,7 +421,7 @@ class hr_applicant(base_stage, osv.Model):
self.write(cr, uid, [applicant.id], {'emp_id': emp_id}, context=context)
self.case_close(cr, uid, [applicant.id], context)
else:
raise osv.except_osv(_('Warning!'),_('You must define Applied Job for this applicant.'))
raise osv.except_osv(_('Warning!'), _('You must define Applied Job for this applicant.'))
action_model, action_id = model_data.get_object_reference(cr, uid, 'hr', 'open_view_employee_list')
dict_act_window = act_window.read(cr, uid, action_id, [])
@ -433,13 +434,13 @@ class hr_applicant(base_stage, osv.Model):
"""Overrides cancel for crm_case for setting probability
"""
res = super(hr_applicant, self).case_cancel(cr, uid, ids, context)
self.write(cr, uid, ids, {'probability' : 0.0})
self.write(cr, uid, ids, {'probability': 0.0})
return res
def case_pending(self, cr, uid, ids, context=None):
"""Marks case as pending"""
res = super(hr_applicant, self).case_pending(cr, uid, ids, context)
self.write(cr, uid, ids, {'probability' : 0.0})
self.write(cr, uid, ids, {'probability': 0.0})
return res
def case_reset(self, cr, uid, ids, context=None):
@ -452,7 +453,7 @@ class hr_applicant(base_stage, osv.Model):
def set_priority(self, cr, uid, ids, priority, *args):
"""Set applicant priority
"""
return self.write(cr, uid, ids, {'priority' : priority})
return self.write(cr, uid, ids, {'priority': priority})
def set_high_priority(self, cr, uid, ids, *args):
"""Set applicant priority to high
@ -475,7 +476,7 @@ class hr_applicant(base_stage, osv.Model):
return self.message_post(cr, uid, ids, body=_("Stage changed to <b>%s</b>.") % (stage_name), context=context)
def case_get_note_msg_prefix(self, cr, uid, id, context=None):
return 'Applicant'
return 'Applicant'
def case_open_send_note(self, cr, uid, ids, context=None):
message = _("Applicant has been set <b>in progress</b>.")

View File

@ -100,28 +100,28 @@
</record>
<record model="lunch.order" id="order_1">
<field name="user_id" ref="base.user_root"/>
<field name="user_id" ref="base.user_demo"/>
<field name="date" eval="time.strftime('2012-10-23')"/>
<field name="order_line_ids" eval="[]"/>
<field name="state">new</field>
</record>
<record model="lunch.order" id="order_2">
<field name="user_id" ref="base.user_root"/>
<field name="user_id" ref="base.user_demo"/>
<field name="date" eval="time.strftime('2012-10-22')"/>
<field name="order_line_ids" eval="[]"/>
<field name="state">confirmed</field>
</record>
<record model="lunch.order" id="order_3">
<field name="user_id" ref="base.user_root"/>
<field name="user_id" ref="base.user_demo"/>
<field name="date" eval="time.strftime('2012-10-24')"/>
<field name="order_line_ids" eval="[]"/>
<field name="state">cancelled</field>
<field name="state">partially</field>
</record>
<record model="lunch.order.line" id="order_line_1">
<field name="user_id" ref="base.user_root"/>
<field name="user_id" ref="base.user_demo"/>
<field name="product_id" ref="product_Bolognese"/>
<field name="date" eval="time.strftime('2012-10-23')"/>
<field name="state">new</field>
@ -131,7 +131,7 @@
</record>
<record model="lunch.order.line" id="order_line_2">
<field name="user_id" ref="base.user_root"/>
<field name="user_id" ref="base.user_demo"/>
<field name="product_id" ref="product_italiana"/>
<field name="date" eval="time.strftime('2012-10-22')"/>
<field name="state">confirmed</field>
@ -141,7 +141,7 @@
</record>
<record model="lunch.order.line" id="order_line_3">
<field name="user_id" ref="base.user_root"/>
<field name="user_id" ref="base.user_demo"/>
<field name="product_id" ref="product_gouda"/>
<field name="date" eval="time.strftime('2012-10-24')"/>
<field name="state">cancelled</field>
@ -150,9 +150,18 @@
<field name="order_id" ref="order_3"/>
</record>
<record model="lunch.order.line" id="order_line_4">
<field name="user_id" ref="base.user_demo"/>
<field name="product_id" ref="product_chicken_curry"/>
<field name="date" eval="time.strftime('2012-10-24')"/>
<field name="state">confirmed</field>
<field name="supplier" ref="partner_coin_gourmand"/>
<field name="note">+Salad +Tomatoes +Eggs</field>
<field name="order_id" ref="order_3"/>
</record>
<record model="lunch.cashmove" id="cashmove_1">
<field name="user_id" ref="base.user_root"/>
<field name="user_id" ref="base.user_demo"/>
<field name="date" eval="time.strftime('2012-10-23')"/>
<field name="description">Pizza Italiana</field>
<field name="amount">-7.40</field>
@ -161,7 +170,16 @@
</record>
<record model="lunch.cashmove" id="cashmove_2">
<field name="user_id" ref="base.user_root"/>
<field name="user_id" ref="base.user_demo"/>
<field name="date" eval="time.strftime('2012-10-24')"/>
<field name="description">Chicken curry</field>
<field name="amount">-2.60</field>
<field name="order_id" ref="order_3"/>
<field name="state">order</field>
</record>
<record model="lunch.cashmove" id="cashmove_3">
<field name="user_id" ref="base.user_demo"/>
<field name="date" eval="time.strftime('2012-10-24')"/>
<field name="description">Payment: 5 lunch tickets (6€)</field>
<field name="amount">30</field>

View File

@ -1,11 +1,19 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record id="group_lunch_manager" model="res.groups">
<field name="name">Lunch / Manager</field>
<record model="ir.module.category" id="module_lunch_category">
<field name="name">Lunch</field>
<field name="description">Helps you handle your lunch needs, if you are a manager you will be able to create new products, cashmoves and to confirm or cancel orders.</field>
<field name="sequence">16</field>
</record>
<record id="group_lunch_user" model="res.groups">
<field name="name">Lunch / User</field>
<field name="name">User</field>
<field name="category_id" ref="module_lunch_category"/>
</record>
<record id="group_lunch_manager" model="res.groups">
<field name="name">Manager</field>
<field name="implied_ids" eval="[(4, ref('group_lunch_user'))]"/>
<field name="category_id" ref="module_lunch_category"/>
</record>
</data>
</openerp>

View File

@ -341,7 +341,7 @@ class mail_thread(osv.AbstractModel):
message = self.pool.get('mail.message').browse(cr, uid, message_ids[0], context=context)
_logger.debug('Routing mail with Message-Id %s: direct reply to a private message: %s, custom_values: %s, uid: %s',
message_id, message.id, custom_values, uid)
return [(False, 0, custom_values, uid)]
return [(message.model, message.res_id, custom_values, uid)]
# 2. Look for a matching mail.alias entry
# Delivered-To is a safe bet in most modern MTAs, but we have to fallback on To + Cc values

View File

@ -470,7 +470,14 @@ class Product(osv.osv):
'membership_date_from': fields.date('Date from', help='Date from which membership becomes active.'),
'membership_date_to': fields.date('Date to', help='Date until which membership remains active.'),
}
def _check_end_date(self, cr, uid, ids, context=None):
for membership in self.browse(cr, uid, ids, context=context):
if membership.membership_date_to < membership.membership_date_from:
return False
return True
_constraints = [
(_check_end_date, 'Error ! Ending Date cannot be set before Beginning Date.', ['membership_date_to']),
]
_defaults = {
'membership': False,
}

View File

@ -1247,7 +1247,7 @@ class task(base_stage, osv.osv):
}
for line in msg['body'].split('\n'):
line = line.strip()
res = tools.misc.command_re.match(line)
res = tools.command_re.match(line)
if res:
match = res.group(1).lower()
field = maps.get(match)