Browse Source

Merge branch '8.0' of /home/iii/addons-yelizariev/../mail_wall_custom into 8.0

pull/1/head
Ildar Nasyrov 9 years ago
parent
commit
099b5bdf14
  1. 4
      mail_wall_custom/README.rst
  2. 1
      mail_wall_custom/__init__.py
  3. 25
      mail_wall_custom/__openerp__.py
  4. 402
      mail_wall_custom/data.xml
  5. 13
      mail_wall_custom/models.py
  6. BIN
      mail_wall_custom/static/description/icon.png
  7. 20
      mail_wall_custom/views.xml

4
mail_wall_custom/README.rst

@ -0,0 +1,4 @@
Custom mail wall
================
Tested on Odoo 8.0 ab7b5d7732a7c222a0aea45bd173742acd47242d

1
mail_wall_custom/__init__.py

@ -0,0 +1 @@
import models

25
mail_wall_custom/__openerp__.py

@ -0,0 +1,25 @@
{
'name' : 'Custom mail wall',
'version' : '1.0.0',
'author' : 'IT-Projects LLC, Ivan Yelizariev',
'license': 'GPL-3',
'category' : 'Custom',
'website' : 'https://yelizariev.github.io',
'depends' : ['gamification',
'gamification_extra',
'hr',
'sale',
'sales_team',
'crm',
'calendar',
'project',
'mail_wall_widgets',
'sale_mediation_custom',
'access_custom',
],
'data':[
'views.xml',
'data.xml',
],
'installable': True,
}

402
mail_wall_custom/data.xml

@ -0,0 +1,402 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="goal_average_payment_time" model="gamification.goal.definition">
<field name="name">Average payment time</field>
<field name="description"></field>
<field name="monetary" eval="False"/>
<field name="suffix">days</field>
<field name="computation_mode">avg</field>
<field name="display_mode">progress</field>
<field name="model_id" ref="sale.model_sale_order"/>
<field name="field_id" ref="sale_mediation_custom.field_sale_order_invoice_deal_time"/>
<field name="field_date_id" ref="sale.field_sale_order_date_order"/>
<field name="condition">lower</field>
<field name="domain">[('user_id','=', user.id),('state','in', ['done'])]</field>
</record>
<record id="goal_average_payment_time_all" model="gamification.goal.definition">
<field name="name">Average payment time [ALL]</field>
<field name="description"></field>
<field name="monetary" eval="False"/>
<field name="suffix">days</field>
<field name="computation_mode">avg</field>
<field name="display_mode">progress</field>
<field name="model_id" ref="sale.model_sale_order"/>
<field name="field_id" ref="sale_mediation_custom.field_sale_order_invoice_deal_time"/>
<field name="field_date_id" ref="sale.field_sale_order_date_order"/>
<field name="condition">lower</field>
<field name="domain">[('state','in', ['done'])]</field>
</record>
<record id="goal_average_deal_time" model="gamification.goal.definition">
<field name="name">Average deal time</field>
<field name="description"></field>
<field name="monetary" eval="False"/>
<field name="suffix">days</field>
<field name="computation_mode">avg</field>
<field name="display_mode">progress</field>
<field name="model_id" ref="crm.model_crm_lead"/>
<field name="field_id" ref="sale_mediation_custom.field_crm_lead_deal_time"/>
<field name="field_date_id" ref="crm.field_crm_lead_create_date"/>
<field name="condition">lower</field>
<field name="domain">[('user_id','=', user.id), ('sales_funnel_type', 'in', ['won']), ('date_closed', '!=', False)]</field>
</record>
<record id="goal_average_deal_time_all" model="gamification.goal.definition">
<field name="name">Average deal time [ALL]</field>
<field name="description"></field>
<field name="monetary" eval="False"/>
<field name="suffix">days</field>
<field name="computation_mode">avg</field>
<field name="display_mode">progress</field>
<field name="model_id" ref="crm.model_crm_lead"/>
<field name="field_id" ref="sale_mediation_custom.field_crm_lead_deal_time"/>
<field name="field_date_id" ref="crm.field_crm_lead_create_date"/>
<field name="condition">lower</field>
<field name="domain">[('sales_funnel_type', 'in', ['won']), ('date_closed', '!=', False)]</field>
</record>
<record id="goal_oldest_lead" model="gamification.goal.definition">
<field name="name">Oldest lead</field>
<field name="description"></field>
<field name="monetary" eval="False"/>
<field name="suffix">days</field>
<field name="computation_mode">max</field>
<field name="display_mode">progress</field>
<field name="condition">lower</field>
<field name="domain">[('user_id','=', user.id), ('sales_funnel_type', '=', 'lead')]</field>
<field name="model_id" ref="crm.model_crm_lead"/>
<field name="field_id" ref="sale_mediation_custom.field_crm_lead_last_action_time"/>
</record>
<record id="goal_oldest_lead_all" model="gamification.goal.definition">
<field name="name">Oldest lead [ALL]</field>
<field name="description"></field>
<field name="monetary" eval="False"/>
<field name="suffix">days</field>
<field name="computation_mode">max</field>
<field name="display_mode">progress</field>
<field name="condition">lower</field>
<field name="domain">[('sales_funnel_type', '=', 'lead')]</field>
<field name="model_id" ref="crm.model_crm_lead"/>
<field name="field_id" ref="sale_mediation_custom.field_crm_lead_last_action_time"/>
</record>
<record id="goal_oldest_opp" model="gamification.goal.definition">
<field name="name">Oldest Opportunity</field>
<field name="description"></field>
<field name="monetary" eval="False"/>
<field name="suffix">days</field>
<field name="computation_mode">max</field>
<field name="display_mode">progress</field>
<field name="condition">lower</field>
<field name="domain">[('user_id','=', user.id), '|', ('sales_funnel_type', '=', 'quotation'),('sales_funnel_type', '=', 'negotiation')]</field>
<field name="model_id" ref="crm.model_crm_lead"/>
<field name="field_id" ref="sale_mediation_custom.field_crm_lead_last_action_time"/>
</record>
<record id="goal_oldest_opp_all" model="gamification.goal.definition">
<field name="name">Oldest Opportunity [ALL]</field>
<field name="description"></field>
<field name="monetary" eval="False"/>
<field name="suffix">days</field>
<field name="computation_mode">max</field>
<field name="display_mode">progress</field>
<field name="condition">lower</field>
<field name="domain">['|', ('sales_funnel_type', '=', 'quotation'),('sales_funnel_type', '=', 'negotiation')]</field>
<field name="model_id" ref="crm.model_crm_lead"/>
<field name="field_id" ref="sale_mediation_custom.field_crm_lead_last_action_time"/>
</record>
<record id="goal_personal_comission" model="gamification.goal.definition">
<field name="name">Personal comission</field>
<field name="description"></field>
<field name="monetary" eval="True"/>
<field name="computation_mode">python</field>
<field name="display_mode">progress</field>
<field name="condition">higher</field>
<field name="domain">[('state','!=','cancel'),('user_id','=',user.id),('type','=','out_invoice')]</field><!-- duplicated at compute_code-->
<field name="model_id" ref="account.model_account_invoice_report"/>
<field name="field_id" ref="account.field_account_invoice_report_price_total"/>
<field name="field_date_id" eval="ref('account.field_account_invoice_report_date')" />
<field name="compute_code">
personal_comission = object.user_id.employee_ids and object.user_id.employee_ids[0].personal_comission or 0.0
result = object.sum * personal_comission / 100.0
</field>
</record>
<record id="goal_team_bonus" model="gamification.goal.definition">
<field name="name">Team bonus</field>
<field name="description">Monthly team bonus</field>
<field name="monetary" eval="True"/>
<field name="computation_mode">python</field>
<field name="display_mode">progress</field>
<field name="condition">higher</field>
<field name="domain">[('state','!=','cancel'),('section_id','=',user.default_section_id.id),('type','=','out_invoice')]</field><!-- duplicated at compute_code-->
<field name="model_id" ref="account.model_account_invoice_report"/>
<field name="field_id" ref="account.field_account_invoice_report_price_total"/>
<field name="field_date_id" eval="ref('account.field_account_invoice_report_date')" />
<field name="compute_code">
<![CDATA[
minimum = object.user_id.default_section_id.invoiced_forecast
maximum = object.user_id.default_section_id.invoiced_target
current = object.sum
salary = 1000 # TODO
team_bonus = object.user_id.employee_ids and object.user_id.employee_ids[0].team_bonus or 0.0
if current < maximum:
current = maximum
if current < minimum or minimum == maximum:
result = 0.0
else:
result = salary * (team_bonus / (12 * 100)) * (current - minimum) / (maximum - minimum)
result = int(result * 100) / 100.0
]]>
</field>
</record>
<record model="res.groups" id="group_dashboard_accountant">
<field name="name">dashboard_accountant</field>
<field name="category_id" ref="access_custom.module_category_custom"/>
<field name="comment">Shows dashboard to accountant</field>
</record>
<record model="res.groups" id="group_dashboard_sales_management">
<field name="name">dashboard_sales_managment</field>
<field name="category_id" ref="access_custom.module_category_custom"/>
<field name="comment">Shows sales management dashboard</field>
</record>
<record model="res.groups" id="group_dashboard_management">
<field name="name">dashboard_managment</field>
<field name="category_id" ref="access_custom.module_category_custom"/>
<field name="comment">Shows management dashboard. It includes: sales management + accountant dashboard + EXTRA</field>
<field name="implied_ids" eval="[(4, ref('mail_wall_custom.group_dashboard_sales_management')),(4, ref('mail_wall_custom.group_dashboard_accountant'))]"/>
</record>
<record model="res.groups" id="group_dashboard_sales_person">
<field name="name">dashboard_sales_person</field>
<field name="category_id" ref="access_custom.module_category_custom"/>
<field name="comment">Shows dashboard to salesperson</field>
</record>
<record model="res.groups" id="group_dashboard_admin">
<field name="name">dashboard_admin</field>
<field name="category_id" ref="access_custom.module_category_custom"/>
<field name="comment">Shows admin dashboard</field>
</record>
<record id="widget_outstanding_invoices" model="mail.wall.widgets.widget">
<field name="name">Outstanding sale orders</field>
<field name="model_id" ref="sale.model_sale_order"/>
<field name="domain">[('user_id', '=', user.id),('state', 'in', ['progress', 'manual'])]</field>
<field name="value_field_id" ref="sale.field_sale_order_amount_total"/>
<field name="value_field_monetary" eval="True"/>
<field name="content"><![CDATA[${record.name} - <b>${record.partner_id.name}</b>, ${record.date_order}]]></field>
<field name="group_ids" eval="[(4, ref('mail_wall_custom.group_dashboard_sales_person'), 0)]"/>
<field name="type">list</field>
<field name="limit">10</field>
<field name="active" eval="True"/>
</record>
<record id="widget_outstanding_invoices_all" model="mail.wall.widgets.widget">
<field name="name">Outstanding sale orders [ALL]</field>
<field name="model_id" ref="sale.model_sale_order"/>
<field name="domain">[('state', 'in', ['progress', 'manual'])]</field>
<field name="value_field_id" ref="sale.field_sale_order_amount_total"/>
<field name="value_field_monetary" eval="True"/>
<field name="content"><![CDATA[${record.name} - <b>${record.partner_id.name}</b>, ${record.date_order}]]></field>
<field name="group_ids" eval="[(4, ref('mail_wall_custom.group_dashboard_sales_management'), 0),(4, ref('mail_wall_custom.group_dashboard_accountant'), 0)]"/>
<field name="type">list</field>
<field name="limit">10</field>
<field name="active" eval="True"/>
</record>
<record id="widget_sent_invoices_all" model="mail.wall.widgets.widget">
<field name="name">Sent invoices [ALL]</field>
<field name="model_id" ref="account.model_account_invoice"/>
<field name="domain">[('type', 'in', ['out_invoice']),('state','in',['open'])]</field>
<field name="value_field_id" ref="account.field_account_invoice_amount_total"/>
<field name="value_field_monetary" eval="True"/>
<field name="content"><![CDATA[${record.name} - <b>${record.partner_id.name}</b>, ${record.date_invoice}]]></field>
<field name="group_ids" eval="[(4, ref('mail_wall_custom.group_dashboard_accountant'), 0)]"/>
<field name="type">list</field>
<field name="limit">10</field>
<field name="active" eval="True"/>
</record>
<record id="widget_received_invoices_all" model="mail.wall.widgets.widget">
<field name="name">Received invoices [ALL]</field>
<field name="model_id" ref="account.model_account_invoice"/>
<field name="domain">[('type', 'in', ['in_invoice']),('state','in',['open'])]</field>
<field name="value_field_id" ref="account.field_account_invoice_amount_total"/>
<field name="value_field_monetary" eval="True"/>
<field name="content"><![CDATA[${record.name} - <b>${record.partner_id.name}</b>, ${record.date_invoice}]]></field>
<field name="group_ids" eval="[(4, ref('mail_wall_custom.group_dashboard_accountant'), 0)]"/>
<field name="type">list</field>
<field name="limit">10</field>
<field name="active" eval="True"/>
</record>
<record id="widget_tasks" model="mail.wall.widgets.widget">
<field name="name">Task deadlines</field>
<field name="model_id" ref="project.model_project_task"/>
<field name="domain">[('user_id', '=', user.id),('date_deadline','!=',False)]</field>
<field name="content"><![CDATA[${record.name} - <b>${record.project_id and record.project_id.name or 'NO PROJECT'}</b>, ${record.date_deadline}]]></field>
<field name="group_ids" eval="[(4, ref('mail_wall_custom.group_dashboard_sales_person'), 0),(4, ref('mail_wall_custom.group_dashboard_sales_management'), 0),(4, ref('mail_wall_custom.group_dashboard_admin'), 0),(4, ref('mail_wall_custom.group_dashboard_accountant'), 0)]"/>
<field name="agenda" eval="True"/>
<field name="field_date_id" ref="project.field_project_task_date_deadline"/>
<field name="type">list</field>
<field name="limit">10</field>
<field name="order">priority DESC</field>
<field name="active" eval="True"/>
</record>
<record id="widget_tasks_all" model="mail.wall.widgets.widget">
<field name="name">Task deadlines [ALL]</field>
<field name="model_id" ref="project.model_project_task"/>
<field name="domain">[('date_deadline','!=',False)]</field>
<field name="content"><![CDATA[${record.name} - <b>${record.project_id and record.project_id.name or 'NO PROJECT'}</b>, ${record.date_deadline}]]></field>
<field name="group_ids" eval="[(4, ref('mail_wall_custom.group_dashboard_sales_management'), 0),(4, ref('mail_wall_custom.group_dashboard_accountant'), 0)]"/>
<field name="agenda" eval="True"/>
<field name="field_date_id" ref="project.field_project_task_date_deadline"/>
<field name="type">list</field>
<field name="limit">10</field>
<field name="order">priority DESC</field>
<field name="active" eval="True"/>
</record>
<record id="widget_next_action" model="mail.wall.widgets.widget">
<field name="name">Next action</field>
<field name="model_id" ref="crm.model_crm_lead"/>
<field name="domain">[('user_id', '=', user.id), '|',('date_action','!=',False),('title_action', '!=', False)]</field>
<field name="content"><![CDATA[${record.name}: <b>${record.date_action}</b> - ${record.title_action}]]></field>
<field name="group_ids" eval="[(4, ref('mail_wall_custom.group_dashboard_sales_person'), 0)]"/>
<field name="agenda" eval="True"/>
<field name="field_date_id" ref="crm.field_crm_lead_date_action"/>
<field name="value_field_id" ref="crm.field_crm_lead_planned_revenue"/>
<field name="value_field_monetary" eval="True"/>
<field name="type">list</field>
<field name="limit">10</field>
<field name="order">priority DESC,probability DESC,planned_revenue DESC</field>
<field name="active" eval="True"/>
</record>
<record id="widget_next_action_all" model="mail.wall.widgets.widget">
<field name="name">Next action [ALL]</field>
<field name="model_id" ref="crm.model_crm_lead"/>
<field name="domain">['|',('date_action','!=',False),('title_action', '!=', False)]</field>
<field name="content"><![CDATA[${record.name}: <b>${record.date_action}</b> - ${record.title_action}]]></field>
<field name="group_ids" eval="[(4, ref('mail_wall_custom.group_dashboard_sales_management'), 0)]"/>
<field name="agenda" eval="True"/>
<field name="field_date_id" ref="crm.field_crm_lead_date_action"/>
<field name="value_field_id" ref="crm.field_crm_lead_planned_revenue"/>
<field name="value_field_monetary" eval="True"/>
<field name="type">list</field>
<field name="limit">10</field>
<field name="order">priority DESC,probability DESC,planned_revenue DESC</field>
<field name="active" eval="True"/>
</record>
<record id="widget_calls" model="mail.wall.widgets.widget">
<field name="name">Calls</field>
<field name="model_id" ref="crm.model_crm_phonecall"/>
<field name="domain">[('user_id', '=', user.id),('state', 'not in', ['cancel'])]</field>
<field name="content"><![CDATA[${record.name} - <b>${record.partner_id.name}</b>, ${record.date}]]></field>
<field name="group_ids" eval="[(4, ref('mail_wall_custom.group_dashboard_sales_person'), 0),(4, ref('mail_wall_custom.group_dashboard_sales_management'), 0),(4, ref('mail_wall_custom.group_dashboard_admin'), 0),(4, ref('mail_wall_custom.group_dashboard_accountant'), 0)]"/>
<field name="agenda" eval="True"/>
<field name="field_date_id" ref="crm.field_crm_phonecall_date"/>
<field name="type">list</field>
<field name="limit">10</field>
<field name="order">date DESC</field>
<field name="active" eval="True"/>
</record>
<record id="widget_calls_all" model="mail.wall.widgets.widget">
<field name="name">Calls [ALL]</field>
<field name="model_id" ref="crm.model_crm_phonecall"/>
<field name="domain">[('state', 'not in', ['cancel'])]</field>
<field name="content"><![CDATA[${record.name} - <b>${record.partner_id.name}</b>, ${record.date}]]></field>
<field name="group_ids" eval="[(4, ref('mail_wall_custom.group_dashboard_management'), 0)]"/>
<field name="agenda" eval="True"/>
<field name="field_date_id" ref="crm.field_crm_phonecall_date"/>
<field name="type">list</field>
<field name="limit">10</field>
<field name="order">date DESC</field>
<field name="active" eval="True"/>
</record>
<record id="widget_meetings" model="mail.wall.widgets.widget">
<field name="name">Meetings</field>
<field name="model_id" ref="calendar.model_calendar_event"/>
<field name="domain">[('partner_ids', 'in', [user.partner_id.id])]</field>
<field name="content"><![CDATA[${record.name} - ${record.start_datetime}]]></field>
<field name="group_ids" eval="[(4, ref('mail_wall_custom.group_dashboard_sales_person'), 0),(4, ref('mail_wall_custom.group_dashboard_sales_management'), 0),(4, ref('mail_wall_custom.group_dashboard_admin'), 0),(4, ref('mail_wall_custom.group_dashboard_accountant'), 0)]"/>
<field name="agenda" eval="True"/>
<field name="field_date_id" ref="calendar.field_calendar_event_start_datetime"/>
<field name="type">list</field>
<field name="limit">10</field>
<field name="order">start_datetime DESC</field>
<field name="active" eval="True"/>
</record>
<record id="widget_meetings_all" model="mail.wall.widgets.widget">
<field name="name">Meetings [ALL]</field>
<field name="model_id" ref="calendar.model_calendar_event"/>
<field name="domain">[]</field>
<field name="content"><![CDATA[${record.name} - ${record.start_datetime}]]></field>
<field name="group_ids" eval="[(4, ref('mail_wall_custom.group_dashboard_management'), 0)]"/>
<field name="agenda" eval="True"/>
<field name="field_date_id" ref="crm.field_crm_phonecall_date"/>
<field name="agenda" eval="True"/>
<field name="field_date_id" ref="calendar.field_calendar_event_start_datetime"/>
<field name="type">list</field>
<field name="limit">10</field>
<field name="order">start_datetime DESC</field>
<field name="active" eval="True"/>
</record>
<record id="widget_sales_funnel" model="mail.wall.widgets.widget">
<field name="name">Conversion Rate</field>
<field name="model_id" ref="crm.model_crm_lead"/>
<field name="domain">[('user_id','=', user.id), ('sales_funnel_type', 'in', ['won', 'lost'])]</field>
<field name="group_ids" eval="[(4, ref('mail_wall_custom.group_dashboard_sales_person'), 0)]"/>
<field name="type">funnel</field>
<field name="value_field_id" ref="crm.field_crm_lead_planned_revenue"/>
<field name="value_field_monetary" eval="True"/>
<field name="stage_field_id" ref="sale_mediation_custom.field_crm_lead_stage_closed_id"/>
<field name="won_domain">[('sales_funnel_type', 'in', ['won'])]</field>
<field name="active" eval="True"/>
</record>
<record id="widget_sales_funnel_all" model="mail.wall.widgets.widget">
<field name="name">Conversion Rate [ALL]</field>
<field name="model_id" ref="crm.model_crm_lead"/>
<field name="domain">[('sales_funnel_type', 'in', ['won', 'lost'])]</field>
<field name="group_ids" eval="[(4, ref('mail_wall_custom.group_dashboard_sales_management'), 0)]"/>
<field name="type">funnel</field>
<field name="value_field_id" ref="crm.field_crm_lead_planned_revenue"/>
<field name="value_field_monetary" eval="True"/>
<field name="stage_field_id" ref="sale_mediation_custom.field_crm_lead_stage_closed_id"/>
<field name="won_domain">[('sales_funnel_type', 'in', ['won'])]</field>
<field name="active" eval="True"/>
</record>
<record id="widget_sales_contributed" model="mail.wall.widgets.widget">
<field name="name">Sales contributed</field>
<field name="model_id" ref="sale.model_sale_order"/>
<field name="domain">[('state', 'in', ['done'])]</field>
<field name="won_domain">[('user_id','=', user.id), ('state', 'in', ['done'])]</field>
<field name="group_ids" eval="[(4, ref('mail_wall_custom.group_dashboard_sales_person'), 0)]"/>
<field name="type">slice</field>
<field name="value_field_id" ref="sale.field_sale_order_amount_total"/>
<field name="value_field_monetary" eval="True"/>
<field name="active" eval="True"/>
</record>
<!--
<record id="goal_average_deal_time" model="gamification.goal.definition">
<field name="name">Average deal time</field>
<field name="description"></field>
<field name="monetary" eval="False"/>
<field name="suffix"></field>
<field name="computation_mode"></field>
<field name="display_mode">progress</field>
<field name="condition">higher</field>
<field name="domain"></field>
<field name="model_id" ref="crm.model_crm_lead"/>
<field name="field_id" ref="sale_mediation_custom.field_crm_lead_last_action_time"/>
</record>
-->
</data>
</openerp>

13
mail_wall_custom/models.py

@ -0,0 +1,13 @@
from openerp import api,models,fields
from openerp.osv import fields as old_fields
class hr_employee(models.Model):
_inherit = 'hr.employee'
default_section_id = fields.Many2one('crm.case.section', 'Default Sales Team', related='user_id.default_section_id')
personal_comission = fields.Float('Personal comission', help='Personal comission for sales. Value 1.0 is equal 1%')
team_bonus = fields.Float('Team bonus', help='Maximum team bonus (per year). Value 1.0 is equal 1%')
company_bonus = fields.Float('Company bonus', help='Maximum team bonus (per year). Value 1.0 is equal 1%')

BIN
mail_wall_custom/static/description/icon.png

After

Width: 100  |  Height: 100  |  Size: 2.1 KiB

20
mail_wall_custom/views.xml

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="view_employee_form" model="ir.ui.view">
<field name="name">hr.employee.form</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='active_group']" position="before">
<group string="Bonuses">
<field name="default_section_id"/>
<field name="personal_comission"/>
<field name="team_bonus"/>
<field name="company_bonus"/>
</group>
</xpath>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save