diff options
| author | Martin Trigaux <mat@openerp.com> | 2013-04-10 15:20:14 +0200 |
|---|---|---|
| committer | Martin Trigaux <mat@openerp.com> | 2013-04-10 15:20:14 +0200 |
| commit | 280e2c9ca4f4c5ac6ea06dacd10fc2744930abd2 (patch) | |
| tree | d3bbd74d403587208552676f1df1b14939b971fc | |
| parent | 0524ed98ed60835821b9af54bb162d70067399b7 (diff) | |
| parent | a0a9ae61e7e41607aa9f6c918f003fd5699ffa4c (diff) | |
[MERGE] Latest trunk
bzr revid: mat@openerp.com-20130410132014-b248u9j5bcm03h1y
57 files changed, 1029 insertions, 442 deletions
diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 8c0854bd6c6..c2f21c0d8bc 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -453,10 +453,11 @@ <filter name="invoices" string="Invoices" domain="[('state','not in',['draft','cancel'])]" help="Proforma/Open/Paid Invoices"/> <filter name="unpaid" string="Unpaid" domain="[('state','=','open')]" help="Unpaid Invoices"/> <separator/> - <filter domain="[('user_id','=',uid)]" help="My Invoices" icon="terp-personal"/> <field name="partner_id"/> <field name="user_id" string="Salesperson"/> <field name="period_id" string="Period"/> + <separator/> + <filter domain="[('user_id','=',uid)]" help="My Invoices"/> <group expand="0" string="Group By..."> <filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/> <filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/> diff --git a/addons/account_analytic_analysis/account_analytic_analysis_view.xml b/addons/account_analytic_analysis/account_analytic_analysis_view.xml index 6f670b2c6b9..97a4bb8fac2 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis_view.xml +++ b/addons/account_analytic_analysis/account_analytic_analysis_view.xml @@ -267,7 +267,7 @@ </field> </record> <menuitem id="base.menu_sales" name="Sales" parent="base.menu_base_partner" sequence="1"/> - <menuitem action="action_account_analytic_overdue_all" id="menu_action_account_analytic_overdue_all" sequence="7" parent="base.menu_sales"/> + <menuitem action="action_account_analytic_overdue_all" id="menu_action_account_analytic_overdue_all" sequence="8" parent="base.menu_sales"/> <!-- Action Sales/Invoicing/Time and Material to Invoice --> <record id="action_hr_tree_invoiced_all" model="ir.actions.act_window"> diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index 64bad21ede1..072624a7d98 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -81,6 +81,8 @@ Dashboard for CRM will include: 'crm_lead_view.xml', 'crm_lead_menu.xml', + 'crm_case_section_view.xml', + 'crm_meeting_menu.xml', 'crm_phonecall_view.xml', @@ -114,9 +116,26 @@ Dashboard for CRM will include: 'test/crm_lead_copy.yml', 'test/crm_lead_unlink.yml', ], + 'css': [ + 'static/src/css/crm.css' + ], + 'js': [ + 'static/src/js/crm.js' + ], 'installable': True, 'application': True, 'auto_install': False, - 'images': ['images/crm_dashboard.png', 'images/customers.png','images/leads.png','images/opportunities_kanban.png','images/opportunities_form.png','images/opportunities_calendar.png','images/opportunities_graph.png','images/logged_calls.png','images/scheduled_calls.png','images/stages.png'], + 'images': [ + 'images/crm_dashboard.png', + 'images/customers.png', + 'images/leads.png', + 'images/opportunities_kanban.png', + 'images/opportunities_form.png', + 'images/opportunities_calendar.png', + 'images/opportunities_graph.png', + 'images/logged_calls.png', + 'images/scheduled_calls.png', + 'images/stages.png', + ], } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm/crm.py b/addons/crm/crm.py index df6d5e12b66..7b6fe02afa8 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -98,6 +98,7 @@ class crm_case_stage(osv.osv): 'case_default': True, } + class crm_case_section(osv.osv): """ Model for sales teams. """ _name = "crm.case.section" @@ -107,7 +108,7 @@ class crm_case_section(osv.osv): _order = "complete_name" def get_full_name(self, cr, uid, ids, field_name, arg, context=None): - return dict(self.name_get(cr, uid, ids, context=context)) + return dict(self.name_get(cr, uid, ids, context=context)) _columns = { 'name': fields.char('Sales Team', size=64, required=True, translate=True), @@ -117,27 +118,36 @@ class crm_case_section(osv.osv): "true, it will allow you to hide the sales team without removing it."), 'change_responsible': fields.boolean('Reassign Escalated', help="When escalating to this team override the salesman with the team leader."), 'user_id': fields.many2one('res.users', 'Team Leader'), - 'member_ids':fields.many2many('res.users', 'sale_member_rel', 'section_id', 'member_id', 'Team Members'), + 'member_ids': fields.many2many('res.users', 'sale_member_rel', 'section_id', 'member_id', 'Team Members'), 'reply_to': fields.char('Reply-To', size=64, help="The email address put in the 'Reply-To' of all emails sent by OpenERP about cases in this sales team"), 'parent_id': fields.many2one('crm.case.section', 'Parent Team'), 'child_ids': fields.one2many('crm.case.section', 'parent_id', 'Child Teams'), 'resource_calendar_id': fields.many2one('resource.calendar', "Working Time", help="Used to compute open days"), 'note': fields.text('Description'), - 'working_hours': fields.float('Working Hours', digits=(16,2 )), + 'working_hours': fields.float('Working Hours', digits=(16, 2)), 'stage_ids': fields.many2many('crm.case.stage', 'section_stage_rel', 'section_id', 'stage_id', 'Stages'), 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="cascade", required=True, help="The email address associated with this team. New emails received will automatically " "create new leads assigned to the team."), + 'open_lead_ids': fields.one2many('crm.lead', 'section_id', + string='Open Leads', readonly=True, + domain=['&', ('type', '!=', 'opportunity'), ('state', 'not in', ['done', 'cancel'])]), + 'open_opportunity_ids': fields.one2many('crm.lead', 'section_id', + string='Open Opportunities', readonly=True, + domain=['&', '|', ('type', '=', 'opportunity'), ('type', '=', 'both'), ('state', 'not in', ['done', 'cancel'])]), + 'color': fields.integer('Color Index'), + 'use_leads': fields.boolean('Leads', + help="This enables the management of leads in the sales team. Otherwise the sales team manages only opportunities."), } def _get_stage_common(self, cr, uid, context): - ids = self.pool.get('crm.case.stage').search(cr, uid, [('case_default','=',1)], context=context) + ids = self.pool.get('crm.case.stage').search(cr, uid, [('case_default', '=', 1)], context=context) return ids _defaults = { 'active': 1, 'stage_ids': _get_stage_common, - 'alias_domain': False, # always hide alias during creation + 'use_leads': True, } _sql_constraints = [ @@ -150,7 +160,7 @@ class crm_case_section(osv.osv): def name_get(self, cr, uid, ids, context=None): """Overrides orm name_get method""" - if not isinstance(ids, list) : + if not isinstance(ids, list): ids = [ids] res = [] if not ids: @@ -167,20 +177,20 @@ class crm_case_section(osv.osv): def create(self, cr, uid, vals, context=None): mail_alias = self.pool.get('mail.alias') if not vals.get('alias_id'): - vals.pop('alias_name', None) # prevent errors during copy() + alias_name = vals.pop('alias_name', None) or vals.get('name') # prevent errors during copy() alias_id = mail_alias.create_unique_alias(cr, uid, - {'alias_name': vals['name']}, + {'alias_name': alias_name}, model_name="crm.lead", context=context) vals['alias_id'] = alias_id res = super(crm_case_section, self).create(cr, uid, vals, context) - mail_alias.write(cr, uid, [vals['alias_id']], {'alias_defaults': {'section_id': res, 'type':'lead'}}, context) + mail_alias.write(cr, uid, [vals['alias_id']], {'alias_defaults': {'section_id': res, 'type': 'lead'}}, context) return res def unlink(self, cr, uid, ids, context=None): # Cascade-delete mail aliases as well, as they should not exist without the sales team. mail_alias = self.pool.get('mail.alias') - alias_ids = [team.alias_id.id for team in self.browse(cr, uid, ids, context=context) if team.alias_id ] + alias_ids = [team.alias_id.id for team in self.browse(cr, uid, ids, context=context) if team.alias_id] res = super(crm_case_section, self).unlink(cr, uid, ids, context=context) mail_alias.unlink(cr, uid, alias_ids, context=context) return res @@ -230,4 +240,5 @@ class crm_payment_mode(osv.osv): 'section_id': fields.many2one('crm.case.section', 'Sales Team'), } + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm/crm_case_section_view.xml b/addons/crm/crm_case_section_view.xml new file mode 100644 index 00000000000..c788872b47e --- /dev/null +++ b/addons/crm/crm_case_section_view.xml @@ -0,0 +1,294 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + + <!-- CRM lead search by Salesteams --> + + <record model="ir.actions.act_window" id="crm_case_form_view_salesteams_lead"> + <field name="name">Leads</field> + <field name="res_model">crm.lead</field> + <field name="view_mode">tree,form</field> + <field name="domain">['|', ('type','=','lead'), ('type','=',False)]</field> + <field name="view_id" ref="crm_case_tree_view_leads"/> + <field name="search_view_id" ref="crm.view_crm_case_leads_filter"/> + <field name="context">{ + 'search_default_section_id': [active_id], + 'search_default_open': 1, + 'default_section_id': active_id, + 'default_type': 'lead', + 'stage_type': 'lead', + } + </field> + <field name="help" type="html"> + <p> + Use leads if you need a qualification step before creating an + opportunity or a customer. It can be a business card you received, + a contact form filled in your website, or a file of unqualified + prospects you import, etc. + </p><p> + Once qualified, the lead can be converted into a business + opportunity and/or a new customer in your address book. + </p> + </field> + </record> + + <!-- CRM opportunity search by Salesteams --> + + <record model="ir.actions.act_window" id="crm_case_form_view_salesteams_opportunity"> + <field name="name">Opportunities</field> + <field name="res_model">crm.lead</field> + <field name="view_mode">kanban,tree,graph,form,calendar</field> + <field name="domain">[('type','=','opportunity')]</field> + <field name="view_id" ref="crm.crm_case_kanban_view_leads"/> + <field name="search_view_id" ref="crm.view_crm_case_opportunities_filter"/> + <field name="context">{ + 'search_default_section_id': [active_id], + 'search_default_new': 1, + 'search_default_open': 1, + 'default_section_id': active_id, + 'stage_type': 'opportunity', + 'default_type': 'opportunity', + 'default_user_id': uid, + } + </field> + <field name="help" type="html"> + <p class="oe_view_nocontent_create"> + Click to create a new opportunity. + </p><p> + OpenERP helps you keep track of your sales pipeline to follow + up potential sales and better forecast your future revenues. + </p><p> + You will be able to plan meetings and phone calls from + opportunities, convert them into quotations, attach related + documents, track all discussions, and much more. + </p> + </field> + </record> + + <!-- Case Sections Salesteams kanban view --> + + <record model="ir.ui.view" id="crm_case_section_salesteams_view_kanban"> + <field name="name">crm.case.section.kanban</field> + <field name="model">crm.case.section</field> + <field name="arch" type="xml"> + <kanban version="7.0" class="oe_background_grey"> + <field name="use_leads"/> + <field name="name"/> + <field name="user_id"/> + <field name="member_ids"/> + <field name="note"/> + <field name="alias_id"/> + <field name="color"/> + <field name="open_lead_ids"/> + <field name="open_opportunity_ids"/> + <templates> + <t t-name="kanban-box"> + <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_project oe_kanban_global_click oe_kanban_crm_salesteams"> + <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user"> + <span class="oe_e">í</span> + <ul class="oe_dropdown_menu"> + <li t-if="widget.view.is_action_enabled('edit')"><a type="edit">Sales Teams Settings</a></li> + <li t-if="widget.view.is_action_enabled('delete')"><a type="delete">Delete</a></li> + <li t-if="widget.view.is_action_enabled('edit')"><ul class="oe_kanban_colorpicker" data-field="color"/></li> + </ul> + </div> + <div class="oe_kanban_content"> + <h4><field name="name"/></h4> + <div class="oe_kanban_alias" t-if="record.use_leads.raw_value and record.alias_id.value"> + <span class="oe_e">%%</span><small><field name="alias_id"/></small> + </div> + <div class="oe_items_list"> + <a t-if="record.use_leads.raw_value" name="%(crm_case_form_view_salesteams_lead)d" type="action"> + <t t-raw="record.open_lead_ids.raw_value.length"/> + <t t-if="record.open_lead_ids.raw_value.length >= 2">Leads</t> + <t t-if="record.open_lead_ids.raw_value.length < 2">Lead</t></a> + <a name="%(crm_case_form_view_salesteams_opportunity)d" type="action"> + <t t-raw="record.open_opportunity_ids.raw_value.length"/> + <t t-if="record.open_opportunity_ids.raw_value.length >= 2">Opportunities</t> + <t t-if="record.open_opportunity_ids.raw_value.length < 2">Opportunity</t></a> + </div> + <div class="oe_avatars"> + <img t-if="record.user_id.raw_value" t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-data-member_id="record.user_id.raw_value"/> + <t t-foreach="record.member_ids.raw_value.slice(0,11)" t-as="member"> + <img t-att-src="kanban_image('res.users', 'image_small', member)" t-att-data-member_id="member"/> + </t> + </div> + </div> + </div> + </t> + </templates> + </kanban> + </field> + </record> + + <!-- Case Sections Action --> + + <record id="crm_case_section_salesteams_act" model="ir.actions.act_window"> + <field name="name">Sales Teams</field> + <field name="res_model">crm.case.section</field> + <field name="view_type">form</field> + <field name="view_mode">kanban,tree,form</field> + <field name="view_id" ref="crm_case_section_salesteams_view_kanban"/> + <field name="help" type="html"> + <p class="oe_view_nocontent_create"> + Click here to define a new sales team. + </p><p> + Use sales team to organize your different salespersons or + departments into separate teams. Each team will work in + its own list of opportunities. + </p> + </field> + </record> + + <!-- Case Sections Form View --> + + <record id="crm_case_section_view_form" model="ir.ui.view"> + <field name="name">crm.case.section.form</field> + <field name="model">crm.case.section</field> + <field name="arch" type="xml"> + <form string="Sales Team" version="7.0"> + <sheet> + <div class="oe_title"> + <label for="name" class="oe_edit_only" string="Project Name"/> + <h1> + <field name="name" string="Project Name"/> + </h1> + <div name="group_alias" + attrs="{'invisible': [('alias_domain', '=', False)]}"> + <label for="alias_id" string="Email Alias"/> + <field name="alias_id" class="oe_inline oe_read_only" required="0" nolabel="1"/> + <span name="edit_alias" class="oe_edit_only"> + <field name="alias_name" class="oe_inline" + attrs="{'required': [('use_leads', '=', True), ('alias_id', '!=', False)]}"/> + @ + <field name="alias_domain" class="oe_inline" readonly="1"/> + </span> + </div> + <div name="options_active"> + <field name="use_leads" class="oe_inline"/><label for="use_leads"/> + </div> + </div> + <group> + <group> + <field name="parent_id"/> + <field name="resource_calendar_id"/> + <field name="active"/> + </group> + <group> + <field name="user_id"/> + <field name="code"/> + </group> + <group colspan="4" attrs="{'invisible': [('use_leads', '=', False)]}"> + + </group> + </group> + <notebook colspan="4"> + <page string="Sales Team"> + <group> + <field name="change_responsible"/> + </group> + <separator string="Team Members"/> + <field name="member_ids" widget="many2many_kanban"> + <kanban quick_create="false" create="true"> + <field name="name"/> + <templates> + <t t-name="kanban-box"> + <div style="position: relative"> + <a t-if="! read_only_mode" type="delete" style="position: absolute; right: 0; padding: 4px; diplay: inline-block">X</a> + <div class="oe_module_vignette"> + <div class="oe_module_desc"> + <field name="name"/> + </div> + </div> + </div> + </t> + </templates> + </kanban> + </field> + </page> + <page string="Stages"> + <separator string="Select Stages for this Sales Team"/> + <field name="stage_ids"/> + </page> + <page string="Notes"> + <field name="note"/> + </page> + </notebook> + </sheet> + <div class="oe_chatter"> + <field name="message_follower_ids" widget="mail_followers" help="Follow this salesteam to automatically track the events associated to users of this team."/> + <field name="message_ids" widget="mail_thread"/> + </div> + </form> + </field> + </record> + + <!-- Case Sections Tree View --> + + <record id="crm_case_section_view_tree" model="ir.ui.view"> + <field name="name">crm.case.section.tree</field> + <field name="model">crm.case.section</field> + <field name="field_parent">child_ids</field> + <field name="arch" type="xml"> + <tree string="Sales Team"> + <field name="name"/> + <field name="code"/> + <field name="user_id"/> + </tree> + </field> + </record> + + <!-- Case Sections Action --> + + <record model="ir.actions.act_window.view" id="action_crm_tag_kanban_view_salesteams_oppor11"> + <field name="sequence" eval="0"/> + <field name="view_mode">kanban</field> + <field name="view_id" ref="crm_case_kanban_view_leads"/> + <field name="act_window_id" ref="crm_case_form_view_salesteams_opportunity"/> + </record> + + <record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_salesteams_oppor11"> + <field name="sequence" eval="1"/> + <field name="view_mode">tree</field> + <field name="view_id" ref="crm_case_tree_view_oppor"/> + <field name="act_window_id" ref="crm_case_form_view_salesteams_opportunity"/> + </record> + + <record model="ir.actions.act_window.view" id="action_crm_tag_form_view_salesteams_oppor11"> + <field name="sequence" eval="2"/> + <field name="view_mode">form</field> + <field name="view_id" ref="crm_case_form_view_oppor"/> + <field name="act_window_id" ref="crm_case_form_view_salesteams_opportunity"/> + </record> + + <record id="crm_case_section_act_tree" model="ir.actions.act_window"> + <field name="name">Cases by Sales Team</field> + <field name="res_model">crm.case.section</field> + <field name="domain">[('parent_id','=',False)]</field> + <field name="view_type">tree</field> + <field name="view_id" ref="crm_case_section_view_tree"/> + </record> + + <record id="crm_case_section_act" model="ir.actions.act_window"> + <field name="name">Sales Teams</field> + <field name="res_model">crm.case.section</field> + <field name="view_type">form</field> + <field name="view_id" ref="crm_case_section_view_tree"/> + <field name="help" type="html"> + <p class="oe_view_nocontent_create"> + Click here to define a new sales team. + </p><p> + Use sales team to organize your different salespersons or + departments into separate teams. Each team will work in + its own list of opportunities. + </p> + </field> + </record> + + <menuitem id="crm.menu_crm_case_section_act" + action="crm_case_section_salesteams_act" + sequence="1" + parent="base.menu_sales" + groups="base.group_multi_salesteams"/> + </data> +</openerp>
\ No newline at end of file diff --git a/addons/crm/crm_data.xml b/addons/crm/crm_data.xml index 3db7a457dfd..f24aee13c1d 100644 --- a/addons/crm/crm_data.xml +++ b/addons/crm/crm_data.xml @@ -27,8 +27,10 @@ </record> <record model="crm.case.section" id="section_sales_department"> - <field name="name">Sales Department</field> + <field name="name">Sales</field> <field name="code">Sales</field> + <field name="use_leads">True</field> + <field name="member_ids" eval="[(4, ref('base.user_root'))]"/> </record> <!-- Payment Mode --> @@ -64,12 +66,6 @@ <p>To manage quotations and sale orders, install the "Sales Management" application.</p>]]></field> </record> - <record model="mail.alias" id="default_sales_alias"> - <field name="alias_name">sales</field> - <field name="alias_model_id" ref="model_crm_lead"/> - <field name="alias_user_id" ref="base.user_root"/> - <field name="alias_defaults">{'type':'lead'}</field> - </record> </data> </openerp> diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 3f676329765..6d195fec383 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -85,6 +85,22 @@ class crm_lead(base_stage, format_address, osv.osv): }, } + def get_empty_list_help(self, cr, uid, help, context=None): + if context.get('default_type') == 'lead': + context['empty_list_help_model'] = 'crm.case.section' + context['empty_list_help_id'] = context.get('default_section_id') + context['empty_list_help_document_name'] = _("leads") + return super(crm_lead, self).get_empty_list_help(cr, uid, help, context=context) + + def onchange_user_id(self, cr, uid, ids, section_id, user_id, context=None): + """ When changing the user, also set a section_id or restrict section id + to the ones user_id is member of. """ + if user_id: + section_ids = self.pool.get('crm.case.section').search(cr, uid, ['|', ('user_id', '=', user_id), ('member_ids', '=', user_id)], context=context) + if len(section_ids) > 0 and section_id not in section_ids: + section_id = section_ids[0] + return {'value': {'section_id': section_id}} + def create(self, cr, uid, vals, context=None): if context is None: context = {} diff --git a/addons/crm/crm_lead_data.xml b/addons/crm/crm_lead_data.xml index e410cbe3d85..0979a94eb3f 100644 --- a/addons/crm/crm_lead_data.xml +++ b/addons/crm/crm_lead_data.xml @@ -54,6 +54,7 @@ </record> <record model="crm.case.stage" id="stage_lead6"> <field name="name">Won</field> + <field eval="True" name="fold"/> <field eval="1" name="case_default"/> <field name="state">done</field> <field eval="100" name="probability"/> diff --git a/addons/crm/crm_lead_menu.xml b/addons/crm/crm_lead_menu.xml index 8c38ed41a1c..2226b4ac895 100644 --- a/addons/crm/crm_lead_menu.xml +++ b/addons/crm/crm_lead_menu.xml @@ -9,55 +9,49 @@ <field name="domain">['|', ('type','=','lead'), ('type','=',False)]</field> <field name="view_id" ref="crm_case_tree_view_leads"/> <field name="search_view_id" ref="crm.view_crm_case_leads_filter"/> - <field name="context">{'default_type':'lead', 'stage_type':'lead'}</field> + <field name="context">{ + 'default_type':'lead', + 'stage_type':'lead', + 'search_default_unassigned':1, + } + </field> <field name="help" type="html"> - <p class="oe_view_nocontent_create"> - Click to create an unqualified lead. - </p><p> - Use leads if you need a qualification step before creating an - opportunity or a customer. It can be a business card you received, - a contact form filled in your website, or a file of unqualified - prospects you import, etc. - </p><p> - Once qualified, the lead can be converted into a business - opportunity and/or a new customer in your address book. - </p> + <p> + Use leads if you need a qualification step before creating an + opportunity or a customer. It can be a business card you received, + a contact form filled in your website, or a file of unqualified + prospects you import, etc. + </p><p> + Once qualified, the lead can be converted into a business + opportunity and/or a new customer in your address book. + </p> </field> </record> - <record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_leads_all"> - <field name="sequence" eval="1"/> - <field name="view_mode">tree</field> - <field name="view_id" ref="crm_case_tree_view_leads"/> - <field name="act_window_id" ref="crm_case_category_act_leads_all"/> - </record> - - <record model="ir.actions.act_window.view" id="action_crm_tag_form_view_leads_all"> - <field name="sequence" eval="3"/> - <field name="view_mode">form</field> - <field name="view_id" ref="crm_case_form_view_leads"/> - <field name="act_window_id" ref="crm_case_category_act_leads_all"/> - </record> - <record model="ir.actions.act_window" id="crm_case_category_act_oppor11"> <field name="name">Opportunities</field> <field name="res_model">crm.lead</field> <field name="view_mode">kanban,tree,graph,form,calendar</field> <field name="domain">[('type','=','opportunity')]</field> - <field name="context">{'stage_type': 'opportunity', 'default_type': 'opportunity', 'default_user_id': uid}</field> + <field name="context">{ + 'stage_type': 'opportunity', + 'default_type': 'opportunity', + 'default_user_id': uid + } + </field> <field name="view_id" eval="False"/> <field name="search_view_id" ref="crm.view_crm_case_opportunities_filter"/> <field name="help" type="html"> - <p class="oe_view_nocontent_create"> - Click to create a new opportunity. - </p><p> - OpenERP helps you keep track of your sales pipeline to follow - up potential sales and better forecast your future revenues. - </p><p> - You will be able to plan meetings and phone calls from - opportunities, convert them into quotations, attach related - documents, track all discussions, and much more. - </p> + <p class="oe_view_nocontent_create"> + Click to create a new opportunity. + </p><p> + OpenERP helps you keep track of your sales pipeline to follow + up potential sales and better forecast your future revenues. + </p><p> + You will be able to plan meetings and phone calls from + opportunities, convert them into quotations, attach related + documents, track all discussions, and much more. + </p> </field> </record> @@ -82,9 +76,13 @@ <field name="act_window_id" ref="crm_case_category_act_oppor11"/> </record> - <menuitem name="Sales" id="base.menu_sales" parent="base.menu_base_partner" sequence="1" /> - <menuitem name="Leads" id="menu_crm_leads" parent="base.menu_sales" action="crm_case_category_act_leads_all" sequence="2" /> - <menuitem name="Opportunities" id="menu_crm_opportunities" parent="base.menu_sales" action="crm_case_category_act_oppor11" sequence="3" /> + <menuitem name="Sales" id="base.menu_sales" parent="base.menu_base_partner" sequence="1"/> + <menuitem name="Leads" id="menu_crm_leads" parent="base.menu_sales" sequence="3" + action="crm_case_category_act_leads_all" + groups="base.group_mono_salesteams,base.group_sale_manager"/> + <menuitem name="Opportunities" id="menu_crm_opportunities" parent="base.menu_sales" sequence="4" + action="crm_case_category_act_oppor11" + groups="base.group_mono_salesteams,base.group_sale_manager"/> </data> </openerp> diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 894df92b70f..3001e8b1d88 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -152,12 +152,13 @@ --> </group> <group> - <field name="user_id" - context="{'default_groups_ref': ['base.group_user', 'base.group_sale_salesman_all_leads']}"/> - <label for="section_id"/> - <div> + <field name="user_id" on_change="onchange_user_id(section_id, user_id)" + context="{'default_groups_ref': ['base.group_user', 'base.group_sale_salesman_all_leads'] }"/> + <label for="section_id" groups="base.group_multi_salesteams"/> + <div groups="base.group_multi_salesteams"> <field name="section_id"/> - <button name="case_escalate" string="Escalate" type="object" attrs="{'invisible': ['|', ('section_id','=',False), ('state', 'not in', ['draft','open','pending'])]}"/> + <button name="case_escalate" string="Escalate" type="object" + attrs="{'invisible': ['|', ('section_id','=',False), ('state', 'not in', ['draft','open','pending'])]}"/> </div> <field name="type" invisible="1"/> </group> @@ -229,7 +230,7 @@ <field name="stage_id"/> <field name="user_id" invisible="1"/> <field name="partner_id" invisible="1"/> - <field name="section_id" invisible="context.get('invisible_section', True)"/> + <field name="section_id" invisible="context.get('invisible_section', True)" groups="base.group_multi_salesteams"/> <field name="state" invisible="1"/> <field name="type_id" invisible="1"/> <field name="referred" invisible="1"/> @@ -327,7 +328,7 @@ <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="section_id" context="{'invisible_section': False, 'default_section_id': self}"/> + <field name="section_id" context="{'invisible_section': False}" groups="base.group_multi_salesteams"/> <field name="user_id"/> <field name="partner_id"/> <field name="create_date"/> @@ -335,7 +336,7 @@ <separator/> <filter string="Open" name="open" domain="[('state','!=','cancel')]" help="Open Leads"/> <filter string="Dead" name="dead" domain="[('state','=','cancel')]"/> - <filter string="Unassigned" domain="[('user_id','=', False)]" help="No salesperson"/> + <filter string="Unassigned" name="unassigned" domain="[('user_id','=', False)]" help="No salesperson"/> <filter string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]" help="Unread messages"/> <filter string="Assigned to Me" domain="[('user_id','=',uid)]" context="{'invisible_section': False}" @@ -428,9 +429,9 @@ </group> <group> - <field name="user_id" context="{'default_groups_ref': ['base.group_user', 'base.group_sale_salesman_all_leads']}"/> - <label for="section_id"/> - <div> + <field name="user_id" on_change="onchange_user_id(section_id, user_id)" context="{'default_groups_ref': ['base.group_user', 'base.group_sale_salesman_all_leads']}"/> + <label for="section_id" groups="base.group_multi_salesteams"/> + <div groups="base.group_multi_salesteams"> <field name="section_id" widget="selection"/> <button name="case_escalate" string="Escalate" type="object" class="oe_link" attrs="{'invisible': ['|', ('section_id','=',False), ('state', 'not in', ['draft','open','pending'])]}"/> </div> @@ -526,7 +527,7 @@ <field name="stage_id"/> <field name="planned_revenue" sum="Expected Revenues"/> <field name="probability" avg="Avg. of Probability"/> - <field name="section_id" invisible="context.get('invisible_section', True)"/> + <field name="section_id" invisible="context.get('invisible_section', True)" groups="base.group_multi_salesteams"/> <field name="user_id"/> <field name="referred" invisible="1"/> <field name="priority" invisible="1"/> @@ -545,7 +546,7 @@ <search string="Search Opportunities"> <field name="name" string="Opportunity" 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="section_id" context="{'invisible_section': False, 'default_section_id': self}"/> + <field name="section_id" context="{'invisible_section': False}" groups="base.group_multi_salesteams"/> <field name="user_id"/> <field name="partner_id"/> <separator/> @@ -553,7 +554,7 @@ <filter string="In Progress" name="open" domain="[('state','=','open')]" help="Open Opportunities"/> <filter string="Won" name="won" domain="[('state','=','done')]"/> <filter string="Lost" name="lost" domain="[('state','=','cancel')]"/> - <filter string="Unassigned" domain="[('user_id','=', False)]" help="No salesperson"/> + <filter string="Unassigned" name="unassigned" domain="[('user_id','=', False)]" help="No salesperson"/> <filter string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]" help="Unread messages"/> <filter string="Assigned to Me" domain="[('user_id','=',uid)]" context="{'invisible_section': False}" diff --git a/addons/crm/crm_phonecall_view.xml b/addons/crm/crm_phonecall_view.xml index 67df85e6178..3efb54f98b8 100644 --- a/addons/crm/crm_phonecall_view.xml +++ b/addons/crm/crm_phonecall_view.xml @@ -103,7 +103,8 @@ <field name="date"/> <field name="user_id"/> <field name="duration" widget="float_time"/> - <field name="section_id" colspan="1" widget="selection"/> + <field name="section_id" colspan="1" widget="selection" + groups="base.group_multi_salesteams"/> <field name="partner_id" on_change="onchange_partner_id(partner_id)"/> <field name="email_from" invisible="1"/> <!--not needed because of the chatter, thus invisible, but must be in the view as it's returned by onchange_partner_id()--> <field name="categ_id" widget="selection" @@ -187,7 +188,8 @@ help="Phone Calls Assigned to the current user or with a team having the current user as team leader"/> <field name="partner_id"/> <field name="user_id"/> - <field name="section_id" string="Sales Team"/> + <field name="section_id" string="Sales Team" + groups="base.group_multi_salesteams"/> <group expand="0" string="Group By..."> <filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/> <filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/> diff --git a/addons/crm/crm_report_view.xml b/addons/crm/crm_report_view.xml index 355d862c898..39a2967c947 100644 --- a/addons/crm/crm_report_view.xml +++ b/addons/crm/crm_report_view.xml @@ -12,7 +12,7 @@ <field name="name"/> <field name="month"/> <field name="user_id"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> <field name="category2_id"/> <field name="stage_id"/> <field name="amount_revenue"/> @@ -33,7 +33,8 @@ <field name="name"/> <field name="month"/> <field name="user_id"/> - <field name="section_id" widget="selection"/> + <field name="section_id" widget="selection" + groups="base.group_multi_salesteams"/> <field name="category2_id" /> <field name="stage_id"/> <field name="amount_revenue"/> @@ -53,7 +54,8 @@ <graph string="Cases by Teams and Type" type="bar" orientation="horizontal"> <field name="category2_id"/> <field name="amount_revenue" operator="+"/> - <field name="section_id" group="True"/> + <field name="section_id" group="True" + groups="base.group_multi_salesteams"/> </graph> </field> </record> @@ -69,7 +71,7 @@ <field name="month"/> <field name="nbr"/> <field name="state"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> <field name="category2_id"/> </search> </field> @@ -95,7 +97,7 @@ <field name="name"/> <field name="month"/> <field name="user_id"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> <field name="stage_id"/> <field name="amount_revenue"/> <field name="nbr"/> @@ -115,7 +117,8 @@ <field name="name"/> <field name="month"/> <field name="user_id"/> - <field name="section_id" widget="selection"/> + <field name="section_id" widget="selection" + groups="base.group_multi_salesteams"/> <field name="stage_id"/> <field name="amount_revenue"/> <field name="nbr" /> @@ -134,7 +137,7 @@ <graph string="Cases by Team and Stage" type="bar" orientation="horizontal"> <field name="stage_id"/> <field name="amount_revenue" operator="+"/> - <field name="section_id" group="True"/> + <field name="section_id" group="True" groups="base.group_multi_salesteams"/> </graph> </field> </record> @@ -150,7 +153,7 @@ <field name="month"/> <field name="nbr"/> <field name="state"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> </search> </field> </record> @@ -175,7 +178,7 @@ <field name="name"/> <field name="month"/> <field name="user_id"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> <field name="categ_id"/> <field name="stage_id"/> <field name="nbr"/> @@ -195,7 +198,7 @@ <field name="name"/> <field name="month"/> <field name="user_id"/> - <field name="section_id" widget="selection"/> + <field name="section_id" widget="selection" groups="base.group_multi_salesteams"/> <field name="categ_id"/> <field name="stage_id"/> <field name="nbr" /> @@ -216,7 +219,7 @@ <field name="month"/> <field name="nbr"/> <field name="state"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> </search> </field> </record> @@ -230,7 +233,7 @@ <graph string="Cases by Section, Category and Stage" type="bar" orientation="horizontal"> <field name="categ_id"/> <field name="nbr" operator="+"/> - <field name="section_id" group="True"/> + <field name="section_id" group="True" groups="base.group_multi_salesteams"/> </graph> </field> </record> @@ -255,7 +258,7 @@ <field name="name"/> <field name="month"/> <field name="user_id"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> <field name="categ_id"/> <field name="category2_id"/> <field name="stage_id"/> @@ -276,7 +279,7 @@ <field name="name"/> <field name="month"/> <field name="user_id"/> - <field name="section_id" widget="selection"/> + <field name="section_id" widget="selection" groups="base.group_multi_salesteams"/> <field name="categ_id"/> <field name="category2_id"/> <field name="stage_id"/> @@ -298,7 +301,7 @@ <field name="month"/> <field name="nbr"/> <field name="state"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> </search> </field> </record> @@ -312,7 +315,7 @@ <graph string="Cases by Section, Category and Type" type="bar" orientation="horizontal"> <field name="category2_id"/> <field name="nbr" operator="+"/> - <field name="section_id" group="True"/> + <field name="section_id" group="True" groups="base.group_multi_salesteams"/> </graph> </field> </record> diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml index 2c156ca2ac2..63385fa3e17 100644 --- a/addons/crm/crm_view.xml +++ b/addons/crm/crm_view.xml @@ -70,109 +70,6 @@ <menuitem action="crm_case_channel_action" id="menu_crm_case_channel" parent="base.menu_crm_config_lead" sequence="4" groups="base.group_no_one"/> - <!-- Case Sections Form View --> - - <record id="crm_case_section_view_form" model="ir.ui.view"> - <field name="name">crm.case.section.form</field> - <field name="model">crm.case.section</field> - <field name="arch" type="xml"> - <form string="Sales Team" version="7.0"> - <group> - <group> - <field name="name" colspan="2"/> - <field name="parent_id"/> - <field name="code"/> - </group> - - <group> - <field name="user_id"/> - <field name="resource_calendar_id"/> - <field name="active"/> - </group> - </group> - <notebook colspan="4"> - <page string="Sales Team"> - <group> - <field name="alias_id" invisible="1" required="0"/> - <label for="alias_name" attrs="{'invisible': [('alias_domain', '=', False)]}"/> - <div attrs="{'invisible': [('alias_domain', '=', False)]}"> - <field name="alias_name" class="oe_inline" attrs="{'required': [('alias_id', '!=', False)]}"/>@<field name="alias_domain" class="oe_inline"/> - </div> - <field name="change_responsible"/> - </group> - <separator string="Team Members"/> - <field name="member_ids" widget="many2many_kanban"> - <kanban quick_create="false" create="true"> - <field name="name"/> - <templates> - <t t-name="kanban-box"> - <div style="position: relative"> - <a t-if="! read_only_mode" type="delete" style="position: absolute; right: 0; padding: 4px; diplay: inline-block">X</a> - <div class="oe_module_vignette"> - <div class="oe_module_desc"> - <field name="name"/> - </div> - </div> - </div> - </t> - </templates> - </kanban> - </field> - </page> - <page string="Stages"> - <separator string="Select Stages for this Sales Team"/> - <field name="stage_ids"/> - </page> - <page string="Notes"> - <field name="note"/> - </page> - </notebook> - <div class="oe_chatter"> - <field name="message_follower_ids" widget="mail_followers" help="Follow this salesteam to automatically track the events associated to users of this team."/> - <field name="message_ids" widget="mail_thread"/> - </div> - </form> - </field> - </record> - - <!-- Case Sections Tree View --> - - <record id="crm_case_section_view_tree" model="ir.ui.view"> - <field name="name">crm.case.section.tree</field> - <field name="model">crm.case.section</field> - <field name="field_parent">child_ids</field> - <field name="arch" type="xml"> - <tree string="Sales Team"> - <field name="name"/> - <field name="code"/> - <field name="user_id"/> - </tree> - </field> - </record> - - <!-- Case Sections Action --> - - <record id="crm_case_section_act" model="ir.actions.act_window"> - <field name="name">Sales Teams</field> - <field name="res_model">crm.case.section</field> - <field name="view_type">form</field> - <field name="view_id" ref="crm_case_section_view_tree"/> - <field name="help" type="html"> - <p class="oe_view_nocontent_create"> - Click to define a new sales team. - </p><p> - Use sales team to organize your different salespersons or - departments into separate teams. Each team will work in - its own list of opportunities. - </p> - </field> - </record> - - <menuitem action="crm_case_section_act" - id="menu_crm_case_section_act" sequence="15" - parent="base.menu_base_config" groups="base.group_sale_manager"/> - - <!-- CRM Stage Tree View --> <record model="ir.ui.view" id="crm_case_stage_tree"> @@ -233,7 +130,7 @@ <form string="Case Category" version="7.0"> <group> <field name="name"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> <field name="object_id" invisible="1"/> </group> </form> @@ -248,7 +145,7 @@ <field name="arch" type="xml"> <tree string="Case Category"> <field name="name"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> </tree> </field> </record> @@ -261,7 +158,7 @@ <field name="arch" type="xml"> <tree string="Campaign"> <field name="name"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> </tree> </field> </record> @@ -275,7 +172,7 @@ <form string="Campaign" version="7.0"> <group> <field name="name"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> </group> </form> </field> @@ -295,13 +192,6 @@ groups="base.group_no_one" parent="base.menu_crm_config_lead"/> - <record id="crm_case_section_act_tree" model="ir.actions.act_window"> - <field name="name">Cases by Sales Team</field> - <field name="res_model">crm.case.section</field> - <field name="domain">[('parent_id','=',False)]</field> - <field name="view_type">tree</field> - <field name="view_id" ref="crm_case_section_view_tree"/> - </record> <!-- Segmentation line Tree View --> @@ -434,7 +324,7 @@ <field name="arch" type="xml"> <tree string="Payment Mode"> <field name="name"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> </tree> </field> </record> @@ -448,7 +338,7 @@ <form string="Payment Mode" version="7.0"> <group> <field name="name"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> </group> </form> </field> diff --git a/addons/crm/report/crm_lead_report_view.xml b/addons/crm/report/crm_lead_report_view.xml index 0e5df8837f1..1009e1c376d 100644 --- a/addons/crm/report/crm_lead_report_view.xml +++ b/addons/crm/report/crm_lead_report_view.xml @@ -19,7 +19,8 @@ <field name="channel_id" invisible="1"/> <field name="type" invisible="1"/> <field name="priority" invisible="1"/> - <field name="section_id" invisible="1"/> + <field name="section_id" invisible="1" + groups="base.group_multi_salesteams"/> <field name="user_id" invisible="1"/> <field name="company_id" invisible="1"/> <field name="partner_id" invisible="1"/> @@ -77,7 +78,8 @@ help="Leads/Opportunities that are assigned to one of the sale teams I manage"/> <separator/> <filter icon="terp-personal" string="My Case(s)" help="Leads/Opportunities that are assigned to me" domain="[('user_id','=',uid)]"/> - <field name="section_id" context="{'invisible_section': False}"/> + <field name="section_id" context="{'invisible_section': False}" + groups="base.group_multi_salesteams"/> <field name="user_id" string="Salesperson"/> <group expand="0" string="Extended Filters..."> <field name="partner_id"/> @@ -134,7 +136,8 @@ <field name="creation_month" invisible="1"/> <field name="creation_day" invisible="1"/> <field name="deadline_month" invisible="1"/> - <field name="section_id" invisible="1"/> + <field name="section_id" invisible="1" + groups="base.group_multi_salesteams"/> <field name="user_id" invisible="1"/> <field name="partner_id" invisible="1"/> <field name="country_id" invisible="1"/> diff --git a/addons/crm/report/crm_phonecall_report_view.xml b/addons/crm/report/crm_phonecall_report_view.xml index 1f1a4f91046..c27d876ddd7 100644 --- a/addons/crm/report/crm_phonecall_report_view.xml +++ b/addons/crm/report/crm_phonecall_report_view.xml @@ -11,7 +11,8 @@ <tree string="Phone calls" create="false"> <field name="name" invisible="1"/> <field name="month" invisible="1"/> - <field name="section_id" invisible="1"/> + <field name="section_id" invisible="1" + groups="base.group_multi_salesteams"/> <field name="priority" invisible="1"/> <field name="user_id" invisible="1"/> <field name="company_id" invisible="1"/> @@ -59,7 +60,8 @@ help="Phone calls that are assigned to one of the sale teams I manage"/> <separator/> <filter icon="terp-personal" string="My Phone Calls" help="Phone Calls that are assigned to me" domain="[('user_id','=',uid)]" /> - <field name="section_id" string="Sales Team" context="{'invisible_section': False}"/> + <field name="section_id" string="Sales Team" context="{'invisible_section': False}" + groups="base.group_multi_salesteams"/> <field name="user_id" string="Salesperson"/> <group expand="0" string="Extended Filters..."> <field name="partner_id"/> diff --git a/addons/crm/res_config.py b/addons/crm/res_config.py index 229ad0189ff..ea37c24fe06 100644 --- a/addons/crm/res_config.py +++ b/addons/crm/res_config.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Business Applications -# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>). +# Copyright (C) 2004-TODAY OpenERP S.A. (<http://openerp.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -21,24 +21,51 @@ from openerp.osv import fields, osv -class crm_configuration(osv.osv_memory): + +class crm_configuration(osv.TransientModel): _name = 'sale.config.settings' _inherit = ['sale.config.settings', 'fetchmail.config.settings'] + def set_group_multi_salesteams(self, cr, uid, ids, context=None): + """ This method is automatically called by res_config as it begins + with set. It is used to implement the 'one group or another' + behavior. We have to perform some group manipulation by hand + because in res_config.execute(), set_* methods are called + after group_*; therefore writing on an hidden res_config file + could not work. + If group_multi_salesteams is checked: remove group_mono_salesteams + from group_user, remove the users. Otherwise, just add + group_mono_salesteams in group_user. + The inverse logic about group_multi_salesteams is managed by the + normal behavior of 'group_multi_salesteams' field. + """ + def ref(xml_id): + mod, xml = xml_id.split('.', 1) + return self.pool['ir.model.data'].get_object(cr, uid, mod, xml, context) + + for obj in self.browse(cr, uid, ids, context=context): + config_group = ref('base.group_mono_salesteams') + base_group = ref('base.group_user') + if obj.group_multi_salesteams: + base_group.write({'implied_ids': [(3, config_group.id)]}) + config_group.write({'users': [(3, u.id) for u in base_group.users]}) + else: + base_group.write({'implied_ids': [(4, config_group.id)]}) + return True + _columns = { - 'fetchmail_lead': fields.boolean("Create leads from incoming mails", - fetchmail_model='crm.lead', fetchmail_name='Incoming Leads', - help="""Allows you to configure your incoming mail server, and create leads from incoming emails."""), 'group_fund_raising': fields.boolean("Manage Fund Raising", implied_group='crm.group_fund_raising', help="""Allows you to trace and manage your activities for fund raising."""), - 'module_crm_claim':fields.boolean("Manage Customer Claims", + 'module_crm_claim': fields.boolean("Manage Customer Claims", help="""Allows you to track your customers/suppliers claims and grievances. This installs the module crm_claim."""), - 'module_crm_helpdesk':fields.boolean("Manage Helpdesk and Support", - help="""Allows you to communicate with Customer, process Customer query, and provide better help and support. This installs the module crm_helpdesk."""), - - + 'module_crm_helpdesk': fields.boolean("Manage Helpdesk and Support", + help="""Allows you to communicate with Customer, process Customer query, and provide better help and support. This installs the module crm_helpdesk."""), + 'group_multi_salesteams': fields.boolean("Organize Sales activities into multiple Sales Teams", + implied_group='base.group_multi_salesteams', + help="""Allows you to use Sales Teams to manage your leads and opportunities."""), } + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm/res_config_view.xml b/addons/crm/res_config_view.xml index 9534c8620ee..547ce1c2ae6 100644 --- a/addons/crm/res_config_view.xml +++ b/addons/crm/res_config_view.xml @@ -22,20 +22,15 @@ </div> </div> </group> - </div> - <group name="On Mail Client" version="7.0" position="after"> + <separator string="Sales Teams Configuration"/> <group> - <label for="id" string="On Mail Server"/> + <label for="id" string="Use Sales Teams"/> <div> - <div name="fetchmail_lead"> - <field name="fetchmail_lead" class="oe_inline"/> - <label for="fetchmail_lead"/> - <button name="configure_fetchmail_lead" type="object" string="Configure" icon="gtk-go-forward" - attrs="{'invisible': [('fetchmail_lead','=',False)]}" class="oe_link"/> - </div> + <field name="group_multi_salesteams" class="oe_inline"/> + <label for="group_multi_salesteams"/> </div> </group> - </group> + </div> </field> </record> diff --git a/addons/crm/res_partner_view.xml b/addons/crm/res_partner_view.xml index 00a071fa954..dd6c50dbaba 100644 --- a/addons/crm/res_partner_view.xml +++ b/addons/crm/res_partner_view.xml @@ -10,7 +10,7 @@ <field eval="18" name="priority"/> <field name="arch" type="xml"> <field name="user_id" position="after"> - <field name="section_id" completion="1"/> + <field name="section_id" completion="1" groups="base.group_multi_salesteams"/> </field> </field> </record> @@ -30,8 +30,11 @@ <field name="res_model">crm.lead</field> <field name="view_mode">kanban,tree,form,graph,calendar</field> <field name="domain">[('type','=','opportunity')]</field> - <field name="context">{'search_default_partner_id': active_id, - 'stage_type': 'opportunity', 'default_type': 'opportunity'}</field> + <field name="context">{ + 'search_default_partner_id': active_id, + 'stage_type': 'opportunity', + 'default_type': 'opportunity' + }</field> <field name="view_id" eval="False"/> <field name="search_view_id" ref="crm.view_crm_case_opportunities_filter"/> <field name="help" type="html"> diff --git a/addons/crm/security/crm_security.xml b/addons/crm/security/crm_security.xml index 2c34252209c..34137dc0fac 100644 --- a/addons/crm/security/crm_security.xml +++ b/addons/crm/security/crm_security.xml @@ -22,6 +22,19 @@ <field name="implied_ids" eval="[(4, ref('base.group_sale_salesman_all_leads'))]"/> <field name="users" eval="[(4, ref('base.user_root'))]"/> </record> + + <record id="base.group_mono_salesteams" model="res.groups"> + <field name="name">Do Not Use Sales Teams</field> + <field name="category_id" ref="base.module_category_hidden"/> + </record> + <record id="base.group_user" model="res.groups"> + <field name="implied_ids" eval="[(4, ref('base.group_mono_salesteams'))]"/> + </record> + + <record id="base.group_multi_salesteams" model="res.groups"> + <field name="name">Manage Sales Teams</field> + <field name="category_id" ref="base.module_category_hidden"/> + </record> <record id="group_fund_raising" model="res.groups"> <field name="name">Manage Fund Raising</field> diff --git a/addons/crm/static/src/css/crm.css b/addons/crm/static/src/css/crm.css new file mode 100644 index 00000000000..3ad3840a4e1 --- /dev/null +++ b/addons/crm/static/src/css/crm.css @@ -0,0 +1,42 @@ +.openerp .oe_kanban_view .oe_kanban_crm_salesteams { + width: 345px; +} +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_avatars { + text-align: right; + margin: -5px 0 -10px 0; +} + +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_avatars img { + width: 30px; + height: 30px; + padding-left: 0px; + margin-top: 3px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + border-radius: 2px; + -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); + -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); +} + +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_items_list { + margin: 10px 0; +} +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_items_list a { + width: 110px; + display: inline-block; +} +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_items_list a:hover { + text-decoration: underline !important; +} +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_center { + text-align: center; + margin: 3px 0; +} +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_center .oe_sum { + margin: 0; + font-size: 40px; +} +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_center .oe_subsum { + font-size: 10px; +} diff --git a/addons/crm/static/src/js/crm.js b/addons/crm/static/src/js/crm.js new file mode 100644 index 00000000000..e027313d6dc --- /dev/null +++ b/addons/crm/static/src/js/crm.js @@ -0,0 +1,11 @@ +openerp.crm = function(openerp) { + openerp.web_kanban.KanbanRecord.include({ + on_card_clicked: function() { + if (this.view.dataset.model === 'crm.case.section') { + this.$('.oe_kanban_crm_salesteams_list a').first().click(); + } else { + this._super.apply(this, arguments); + } + }, + }); +}; diff --git a/addons/crm/wizard/crm_lead_to_opportunity_view.xml b/addons/crm/wizard/crm_lead_to_opportunity_view.xml index 00686de1c8e..4093df910d0 100644 --- a/addons/crm/wizard/crm_lead_to_opportunity_view.xml +++ b/addons/crm/wizard/crm_lead_to_opportunity_view.xml @@ -22,7 +22,7 @@ <field name="phone"/> <field name="stage_id"/> <field name="user_id"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> </tree> </field> </group> @@ -68,13 +68,13 @@ <field name="phone"/> <field name="stage_id"/> <field name="user_id"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> </tree> </field> </group> <group string="Assign opportunities to" attrs="{'invisible': [('name', '=', '')]}"> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> <field name="user_ids" widget="many2many_tags"/> </group> diff --git a/addons/crm/wizard/crm_merge_opportunities_view.xml b/addons/crm/wizard/crm_merge_opportunities_view.xml index f68abeb8a52..919d83cb9a7 100644 --- a/addons/crm/wizard/crm_merge_opportunities_view.xml +++ b/addons/crm/wizard/crm_merge_opportunities_view.xml @@ -19,7 +19,7 @@ <field name="phone"/> <field name="stage_id"/> <field name="user_id"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> </tree> </field> <footer> diff --git a/addons/crm/wizard/crm_opportunity_to_phonecall_view.xml b/addons/crm/wizard/crm_opportunity_to_phonecall_view.xml index ad369448517..846d71d74da 100644 --- a/addons/crm/wizard/crm_opportunity_to_phonecall_view.xml +++ b/addons/crm/wizard/crm_opportunity_to_phonecall_view.xml @@ -23,7 +23,7 @@ <field name="partner_id" readonly="True"/> <field name="phone"/> <field name="user_id" attrs="{'invisible': [('action','=','log')]}"/> - <field name="section_id" widget="selection" attrs="{'invisible': [('action','=','log')]}"/> + <field name="section_id" widget="selection" attrs="{'invisible': [('action','=','log')]}" groups="base.group_multi_salesteams"/> </group> </group> <field name="note" placeholder="Call Description" /> diff --git a/addons/crm/wizard/crm_phonecall_to_phonecall_view.xml b/addons/crm/wizard/crm_phonecall_to_phonecall_view.xml index e2d25218749..812468b17e6 100644 --- a/addons/crm/wizard/crm_phonecall_to_phonecall_view.xml +++ b/addons/crm/wizard/crm_phonecall_to_phonecall_view.xml @@ -15,7 +15,7 @@ <field name="date" string="Planned Date" attrs="{'invisible': [('action','=','log')]}"/> <field name="partner_id" readonly="True"/> <field name="user_id"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> </group> <footer> <button name="action_schedule" type="object" string="Log Call" attrs="{'invisible' : [('action', '!=', 'log')]}" class="oe_highlight"/> diff --git a/addons/crm_claim/__init__.py b/addons/crm_claim/__init__.py index 2012c227adf..7395ea83fe5 100644 --- a/addons/crm_claim/__init__.py +++ b/addons/crm_claim/__init__.py @@ -21,7 +21,6 @@ import crm_claim import report -import res_config # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm_claim/__openerp__.py b/addons/crm_claim/__openerp__.py index 78dfba2ed53..61257265f1b 100644 --- a/addons/crm_claim/__openerp__.py +++ b/addons/crm_claim/__openerp__.py @@ -41,7 +41,6 @@ automatically new claims based on incoming emails. 'crm_claim_menu.xml', 'security/ir.model.access.csv', 'report/crm_claim_report_view.xml', - 'res_config_view.xml', 'crm_claim_data.xml', ], 'demo': ['crm_claim_demo.xml'], diff --git a/addons/crm_claim/crm_claim_view.xml b/addons/crm_claim/crm_claim_view.xml index b1ab72e20f6..78e467a7ba8 100644 --- a/addons/crm_claim/crm_claim_view.xml +++ b/addons/crm_claim/crm_claim_view.xml @@ -116,7 +116,7 @@ <group colspan="4" col="4" groups="base.group_user"> <field name="user_id"/> <field name="priority"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> <field name="date_deadline"/> <field name="state" groups="base.group_no_one"/> </group> diff --git a/addons/crm_claim/report/crm_claim_report_view.xml b/addons/crm_claim/report/crm_claim_report_view.xml index a61490c6086..febf9cafd73 100644 --- a/addons/crm_claim/report/crm_claim_report_view.xml +++ b/addons/crm_claim/report/crm_claim_report_view.xml @@ -11,7 +11,8 @@ <tree string="Claims" create="false"> <field name="name" invisible="1"/> <field name="month" invisible="1"/> - <field name="section_id" invisible="1"/> + <field name="section_id" invisible="1" + groups="base.group_multi_salesteams"/> <field name="user_id" invisible="1"/> <field name="company_id" invisible="1"/> <field name="partner_id" invisible="1"/> @@ -61,7 +62,8 @@ <filter icon="terp-personal" string="My Case(s)" help="My Case(s)" domain="[('user_id','=',uid)]" /> <field name="company_id" groups="base.group_multi_company"/> <field name="user_id" string="Salesperson"/> - <field name="section_id" string="Sales Team" context="{'invisible_section': False}"/> + <field name="section_id" string="Sales Team" context="{'invisible_section': False}" + groups="base.group_multi_salesteams"/> <group expand="0" string="Extended Filters..."> <field name="partner_id"/> <field name="stage_id" domain="[('section_ids', '=', 'section_id')]"/> diff --git a/addons/crm_claim/res_config.py b/addons/crm_claim/res_config.py deleted file mode 100644 index aa0cb7ffa20..00000000000 --- a/addons/crm_claim/res_config.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Business Applications -# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# 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/>. -# -############################################################################## - -from openerp.osv import fields, osv - -class crm_claim_settings(osv.osv_memory): - _name = 'sale.config.settings' - _inherit = ['sale.config.settings', 'fetchmail.config.settings'] - - _columns = { - 'fetchmail_claim': fields.boolean("Create claims from incoming mails", - fetchmail_model='crm.claim', fetchmail_name='Incoming Claims', - help="""Allows you to configure your incoming mail server, and create claims from incoming emails."""), - } diff --git a/addons/crm_claim/res_config_view.xml b/addons/crm_claim/res_config_view.xml deleted file mode 100644 index 79474f1fb00..00000000000 --- a/addons/crm_claim/res_config_view.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<openerp> - <data> - - <record id="view_project_config_claim" model="ir.ui.view"> - <field name="name">crm_claim settings</field> - <field name="model">sale.config.settings</field> - <field name="inherit_id" ref="base_setup.view_sale_config_settings"/> - <field name="priority" eval="20"/> - <field name="arch" type="xml"> - <div name="fetchmail_lead" position="after"> - <div> - <field name="fetchmail_claim" class="oe_inline"/> - <label for="fetchmail_claim"/> - <button type="object" name="configure_fetchmail_claim" string="Configure" icon="gtk-go-forward" - attrs="{'invisible': [('fetchmail_claim','=',False)]}" class="oe_link"/> - </div> - </div> - </field> - </record> - - </data> -</openerp> diff --git a/addons/crm_helpdesk/crm_helpdesk_view.xml b/addons/crm_helpdesk/crm_helpdesk_view.xml index 6c0e3433afe..6769b42a7f8 100644 --- a/addons/crm_helpdesk/crm_helpdesk_view.xml +++ b/addons/crm_helpdesk/crm_helpdesk_view.xml @@ -48,7 +48,7 @@ <sheet string="Helpdesk Support"> <group col="4" class="oe_header"> <field name="name" string="Query"/> - <field name="section_id" widget="selection"/> + <field name="section_id" widget="selection" groups="base.group_multi_salesteams"/> <field name="user_id"/> <field name="date"/> <field name="date_deadline"/> @@ -115,7 +115,7 @@ <field name="date" string="Date"/> <field name="date_deadline"/> <field name="user_id"/> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> <field name="priority"/> <field name="state"/> </tree> @@ -154,7 +154,7 @@ help="Helpdesk requests that are assigned to me or to one of the sale teams I manage" /> <field name="partner_id" /> <field name="user_id"/> - <field name="section_id" string="Sales Team"/> + <field name="section_id" string="Sales Team" groups="base.group_multi_salesteams"/> <group expand="0" string="Group By..."> <filter string="Partner" icon="terp-partner" domain="[]" help="Partner" context="{'group_by':'partner_id'}" /> <filter string="Responsible" icon="terp-personal" domain="[]" help="Responsible User" context="{'group_by':'user_id'}" /> diff --git a/addons/crm_helpdesk/report/crm_helpdesk_report_view.xml b/addons/crm_helpdesk/report/crm_helpdesk_report_view.xml index 05f502656d2..795ae210d8d 100644 --- a/addons/crm_helpdesk/report/crm_helpdesk_report_view.xml +++ b/addons/crm_helpdesk/report/crm_helpdesk_report_view.xml @@ -11,7 +11,7 @@ <tree string="Helpdesk" create="false"> <field name="name" invisible="1"/> <field name="month" invisible="1"/> - <field name="section_id" invisible="1"/> + <field name="section_id" invisible="1" groups="base.group_multi_salesteams"/> <field name="user_id" invisible="1"/> <field name="company_id" invisible="1"/> <field name="partner_id" invisible="1"/> @@ -60,7 +60,7 @@ <separator/> <filter string="My Company" icon="terp-go-home" context="{'invisible_section': False}" domain="[('section_id.user_id.company_id','=',uid)]" help="My company"/> <field name="user_id" string="Salesperson"/> - <field name="section_id" string="Sales Team" context="{'invisible_section': False}"/> + <field name="section_id" string="Sales Team" context="{'invisible_section': False}" groups="base.group_multi_salesteams"/> <field name="company_id" groups="base.group_multi_company"/> <group expand="0" string="Extended Filters..." groups="base.group_no_one"> <field name="priority" string="Priority"/> diff --git a/addons/crm_partner_assign/report/crm_lead_report_view.xml b/addons/crm_partner_assign/report/crm_lead_report_view.xml index ee9266a0235..fbc46302fd7 100644 --- a/addons/crm_partner_assign/report/crm_lead_report_view.xml +++ b/addons/crm_partner_assign/report/crm_lead_report_view.xml @@ -10,7 +10,7 @@ <search string="Leads Analysis"> <filter icon="terp-check" string="Current" domain="[('state','in',('draft','open'))]"/> <filter icon="terp-dialog-close" string="Closed" domain="[('state','=','done')]"/> - <field name="section_id" context="{'invisible_section': False}"/> + <field name="section_id" context="{'invisible_section': False}" groups="base.group_multi_salesteams"/> <field name="grade_id"/> <field name="user_id"/> <field name="partner_assigned_id"/> @@ -69,7 +69,7 @@ <field name="year" invisible="1"/> <field name="month" invisible="1"/> <field name="date_assign" invisible="1"/> - <field name="section_id" invisible="1"/> + <field name="section_id" invisible="1" groups="base.group_multi_salesteams"/> <field name="user_id" invisible="1"/> <field name="grade_id" invisible="1" widget="selection"/> <field name="partner_assigned_id" invisible="1"/> diff --git a/addons/crm_partner_assign/report/crm_partner_report_view.xml b/addons/crm_partner_assign/report/crm_partner_report_view.xml index eb2c86874c4..4e7e13afb15 100644 --- a/addons/crm_partner_assign/report/crm_partner_report_view.xml +++ b/addons/crm_partner_assign/report/crm_partner_report_view.xml @@ -8,7 +8,7 @@ <field name="model">crm.partner.report.assign</field> <field name="arch" type="xml"> <search string="Partner assigned Analysis"> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> <field name="user_id"/> <field name="grade_id"/> <field name="activation"/> @@ -49,7 +49,7 @@ <field name="date_review" invisible="1"/> <field name="date_partnership" invisible="1"/> <field name="period_id" invisible="1"/> - <field name="section_id" invisible="1"/> + <field name="section_id" invisible="1" groups="base.group_multi_salesteams"/> <field name="user_id" invisible="1"/> <field name="opp"/> <field name="turnover"/> diff --git a/addons/crm_partner_assign/res_partner_view.xml b/addons/crm_partner_assign/res_partner_view.xml index 433a290ae81..9e70835a3f1 100644 --- a/addons/crm_partner_assign/res_partner_view.xml +++ b/addons/crm_partner_assign/res_partner_view.xml @@ -140,30 +140,31 @@ <field name="type"/> <field name="stage_id"/> <button name="stage_previous" string="Previous" - states="open,pending" type="object" icon="gtk-go-back" /> + states="open,pending" type="object" icon="gtk-go-back" /> <button name="stage_next" string="Next" - states="open,pending" type="object" - icon="gtk-go-forward" /> + states="open,pending" type="object" + icon="gtk-go-forward" /> <field name="section_id" - invisible="context.get('invisible_section', True)" /> + invisible="context.get('invisible_section', True)" + groups="base.group_multi_salesteams"/> <field name="user_id" /> <field name="state" /> <button name="case_cancel" string="Cancel" - states="draft,open,pending" type="object" - icon="gtk-cancel" /> + states="draft,open,pending" type="object" + icon="gtk-cancel" /> <button name="case_open" string="Open" - states="draft,pending" type="object" - icon="gtk-go-forward" /> + states="draft,pending" type="object" + icon="gtk-go-forward" /> <button name="case_close" string="Close" - states="open,draft,pending" type="object" - icon="gtk-close" /> + states="open,draft,pending" type="object" + icon="gtk-close" /> <button string="Convert to Opportunity" - name="convert_opportunity" - states="draft,open,pending" icon="gtk-index" - type="object" attrs="{'invisible':[('type','=','opportunity')]}" /> + name="convert_opportunity" + states="draft,open,pending" icon="gtk-index" + type="object" attrs="{'invisible':[('type','=','opportunity')]}" /> <button name="case_escalate" string="Escalate" - states="open,draft,pending" type="object" - icon="gtk-go-up" /> + states="open,draft,pending" type="object" + icon="gtk-go-up" /> </tree> </field> </page> diff --git a/addons/crm_todo/crm_todo_view.xml b/addons/crm_todo/crm_todo_view.xml index 0b3de338808..851c2abfba4 100644 --- a/addons/crm_todo/crm_todo_view.xml +++ b/addons/crm_todo/crm_todo_view.xml @@ -52,11 +52,10 @@ <field name="view_type">form</field> <field name="view_mode">tree,form,calendar,gantt,graph,kanban</field> </record> - <menuitem - id="menu_crm_todo" - parent="base.menu_sales" - action="crm_todo_action" - sequence="6"/> + <menuitem id="menu_crm_todo" + parent="base.menu_sales" + action="crm_todo_action" + sequence="7"/> </data> diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml index e0c3edfdb39..ccd11bc0dc2 100644 --- a/addons/hr/hr_view.xml +++ b/addons/hr/hr_view.xml @@ -341,7 +341,8 @@ </group> <group> <field name="company_id" widget="selection" groups="base.group_multi_company"/> - <field name="department_id"/> </group> + <field name="department_id"/> + </group> </group> <div> <label for="description"/> diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index deccf10619f..b0b60db6bd5 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -487,6 +487,12 @@ class hr_applicant(base_stage, osv.Model): """ return self.set_priority(cr, uid, ids, '3') + def get_empty_list_help(self, cr, uid, help, context=None): + context['empty_list_help_model'] = 'hr.job' + context['empty_list_help_id'] = context.get('default_job_id', None) + context['empty_list_help_document_name'] = _("job applicants") + return super(hr_applicant, self).get_empty_list_help(cr, uid, help, context=context) + class hr_job(osv.osv): _inherit = "hr.job" diff --git a/addons/hr_recruitment/hr_recruitment_menu.xml b/addons/hr_recruitment/hr_recruitment_menu.xml index dbd4335d730..c280f64105c 100644 --- a/addons/hr_recruitment/hr_recruitment_menu.xml +++ b/addons/hr_recruitment/hr_recruitment_menu.xml @@ -10,17 +10,13 @@ <field name="view_id" eval="False"/> <field name="search_view_id" ref="view_crm_case_jobs_filter"/> <field name="help" type="html"> - <p class="oe_view_nocontent_create"> - Click to add a new job applicant. - </p><p> + <p> OpenERP helps you track applicants in the recruitment process and follow up all operations: meetings, interviews, etc. </p><p> - If you setup the email gateway, applicants and their attached - CV are created automatically when an email is sent to - jobs@yourcompany.com. If you install the document management - modules, all resumes are indexed automatically, so that you can - easily search through their content. + Applicants and their attached CV are created automatically when an email is sent. + If you install the document management modules, all resumes are indexed automatically, + so that you can easily search through their content. </p> </field> </record> diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml index ccf5c8f7934..b531677d538 100644 --- a/addons/hr_recruitment/hr_recruitment_view.xml +++ b/addons/hr_recruitment/hr_recruitment_view.xml @@ -312,11 +312,17 @@ attrs="{'invisible':[('survey_id','=',False)]}"/> </div> </field> - <xpath expr="//div[@class='oe_title']" version="7.0" position="after"> - <div attrs="{'invisible': [('alias_domain', '=', False)]}"> - <field name="alias_id" invisible="1" required="0"/> - <label for="alias_name" class="oe_edit_only"/> - <field name="alias_name" nolabel="1" class="oe_inline" attrs="{'required': [('alias_id', '!=', False)]}"/>@<field name="alias_domain" nolabel="1" class="oe_inline"/> + <xpath expr="//div[@class='oe_title']//h1" position="after"> + <div name="group_alias" + attrs="{'invisible': [('alias_domain', '=', False)]}"> + <label for="alias_id" string="Email Alias"/> + <field name="alias_id" class="oe_inline oe_read_only" required="0" nolabel="1"/> + <span name="edit_alias" class="oe_edit_only"> + <field name="alias_name" class="oe_inline" + attrs="{'required': [('alias_id', '!=', False)]}"/> + @ + <field name="alias_domain" class="oe_inline" readonly="1"/> + </span> </div> </xpath> </field> diff --git a/addons/mail/mail_alias.py b/addons/mail/mail_alias.py index d5e3b675b56..55746b11678 100644 --- a/addons/mail/mail_alias.py +++ b/addons/mail/mail_alias.py @@ -117,8 +117,13 @@ class mail_alias(osv.Model): mail catchall domain from config. e.g. `jobs@openerp.my.openerp.com` or `sales@openerp.my.openerp.com` """ - return [(record['id'], "%s@%s" % (record['alias_name'], record['alias_domain'])) - for record in self.read(cr, uid, ids, ['alias_name', 'alias_domain'], context=context)] + res = [] + for record in self.browse(cr, uid, ids, context=context): + if record.alias_name and record.alias_domain: + res.append((record['id'], "%s@%s" % (record.alias_name, record.alias_domain))) + else: + res.append((record['id'], False)) + return res def _find_unique(self, cr, uid, name, context=None): """Find a unique alias name similar to ``name``. If ``name`` is diff --git a/addons/mail/mail_group_view.xml b/addons/mail/mail_group_view.xml index 5ccee40d5c7..04212b2f58a 100644 --- a/addons/mail/mail_group_view.xml +++ b/addons/mail/mail_group_view.xml @@ -29,6 +29,7 @@ <field name="message_is_follower"/> <field name="message_summary"/> <field name="description"/> + <field name="alias_id"/> <templates> <t t-name="kanban-description"> <div class="oe_group_description" t-if="record.description.raw_value"> @@ -42,6 +43,9 @@ </div> <div class="oe_group_details"> <h4><a type="open"><field name="name"/></a></h4> + <div class="oe_kanban_alias" t-if="record.alias_id.value"> + <span class="oe_e">%%</span><small><field name="alias_id"/></small> + </div> <div class="oe_grey"> <field name="description"/> </div> @@ -68,39 +72,43 @@ <field name="arch" type="xml"> <form string="Group Form" version="7.0"> <sheet class="openerp_mail_group_sheet"> - <field name="image" widget='image' class="oe_avatar oe_left" options='{"preview_image": "image_medium"}'/> + <field name="image" widget='image' class="oe_avatar oe_left" options='{"preview_image": "image_small"}'/> <div class="oe_title"> <div class="oe_edit_only"> <label for="name" string="Group Name"/> </div> <h1><field name="name" readonly="0"/></h1> - <div name="alias_box" colspan="4" attrs="{'invisible': [('alias_domain', '=', False)]}"> - <field name="alias_id" invisible="1" required="0"/> - <label for="alias_name" class="oe_edit_only"/> - <field name="alias_name" nolabel="1" class="oe_inline" attrs="{'required': [('alias_id', '!=', False)]}"/>@<field name="alias_domain" nolabel="1" class="oe_inline"/> + <div name="group_alias" + attrs="{'invisible': [('alias_domain', '=', False)]}"> + <label for="alias_id" string="Email Alias"/> + <field name="alias_id" class="oe_inline oe_read_only" required="0" nolabel="1"/> + <span name="edit_alias" class="oe_edit_only"> + <field name="alias_name" class="oe_inline" + attrs="{'required': [('alias_id', '!=', False)]}"/> + @ + <field name="alias_domain" class="oe_inline" readonly="1"/> + </span> </div> - <field name="description" placeholder="Topics discussed in this group..."/> </div> + <field name="description" placeholder="Topics discussed in this group..."/> <div class="oe_clear"/> - <group> - <group class="oe_edit_only"> - <field name="public"/> - <field name="group_public_id" - attrs="{'invisible': [('public','<>','groups')], 'required': [('public','=','groups')]}" - /> - <field name="group_ids" widget="many2many_tags"/> - </group> - <group> - <div class="oe_grey" attrs="{'invisible': [('public','<>','public')]}"> - This group is visible by everyone, - including your customers if you installed - the portal module. - </div> - <div class="oe_grey" attrs="{'invisible': [('public','<>','private')]}"> - Only the invited followers can read the - discussions on this group. - </div> - </group> + <group class="oe_edit_only"> + <field name="public"/> + <field name="group_public_id" + attrs="{'invisible': [('public','<>','groups')], 'required': [('public','=','groups')]}" + /> + <field name="group_ids" widget="many2many_tags"/> + </group> + <group attrs="{'invisible': [('public', 'not in', ['public', 'private'])]}"> + <div class="oe_grey" attrs="{'invisible': [('public','<>','public')]}"> + This group is visible by everyone, + including your customers if you installed + the portal module. + </div> + <div class="oe_grey" attrs="{'invisible': [('public','<>','private')]}"> + Only the invited followers can read the + discussions on this group. + </div> </group> </sheet> <div class="oe_chatter"> diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index b7720d6c947..7ca9fcb7b53 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -89,6 +89,46 @@ class mail_thread(osv.AbstractModel): # :param function lambda: returns whether the tracking should record using this subtype _track = {} + def get_empty_list_help(self, cr, uid, help, context=None): + """ Override of BaseModel.get_empty_list_help() to generate an help message + that adds alias information. """ + model = context.get('empty_list_help_model') + res_id = context.get('empty_list_help_id') + ir_config_parameter = self.pool.get("ir.config_parameter") + catchall_domain = ir_config_parameter.get_param(cr, uid, "mail.catchall.domain", context=context) + document_name = context.get('empty_list_help_document_name', _('document')) + alias = None + + if catchall_domain and model and res_id: # specific res_id -> find its alias (i.e. section_id specified) + object_id = self.pool.get(model).browse(cr, uid, res_id, context=context) + alias = object_id.alias_id + elif catchall_domain and model: # no specific res_id given -> generic help message, take an example alias (i.e. alias of some section_id) + model_id = self.pool.get('ir.model').search(cr, uid, [("model", "=", self._name)], context=context)[0] + alias_obj = self.pool.get('mail.alias') + alias_ids = alias_obj.search(cr, uid, [("alias_model_id", "=", model_id)], context=context, limit=1, order='id ASC') + if alias_ids: + alias = alias_obj.browse(cr, uid, alias_ids[0], context=context) + + if alias: + alias_email = alias.name_get()[0][1] + return _("""<p class='oe_view_nocontent_create'> + Click here to add a new %(document)s or send an email to: <a href='mailto:%(email)s'>%(email)s</a> + </p> + %(static_help)s""" + ) % { + 'document': document_name, + 'email': alias_email, + 'static_help': help or '' + } + + if document_name != 'document' and help and help.find("oe_view_nocontent_create") == -1: + return _("<p class='oe_view_nocontent_create'>Click here to add a new %(document)s</p>%(static_help)s") % { + 'document': document_name, + 'static_help': help or '', + } + + return help + def _get_message_data(self, cr, uid, ids, name, args, context=None): """ Computes: - message_unread: has uid unread message for the document diff --git a/addons/mail/static/src/css/mail_group.css b/addons/mail/static/src/css/mail_group.css index c1cefee9070..4f2b8a16dd0 100644 --- a/addons/mail/static/src/css/mail_group.css +++ b/addons/mail/static/src/css/mail_group.css @@ -14,6 +14,10 @@ padding: 0px 18px; } +.openerp .oe_form_sheetbg.openerp_mail_group_sheet .oe_avatar { + padding-top: 3px; +} + /* Resize footer width */ .openerp .oe_form div.oe_mail_group_footer { max-width: 80%; @@ -21,7 +25,7 @@ /* Resize group description */ .openerp .oe_form_sheetbg.openerp_mail_group_sheet .oe_form_field_text > textarea { - height: 40px; + height: 60px; } /* ------------------------------ */ diff --git a/addons/point_of_sale/point_of_sale_demo.xml b/addons/point_of_sale/point_of_sale_demo.xml index 011c6d81bfc..1c61218a4cb 100644 --- a/addons/point_of_sale/point_of_sale_demo.xml +++ b/addons/point_of_sale/point_of_sale_demo.xml @@ -430,6 +430,7 @@ <field name="available_in_pos">True</field> <field name="list_price">1.49</field> <field name="name">Coca-Cola Regular 1L</field> + <field name="ean13">5449000054227</field> <field name="pos_categ_id" ref="coke"/> <field name="image">/9j/4AAQSkZJRgABAAEBLAEsAAD/2wCEAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFhEYIx8lJCIfIiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9PjsBCwoKDg0OHBYWHCgoKCgoOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs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Z7CaycwwBJCOMKP6UwKWnNCs5NwhdMdMZ7ikgOi8J3UMnjrQ/sNsIdt/EC4PJBYAj8iaGB9PUxHkXx50Ca4srDXYI2cWxaCcgZ2q3Kk+2cj8RSYHj39najb6d/aD2c62bSeWJmjIRm54DdCeDQncbTTG2lle6iJhY2k0/kx+ZL5SFiq5AycdByKLgdr8H9BuNS8ZwXJhb7PYjzpHK8A4+UZ9SSD9AaSdxuLW59F1RIjKrqVdQykYIIyDQBR1nRNP13SJdL1C3EtrKACg4xjkEEdCKTApeGPBuieEYpk0i2MZuGBkd3LscdBk9vb3oSA2Y4YoQwijSPcdzbVAyfU0wH0AA/9k=</field> </record> @@ -716,6 +717,7 @@ <record id="chaudfontaine_50cl" model="product.product"> <field name="available_in_pos">True</field> <field name="list_price">0.44</field> + <field name="ean13">5449000111715</field> <field name="name">Chaudfontaine 50cl</field> <field name="pos_categ_id" ref="plain_water"/> <field name="image">/9j/4AAQSkZJRgABAAEBLAEsAAD/2wCEAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFhEYIx8lJCIfIiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9PjsBCwoKDg0OHBYWHCgoKCgoOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O//AABEIAGQAJAMBEQACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAA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ea86psdNPc2KwNSrqS7rNuM4NXS+Iip8JwvimSKKxhMi7gJRhcZ5wSMj0yK9XBpuTt2OOrbQk8NKy+JNRXbjbHFngZ6Z55NTiv4EPVl0v4jOsgx9uiA9D0rz5fCzoW5qViaFe9lSKEbj944qoK7Jk0jkvFGmTahZW4trbzylwruowCVwc9cZ/OvQwdZU5O7toc1aDklZdSPwxp99aahfXN5bvH5qxhS5zkgHOOTxVYurCUIqL2uFGMlJto6W3KLex5IBOQAK4ZX5WbppM1KxNDP1faYUDlQuTkscCtKZnUa6meiyKoUF9o7A5qxaj2LqNyll/wA+9AbDLfbFfRscb5HHfJNNq8WSnaR0Fc5uVdRhaa3wq7sHp61dN2ZM1dGBftLDAipByuemRg4rqppNnJVbtYjmYyuskI81VOMEkD8hjNacqWj0MeZ3utTWsIJXlVzEyqDksx61y1Gl1Oyld62NesDcOtAAQD1FAAFA6AUBYKACgAD/2Q==</field> @@ -830,6 +832,7 @@ <record id="jupiler_33cl" model="product.product"> <field name="available_in_pos">True</field> <field name="list_price">0.77</field> + <field name="ean13">5410228142027</field> <field name="name">Jupiler 33cl</field> <field name="pos_categ_id" ref="pils"/> <field name="image">/9j/4AAQSkZJRgABAAEBLAEsAAD/2wCEAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFhEYIx8lJCIfIiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9PjsBCwoKDg0OHBYWHCgoKCgoOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O//AABEIAGQAPQMBEQACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h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feh4GI0qy9WR3nhyPw/bTrbSTSQTmAs0r7maQO2SfwIqanwipbv0PUrf/j2i/wBwfyqzNjpE3xsp/iGKAPHfEqyWus3aXNu2Gkcpu9CSQQT1riqpqTPp8DaVGPK+xjEQvKRuKR46kZNZna3NR7spSQQszE3IHJH3fyoKdSaXwk2kRxrq1kwlDN56ZXB45q6fxI5cbKToyTX9XPXNGH/Eh0//AK9Y/wD0EV2w+FHzGJ/jT/xP8yvr1jcajZx2tsm+Rpk/AZ5NE1dEUmk36HXRp5capnO0AZpkjqAKt/p1tqEJjuIY5R6SKGFJpMuFSUHeLaOUvvAmkuWJtJ4Ae9vJkfrmsnRh2O2nmuIj1T9TDn+H+kBj/p92nsyg/wBKn2MfM6Fndb+VDLXwZpFldxXC3t5K8ThgoQDJH4U404p31M6+bVasHFxSudbYwXn2WG1tLORYoY1jWS5O3gDAPv8AhWqemh5s5OcnJ9Wb9naC1j+Zt8h+82MfkPSqJLFABQAUAFAAQD1GaACgAoAKACgA/9k=</field> diff --git a/addons/portal_anonymous/i18n/ru.po b/addons/portal_anonymous/i18n/ru.po new file mode 100644 index 00000000000..5ae80dfe490 --- /dev/null +++ b/addons/portal_anonymous/i18n/ru.po @@ -0,0 +1,25 @@ +# Russian translation for openobject-addons +# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 +# This file is distributed under the same license as the openobject-addons package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. +# +msgid "" +msgstr "" +"Project-Id-Version: openobject-addons\n" +"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" +"POT-Creation-Date: 2012-12-21 17:05+0000\n" +"PO-Revision-Date: 2013-04-09 13:04+0000\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: Russian <ru@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2013-04-10 05:21+0000\n" +"X-Generator: Launchpad (build 16550)\n" + +#. module: portal_anonymous +#. openerp-web +#: code:addons/portal_anonymous/static/src/xml/portal_anonymous.xml:8 +#, python-format +msgid "Login" +msgstr "Вход" diff --git a/addons/project/project.py b/addons/project/project.py index 0751865d9c4..eb328007d44 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -286,7 +286,6 @@ class project(osv.osv): 'type_ids': _get_type_common, 'alias_model': 'project.task', 'privacy_visibility': 'public', - 'alias_domain': False, # always hide alias during creation } # TODO: Why not using a SQL contraints ? @@ -531,11 +530,11 @@ def Project(): context = dict(context, project_creation_in_progress=True) mail_alias = self.pool.get('mail.alias') if not vals.get('alias_id') and vals.get('name', False): - vals.pop('alias_name', None) # prevent errors during copy() + alias_name = vals.pop('alias_name', None) # prevent errors during copy() alias_id = mail_alias.create_unique_alias(cr, uid, # Using '+' allows using subaddressing for those who don't # have a catchall domain setup. - {'alias_name': "project+"+short_name(vals['name'])}, + {'alias_name': alias_name or "project+"+short_name(vals['name'])}, model_name=vals.get('alias_model', 'project.task'), context=context) vals['alias_id'] = alias_id @@ -605,8 +604,7 @@ class task(base_stage, osv.osv): search_domain = [] project_id = self._resolve_project_id_from_context(cr, uid, context=context) if project_id: - search_domain += ['|', ('project_ids', '=', project_id)] - search_domain += [('id', 'in', ids)] + search_domain += [('project_ids', '=', project_id)] stage_ids = stage_obj._search(cr, uid, search_domain, order=order, access_rights_uid=access_rights_uid, context=context) result = stage_obj.name_get(cr, access_rights_uid, stage_ids, context=context) # restore order of the search @@ -889,6 +887,12 @@ class task(base_stage, osv.osv): res['fields'][f]['string'] = res['fields'][f]['string'].replace('Hours',tm) return res + def get_empty_list_help(self, cr, uid, help, context=None): + context['empty_list_help_id'] = context.get('default_project_id') + context['empty_list_help_model'] = 'project.project' + context['empty_list_help_document_name'] = _("tasks") + return super(task, self).get_empty_list_help(cr, uid, help, context=context) + # ---------------------------------------- # Case management # ---------------------------------------- diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 16dbe44ccc1..a016c46e0e0 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -50,16 +50,17 @@ <field name="name">Tasks</field> <field name="res_model">project.task</field> <field name="view_mode">kanban,tree,form,calendar,gantt,graph</field> - <field name="context">{'search_default_project_id': [active_id], 'default_project_id': active_id}</field> + <field name="context">{ + 'search_default_project_id': [active_id], + 'default_project_id': active_id, + }</field> <field name="search_view_id" ref="view_task_search_form"/> <field name="help" type="html"> - <p class="oe_view_nocontent_create"> - Click to create a new task. - </p><p> - OpenERP's project management allows you to manage the pipeline - of tasks in order to get things done efficiently. You can - track progress, discuss on tasks, attach documents, etc. - </p> + <p> + OpenERP's project management allows you to manage the pipeline + of tasks in order to get things done efficiently. You can + track progress, discuss on tasks, attach documents, etc. + </p> </field> </record> @@ -87,6 +88,17 @@ <h1> <field name="name" string="Project Name"/> </h1> + <div name="group_alias" + attrs="{'invisible': [('alias_domain', '=', False)]}"> + <label for="alias_id" string="Email Alias"/> + <field name="alias_id" class="oe_inline oe_read_only" required="0" nolabel="1"/> + <span name="edit_alias" class="oe_edit_only"> + <field name="alias_name" class="oe_inline" + attrs="{'required': [('alias_id', '!=', False)]}"/> + @ + <field name="alias_domain" class="oe_inline" readonly="1"/> + </span> + </div> <div name="options_active"> <field name="use_tasks" class="oe_inline"/> <label for="use_tasks"/> @@ -133,13 +145,6 @@ </page> <page string="Other Info"> <group> - <group string="Email Interface" attrs="{'invisible': [('alias_domain', '=', False)]}"> - <div> - <field name="alias_id" invisible="1" required="0"/> - <label for="alias_name" class="oe_edit_only "/> - <field name="alias_name" class="oe_inline" attrs="{'required': [('alias_id', '!=', False)]}"/>@<field name="alias_domain" class="oe_inline"/> - </div> - </group> <group string="Administration" groups="project.group_time_work_estimation_tasks"> <field name="planned_hours" widget="float_time"/> <field name="effective_hours" widget="float_time"/> @@ -231,7 +236,6 @@ <field name="color"/> <field name="task_count"/> <field name="alias_id"/> - <field name="alias_domain"/> <field name="doc_count"/> <templates> <t t-name="kanban-box"> @@ -245,8 +249,10 @@ </ul> </div> <div class="oe_kanban_content"> - <h4><field name="name"/></h4> + <div class="oe_kanban_alias" t-if="record.alias_id.value"> + <span class="oe_e">%%</span><small><field name="alias_id"/></small> + </div> <div class="oe_kanban_project_list"> <a t-if="record.use_tasks.raw_value" name="%(act_project_project_2_project_task_all)d" type="action" style="margin-right: 10px"> <span t-if="record.task_count.raw_value gt 1"><field name="task_count"/> Tasks</span> @@ -622,13 +628,11 @@ <field name="view_mode">kanban,tree,form,calendar,gantt,graph</field> <field name="search_view_id" ref="view_task_search_form"/> <field name="help" type="html"> - <p class="oe_view_nocontent_create"> - Click to create a new task. - </p><p> - OpenERP's project management allows you to manage the pipeline - of tasks in order to get things done efficiently. You can - track progress, discuss on tasks, attach documents, etc. - </p> + <p> + OpenERP's project management allows you to manage the pipeline + of tasks in order to get things done efficiently. You can + track progress, discuss on tasks, attach documents, etc. + </p> </field> </record> <record id="open_view_task_list_kanban" model="ir.actions.act_window.view"> diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index f8f6510cd49..7aa408a99aa 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -416,6 +416,12 @@ class project_issue(base_stage, osv.osv): self.write(cr, uid, ids, {'date_open': False, 'date_closed': False}) return res + def get_empty_list_help(self, cr, uid, help, context=None): + context['empty_list_help_model'] = 'project.project' + context['empty_list_help_id'] = context.get('default_project_id') + context['empty_list_help_document_name'] = _("issues") + return super(project_issue, self).get_empty_list_help(cr, uid, help, context=context) + # ------------------------------------------------------- # Stage management # ------------------------------------------------------- @@ -563,7 +569,8 @@ class project_issue(base_stage, osv.osv): return res -class project(osv.osv): + +class project(osv.Model): _inherit = "project.project" def _get_alias_models(self, cr, uid, context=None): @@ -578,7 +585,9 @@ class project(osv.osv): return res _columns = { - 'project_escalation_id' : fields.many2one('project.project','Project Escalation', help='If any issue is escalated from the current Project, it will be listed under the project selected here.', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), + 'project_escalation_id': fields.many2one('project.project', 'Project Escalation', + help='If any issue is escalated from the current Project, it will be listed under the project selected here.', + states={'close': [('readonly', True)], 'cancelled': [('readonly', True)]}), 'issue_count': fields.function(_issue_count, type='integer', string="Unclosed Issues"), } @@ -593,14 +602,13 @@ class project(osv.osv): (_check_escalation, 'Error! You cannot assign escalation to the same project!', ['project_escalation_id']) ] -project() -class account_analytic_account(osv.osv): +class account_analytic_account(osv.Model): _inherit = 'account.analytic.account' _description = 'Analytic Account' _columns = { - 'use_issues' : fields.boolean('Issues', help="Check this field if this project manages issues"), + 'use_issues': fields.boolean('Issues', help="Check this field if this project manages issues"), } def on_change_template(self, cr, uid, ids, template_id, context=None): @@ -611,16 +619,34 @@ class account_analytic_account(osv.osv): return res def _trigger_project_creation(self, cr, uid, vals, context=None): - if context is None: context = {} + if context is None: + context = {} res = super(account_analytic_account, self)._trigger_project_creation(cr, uid, vals, context=context) return res or (vals.get('use_issues') and not 'project_creation_in_progress' in context) -account_analytic_account() -class project_project(osv.osv): +class project_project(osv.Model): _inherit = 'project.project' + _defaults = { 'use_issues': True } + def _check_create_write_values(self, cr, uid, vals, context=None): + """ Perform some check on values given to create or write. """ + # Handle use_tasks / use_issues: if only one is checked, alias should take the same model + if vals.get('use_tasks') and not vals.get('use_issues'): + vals['alias_model'] = 'project.task' + elif vals.get('use_issues') and not vals.get('use_tasks'): + vals['alias_model'] = 'project.issue' + + def create(self, cr, uid, vals, context=None): + self._check_create_write_values(cr, uid, vals, context=context) + return super(project_project, self).create(cr, uid, vals, context=context) + + def write(self, cr, uid, ids, vals, context=None): + self._check_create_write_values(cr, uid, vals, context=context) + return super(project_project, self).write(cr, uid, ids, vals, context=context) + + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_issue/project_issue_menu.xml b/addons/project_issue/project_issue_menu.xml index 78841f56156..308b4884844 100644 --- a/addons/project_issue/project_issue_menu.xml +++ b/addons/project_issue/project_issue_menu.xml @@ -14,13 +14,11 @@ <field name="domain" eval=""/> <field name="search_view_id" ref="view_project_issue_filter"/> <field name="help" type="html"> - <p class="oe_view_nocontent_create"> - Click to report a new issue. - </p><p> - The OpenERP issues tacker allows you to efficiantly manage things - like internal requests, software development bugs, customer - complaints, project troubles, material breakdowns, etc. - </p> + <p> + The OpenERP issues tacker allows you to efficiantly manage things + like internal requests, software development bugs, customer + complaints, project troubles, material breakdowns, etc. + </p> </field> </record> diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index 500a1376422..f888ff9da77 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -302,7 +302,18 @@ <field name="view_type">form</field> <field name="name">Issues</field> <field name="view_mode">kanban,tree,form,calendar,graph</field> - <field name="context">{'search_default_project_id': [active_id], 'default_project_id': active_id}</field> + <field name="context">{ + 'search_default_project_id': [active_id], + 'default_project_id': active_id, + } + </field> + <field name="help" type="html"> + <p> + The OpenERP issues tacker allows you to efficiantly manage things + like internal requests, software development bugs, customer + complaints, project troubles, material breakdowns, etc. + </p> + </field> </record> <!-- Project --> @@ -324,9 +335,18 @@ <field name="priority" position="before"> <field name="project_escalation_id"/> </field> - <field name="alias_domain" position="after"> - <label for="alias_model" class="oe_edit_only" string="creates"/><field name="alias_model" class="oe_edit_only oe_inline"/> - </field> + <xpath expr='//span[@name="edit_alias"]' position='replace'> + <span class="oe_edit_only" name="edit_alias"> + <field name="alias_name" class="oe_inline" attrs="{'required': [('alias_id', '!=', False)]}"/> + @ + <field class="oe_inline" name="alias_domain"/> + <span class="oe_inline" + attrs="{'invisible': ['|', ('use_issues', '!=', True), ('use_tasks', '!=', True)]}"> + <label for="alias_model" string="creates"/> + <field name="alias_model" class="oe_inline"/> + </span> + </span> + </xpath> </field> </record> diff --git a/addons/project_issue/report/project_issue_report_view.xml b/addons/project_issue/report/project_issue_report_view.xml index 47ea91fad5f..e56c6612e0d 100644 --- a/addons/project_issue/report/project_issue_report_view.xml +++ b/addons/project_issue/report/project_issue_report_view.xml @@ -14,7 +14,7 @@ <field name="version_id" string="Version" invisible="1"/> <field name="priority" invisible="1"/> <field name="company_id" invisible="1" groups="base.group_multi_company"/> - <field name="section_id" invisible="1"/> + <field name="section_id" invisible="1" groups="base.group_multi_salesteams"/> <field name="user_id" invisible="1"/> <field name="channel_id" invisible="1"/> <field name="partner_id" invisible="1"/> diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index e3a393666b4..9a4866d14f1 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -328,19 +328,24 @@ <field name="view_type">form</field> <field name="view_mode">tree,form,calendar,graph</field> <field name="search_view_id" ref="view_sales_order_filter"/> - <field name="context">{'show_address': 1}</field> - <field name="domain">[('state','not in',('draft','sent','cancel'))]</field> + <field name="context">{ + 'show_address': 1, + 'search_default_my_sale_orders_filter': 1 + } + </field> + <field name="domain">[('state', 'not in', ('draft', 'sent', 'cancel'))]</field> <field name="help" type="html"> - <p class="oe_view_nocontent_create"> - Click to create a quotation that can be converted into a sales - order. - </p><p> - OpenERP will help you efficiently handle the complete sales flow: - quotation, sales order, delivery, invoicing and payment. - </p> + <p class="oe_view_nocontent_create"> + Click to create a quotation that can be converted into a sales + order. + </p><p> + OpenERP will help you efficiently handle the complete sales flow: + quotation, sales order, delivery, invoicing and payment. + </p> </field> </record> - <menuitem action="action_orders" id="menu_sale_order" parent="base.menu_sales" sequence="5" groups="base.group_sale_salesman,base.group_sale_manager"/> + + <menuitem action="action_orders" id="menu_sale_order" parent="base.menu_sales" sequence="6" groups="base.group_sale_salesman,base.group_sale_manager"/> <record id="action_orders_exception" model="ir.actions.act_window"> <field name="name">Sales in Exception</field> @@ -371,7 +376,7 @@ <field name="view_type">form</field> <field name="view_id" ref="view_quotation_tree"/> <field name="view_mode">tree,form,calendar,graph</field> - <field name="context">{'show_address': 1}</field> + <field name="context">{'show_address': 1, 'search_default_my_sale_orders_filter': 1}</field> <field name="domain">[('state','in',('draft','sent','cancel'))]</field> <field name="search_view_id" ref="view_sales_order_filter"/> <field name="help" type="html"> @@ -390,8 +395,8 @@ </record> <menuitem id="menu_sale_quotations" - action="action_quotations" parent="base.menu_sales" - sequence="4"/> + action="action_quotations" parent="base.menu_sales" + sequence="5"/> <record id="action_order_tree" model="ir.actions.act_window"> <field name="name">Old Quotations</field> diff --git a/addons/sale_crm/report/sale_crm_account_invoice_report_view.xml b/addons/sale_crm/report/sale_crm_account_invoice_report_view.xml index 41166d56713..983701d9690 100644 --- a/addons/sale_crm/report/sale_crm_account_invoice_report_view.xml +++ b/addons/sale_crm/report/sale_crm_account_invoice_report_view.xml @@ -10,7 +10,7 @@ <field name="arch" type="xml"> <data> <xpath expr="//field[@name='date']" position="after"> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> </xpath> </data> </field> diff --git a/addons/sale_crm/sale_crm.py b/addons/sale_crm/sale_crm.py index 1f3f85d5ed1..3177aec4c5f 100644 --- a/addons/sale_crm/sale_crm.py +++ b/addons/sale_crm/sale_crm.py @@ -19,8 +19,10 @@ # ############################################################################## +from datetime import datetime from openerp.osv import osv, fields + class sale_order(osv.osv): _inherit = 'sale.order' _columns = { @@ -30,19 +32,49 @@ class sale_order(osv.osv): } +class crm_case_section(osv.osv): + _inherit = 'crm.case.section' + + def _get_sum_month_invoice(self, cr, uid, ids, field_name, arg, context=None): + res = dict.fromkeys(ids, 0) + obj = self.pool.get('account.invoice.report') + when = datetime.today() + for section_id in ids: + invoice_ids = obj.search(cr, uid, [("section_id", "=", section_id), ('state', 'not in', ['draft', 'cancel']), ('year', '=', when.year), ('month', '=', when.month > 9 and when.month or "0%s" % when.month)], context=context) + for invoice in obj.browse(cr, uid, invoice_ids, context=context): + res[section_id] += invoice.price_total + return res + + _columns = { + 'quotation_ids': fields.one2many('sale.order', 'section_id', + string='Quotations', readonly=True, + domain=[('state', 'in', ['draft', 'sent', 'cancel'])]), + 'sale_order_ids': fields.one2many('sale.order', 'section_id', + string='Sale Orders', readonly=True, + domain=[('state', 'not in', ['draft', 'sent', 'cancel'])]), + 'invoice_ids': fields.one2many('account.invoice', 'section_id', + string='Invoices', readonly=True, + domain=[('state', 'not in', ['draft', 'cancel'])]), + 'sum_month_invoice': fields.function(_get_sum_month_invoice, + string='Total invoiced this month', + type='integer', readonly=True), + } + + class res_users(osv.Model): _inherit = 'res.users' _columns = { 'default_section_id': fields.many2one('crm.case.section', 'Default Sales Team'), } + class account_invoice(osv.osv): _inherit = 'account.invoice' _columns = { 'section_id': fields.many2one('crm.case.section', 'Sales Team'), } _defaults = { - 'section_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).default_section_id.id or False, + 'section_id': lambda self, cr, uid, c=None: self.pool.get('res.users').browse(cr, uid, uid, c).default_section_id.id or False, } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/sale_crm/sale_crm_view.xml b/addons/sale_crm/sale_crm_view.xml index 0b5fce2f5cd..f8b4228334e 100644 --- a/addons/sale_crm/sale_crm_view.xml +++ b/addons/sale_crm/sale_crm_view.xml @@ -22,7 +22,7 @@ <field name="inherit_id" ref="sale.view_order_form"/> <field name="arch" type="xml"> <field name="user_id" position="after"> - <field name="section_id" widget="selection"/> + <field name="section_id" widget="selection" groups="base.group_multi_salesteams"/> <field name="categ_ids" widget="many2many_tags"/> </field> </field> @@ -41,7 +41,7 @@ help="My Sales Team(s)"/> </xpath> <xpath expr="//field[@name='user_id']" position="after"> - <field name="section_id" string="Sales Team"/> + <field name="section_id" string="Sales Team" groups="base.group_multi_salesteams"/> </xpath> </field> </record> @@ -53,18 +53,22 @@ <field name="inherit_id" ref="account.invoice_tree"/> <field name="arch" type="xml"> <data> - <xpath expr="//field[@name='date_invoice']" position="after"> - <field name="section_id" invisible="1"/> + <xpath expr="//field[@name='user_id']" position="after"> + <field name="section_id" string="Sales Team" groups="base.group_multi_salesteams"/> </xpath> </data> </field> </record> + <!-- Update account invoice search view!--> <record id="account_invoice_groupby_inherit" model="ir.ui.view"> <field name="name">account.invoice.groupby</field> <field name="model">account.invoice</field> <field name="inherit_id" ref="account.view_account_invoice_filter"/> <field name="arch" type="xml"> + <xpath expr="//field[@name='user_id']" position="after"> + <field name="section_id"/> + </xpath> <xpath expr="//group/filter[@string='Due Date']" position="after"> <filter string="Sales Team" domain="[]" context="{'group_by':'section_id'}"/> </xpath> @@ -79,7 +83,7 @@ <field name="arch" type="xml"> <data> <xpath expr="//field[@name='user_id']" position="after"> - <field name="section_id"/> + <field name="section_id" groups="base.group_multi_salesteams"/> </xpath> </data> </field> @@ -113,5 +117,132 @@ </field> </record> + <!-- search by Salesteams --> + + <record id="action_orders_salesteams" model="ir.actions.act_window"> + <field name="name">Sales Orders</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">sale.order</field> + <field name="view_type">form</field> + <field name="view_mode">tree,form,calendar,graph</field> + <field name="search_view_id" ref="sale.view_sales_order_filter"/> + <field name="domain">[('state','not in',('draft','sent','cancel'))]</field> + <field name="context">{ + 'search_default_section_id': [active_id], + 'default_section_id': active_id, + 'search_default_my_sale_orders_filter': 1, + } + </field> + <field name="help" type="html"> + <p class="oe_view_nocontent_create"> + Click to create a quotation that can be converted into a sales + order. + </p><p> + OpenERP will help you efficiently handle the complete sales flow: + quotation, sales order, delivery, invoicing and payment. + </p> + </field> + </record> + + <record id="action_quotations_salesteams" model="ir.actions.act_window"> + <field name="name">Quotations</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">sale.order</field> + <field name="view_type">form</field> + <field name="view_id" ref="sale.view_quotation_tree"/> + <field name="view_mode">tree,form,calendar,graph</field> + <field name="context">{ + 'search_default_section_id': [active_id], + 'default_section_id': active_id, 'show_address': 1, + 'search_default_my_sale_orders_filter': 1 + } + </field> + <field name="domain">[('state','in',('draft','sent','cancel'))]</field> + <field name="search_view_id" ref="sale.view_sales_order_filter"/> + <field name="help" type="html"> + <p class="oe_view_nocontent_create"> + Click to create a quotation, the first step of a new sale. + </p><p> + OpenERP will help you handle efficiently the complete sale flow: + from the quotation to the sales order, the + delivery, the invoicing and the payment collection. + </p><p> + The social feature helps you organize discussions on each sales + order, and allow your customers to keep track of the evolution + of the sales order. + </p> + </field> + </record> + + <record id="action_invoice_salesteams" model="ir.actions.act_window"> + <field name="name">Invoices</field> + <field name="res_model">account.invoice</field> + <field name="view_type">form</field> + <field name="view_mode">tree,form,calendar,graph</field> + <field name="view_id" ref="account.invoice_tree"/> + <field name="domain">[ + ('state', 'not in', ['draft', 'cancel']), + ('type', '=', 'out_invoice')]</field> + <field name="context">{ + 'search_default_section_id': [active_id], + 'default_section_id': active_id}, + 'default_type':'out_invoice', + 'type':'out_invoice', + 'journal_type': 'sale', + } + </field> + <field name="search_view_id" ref="account.view_account_invoice_filter"/> + </record> + + <record id="action_invoice_salesteams_view_tree" model="ir.actions.act_window.view"> + <field name="sequence">1</field> + <field name="view_mode">tree</field> + <field name="act_window_id" ref="sale_crm.action_invoice_salesteams"/> + </record> + + <record id="action_invoice_salesteams_view_form" model="ir.actions.act_window.view"> + <field name="sequence">2</field> + <field name="view_mode">form</field> + <field name="view_id" ref="account.invoice_form"/> + <field name="act_window_id" ref="sale_crm.action_invoice_salesteams"/> + </record> + + <record id="crm_case_section_salesteams_view_kanban" model="ir.ui.view"> + <field name="name">crm.case.section.kanban</field> + <field name="model">crm.case.section</field> + <field name="inherit_id" ref="crm.crm_case_section_salesteams_view_kanban"/> + <field name="arch" type="xml"> + <data> + <xpath expr="//field[@name='open_opportunity_ids']" position="after"> + <field name="quotation_ids"/> + <field name="sale_order_ids"/> + <field name="invoice_ids"/> + </xpath> + <xpath expr="//div[@class='oe_items_list']" position="inside"> + <a name="%(action_quotations_salesteams)d" type="action"> + <t t-raw="record.quotation_ids.raw_value.length"/> + <t t-if="record.quotation_ids.raw_value.length >= 2">Quotations</t> + <t t-if="record.quotation_ids.raw_value.length < 2">Quotation</t> + </a> + <a name="%(action_orders_salesteams)d" type="action"> + <t t-raw="record.sale_order_ids.raw_value.length"/> + <t t-if="record.sale_order_ids.raw_value.length >= 2">Sales Orders</t> + <t t-if="record.sale_order_ids.raw_value.length < 2">Sales Order</t> + </a> + <a name="%(action_invoice_salesteams)d" type="action" groups="account.group_account_invoice"> + <t t-raw="record.invoice_ids.raw_value.length"/> + <t t-if="record.invoice_ids.raw_value.length >= 2">Invoices</t> + <t t-if="record.invoice_ids.raw_value.length < 2">Invoice</t> + </a> + </xpath> + <xpath expr="//div[@class='oe_items_list']" position="after"> + <div class="oe_center"> + <div class="oe_sum"><field name="sum_month_invoice"/></div> + <div class="oe_subsum">Invoiced this month</div> + </div> + </xpath> + </data> + </field> + </record> </data> </openerp> |
