Ivan Yelizariev
9 years ago
24 changed files with 0 additions and 1339 deletions
-
4mail_wall_custom/README.rst
-
1mail_wall_custom/__init__.py
-
25mail_wall_custom/__openerp__.py
-
402mail_wall_custom/data.xml
-
13mail_wall_custom/models.py
-
BINmail_wall_custom/static/description/icon.png
-
20mail_wall_custom/views.xml
-
1mail_wall_menu/__init__.py
-
18mail_wall_menu/__openerp__.py
-
33mail_wall_menu/mail_wall_menu_views.xml
-
1mail_wall_menu/models.py
-
BINmail_wall_menu/static/description/icon.png
-
1mail_wall_menu/static/lib/masonry.pkgd.min.js
-
29mail_wall_menu/static/src/css/mail_wall_menu.css
-
36mail_wall_menu/static/src/js/mail_wall_menu.js
-
1mail_wall_widgets/__init__.py
-
20mail_wall_widgets/__openerp__.py
-
283mail_wall_widgets/models.py
-
2mail_wall_widgets/security/ir.model.access.csv
-
BINmail_wall_widgets/static/description/icon.png
-
58mail_wall_widgets/static/src/css/main.css
-
155mail_wall_widgets/static/src/js/main.js
-
131mail_wall_widgets/static/src/xml/main.xml
-
105mail_wall_widgets/views.xml
@ -1,4 +0,0 @@ |
|||
Custom mail wall |
|||
================ |
|||
|
|||
Tested on Odoo 8.0 ab7b5d7732a7c222a0aea45bd173742acd47242d |
@ -1 +0,0 @@ |
|||
import models |
@ -1,25 +0,0 @@ |
|||
{ |
|||
'name' : 'Custom mail wall', |
|||
'version' : '1.0.0', |
|||
'author' : 'IT-Projects LLC, Ivan Yelizariev', |
|||
'license': 'LGPL-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': False, |
|||
} |
@ -1,402 +0,0 @@ |
|||
<?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> |
@ -1,13 +0,0 @@ |
|||
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%') |
Before Width: 100 | Height: 100 | Size: 2.1 KiB |
@ -1,20 +0,0 @@ |
|||
<?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> |
@ -1 +0,0 @@ |
|||
import models |
@ -1,18 +0,0 @@ |
|||
{ |
|||
'name' : 'Menu for widgets at Messaging section', |
|||
'version' : '1.0.0', |
|||
'author' : 'IT-Projects LLC, Ivan Yelizariev', |
|||
'license': 'LGPL-3', |
|||
"category": "Discuss", |
|||
'website' : 'https://yelizariev.github.io', |
|||
'description': """ |
|||
Module creates special menu at Messaging section to show only gamification-like blocks there. |
|||
|
|||
Tested on Odoo 8.0 ab7b5d7732a7c222a0aea45bd173742acd47242d |
|||
""", |
|||
'depends' : ['mail'], |
|||
'data':[ |
|||
'mail_wall_menu_views.xml', |
|||
], |
|||
'installable': False |
|||
} |
@ -1,33 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
<template id="assets_backend" name="assets" inherit_id="mail.assets_backend"> |
|||
<xpath expr="." position="inside"> |
|||
<link rel="stylesheet" href="/mail_wall_menu/static/src/css/mail_wall_menu.css"/> |
|||
<script type="text/javascript" src="/mail_wall_menu/static/lib/masonry.pkgd.min.js"></script> |
|||
<script type="text/javascript" src="/mail_wall_menu/static/src/js/mail_wall_menu.js"></script> |
|||
</xpath> |
|||
</template> |
|||
|
|||
|
|||
<record id="action_dashboard" model="ir.actions.client"> |
|||
<field name="name">Dashboard</field> |
|||
<field name="tag">mail.wall</field> |
|||
<field name="context">{ |
|||
'default_model': 'res.users', |
|||
'default_res_id': uid, |
|||
'thread_model': 'res.partner', |
|||
'needaction_menu_ref': ['mail.mail_tomefeeds', 'mail.mail_starfeeds'] |
|||
}</field> |
|||
<field name="params" eval=""{ |
|||
'disable_thread': True |
|||
}""/> |
|||
</record> |
|||
|
|||
|
|||
|
|||
<menuitem id="mail_wall_menu.menu_folder" name="Dashboard" parent="mail.mail_feeds_main" groups="base.group_user" sequence="5"/> |
|||
<menuitem id="mail_wall_menu.menu_dashboard" name="Dashboard" parent="mail_wall_menu.menu_folder" groups="base.group_user" sequence="10" action="action_dashboard"/> |
|||
|
|||
</data> |
|||
</openerp> |
@ -1 +0,0 @@ |
|||
from openerp import api,models,fields |
Before Width: 100 | Height: 100 | Size: 2.1 KiB |
1
mail_wall_menu/static/lib/masonry.pkgd.min.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,29 +0,0 @@ |
|||
.openerp .oe_mail_wall .dashboard_only .oe_mail{ |
|||
display:none; |
|||
} |
|||
|
|||
.openerp .oe_mail_wall .oe_mail_wall_aside{ |
|||
display:none; |
|||
} |
|||
|
|||
.openerp .oe_mail_wall .dashboard_only .oe_mail_wall_aside{ |
|||
margin:0; |
|||
padding: 16px; |
|||
display: block; |
|||
position: static; |
|||
width:100%; |
|||
} |
|||
|
|||
.openerp .oe_mail_wall .dashboard_only .oe_mail_wall_aside .oe_gamification_challenge_list { |
|||
background-color:inherit; |
|||
} |
|||
.openerp .oe_mail_wall .dashboard_only .oe_goal{ |
|||
background-color: #ededf6; |
|||
width:280px; |
|||
margin:5px; |
|||
border: solid 1px #888; |
|||
padding: 4px 9px; |
|||
|
|||
position:absolute; |
|||
left:-300px; |
|||
} |
@ -1,36 +0,0 @@ |
|||
openerp.mail_wall_menu = function(instance){ |
|||
var QWeb = instance.web.qweb; |
|||
var _t = instance.web._t; |
|||
|
|||
instance.mail.Widget.include({ |
|||
start: function(){ |
|||
if (this.action.params.disable_thread){ |
|||
$('.oe_view_manager_body').addClass('dashboard_only'); |
|||
var msnry = new Masonry( '.oe_mail_wall_aside', { |
|||
// options
|
|||
columnWidth: 290, |
|||
itemSelector: '.oe_goal', |
|||
transitionDuration: 0 |
|||
}); |
|||
var update = -10; |
|||
this.msnry_interval = setInterval(function(){ |
|||
update++; |
|||
if (update > 0 && update % 5 != 0) |
|||
return; |
|||
if (update > 0) |
|||
update = 0; |
|||
msnry.reloadItems(); |
|||
msnry.layout(); |
|||
}, 1000) |
|||
|
|||
|
|||
return; |
|||
} |
|||
this._super.apply(this, arguments) |
|||
}, |
|||
destroy: function(){ |
|||
clearInterval(this.msnry_interval); |
|||
this._super.apply(this, arguments); |
|||
} |
|||
}) |
|||
} |
@ -1 +0,0 @@ |
|||
import models |
@ -1,20 +0,0 @@ |
|||
{ |
|||
'name' : 'Extra Widgets for mail wall', |
|||
'version' : '1.0.0', |
|||
'author' : 'IT-Projects LLC, Ivan Yelizariev', |
|||
'license': 'LGPL-3', |
|||
'category' : 'Custom', |
|||
'website' : 'https://yelizariev.github.io', |
|||
'description': """ |
|||
|
|||
Tested on odoo 8.0 ab7b5d7732a7c222a0aea45bd173742acd47242d |
|||
""", |
|||
'depends' : ['mail','gamification'], |
|||
'data':[ |
|||
'views.xml', |
|||
#'data.xml', |
|||
'security/ir.model.access.csv', |
|||
], |
|||
'qweb': ['static/src/xml/main.xml'], |
|||
'installable': False, |
|||
} |
@ -1,283 +0,0 @@ |
|||
from openerp.osv import osv,fields as old_fields |
|||
from openerp import api, models, fields, tools |
|||
from openerp.tools.safe_eval import safe_eval |
|||
try: |
|||
from openerp.addons.email_template.email_template import mako_template_env |
|||
except ImportError: |
|||
try: |
|||
from openerp.addons.mail.mail_template import mako_template_env |
|||
except ImportError: |
|||
pass |
|||
|
|||
import copy |
|||
from openerp.tools.translate import _ |
|||
from datetime import date, datetime, timedelta |
|||
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT |
|||
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT |
|||
|
|||
class mail_wall_widgets_widget(models.Model): |
|||
_name = 'mail.wall.widgets.widget' |
|||
_order = "sequence, id" |
|||
|
|||
_columns = { |
|||
'name': old_fields.char('Name', required=True, translate=True), |
|||
'type': old_fields.selection(string='Type', selection=[ |
|||
('list', 'List'), |
|||
('funnel', 'Funnel'), |
|||
('slice', 'Slice'), |
|||
#('', ''), |
|||
#('', ''), |
|||
#('', ''), |
|||
#('', ''), |
|||
], help=''' |
|||
Slice - use "domain" for total and "won_domain" for target |
|||
'''), |
|||
'description': old_fields.text('Description', translate=True), |
|||
'group_ids': old_fields.many2many('res.groups', relation='mail_wall_widgets_widget_group', column1='widget_id', column2='group_id', string='Groups', help="User groups to show widget"), |
|||
'model_id': old_fields.many2one('ir.model', string='Model', help='The model object for the field to evaluate'), |
|||
'domain': old_fields.char("Filter Domain", help="Domain for filtering records. General rule, not user depending, e.g. [('state', '=', 'done')]. The expression can contain reference to 'user' which is a browse record of the current user if not in batch mode.", required=True), |
|||
'limit': old_fields.integer('Limit', help='Limit count of records to show'), |
|||
'order': old_fields.char('Order', help='Order of records to show'), |
|||
'value_field_id': old_fields.many2one('ir.model.fields', |
|||
string='Value field', |
|||
help='The field containing the value of record'), |
|||
'stage_field_id': old_fields.many2one('ir.model.fields', |
|||
string='Stage field', |
|||
help='Field to split records in funnel. It can be selection type or many2one (the later should have "sequence" field)'), |
|||
#'stage_field_domain': old_fields.many2one('ir.model.fields', |
|||
# string='Stage field domain', |
|||
# help='(for many2one stage_field_id) Domain to find stage objects'), |
|||
'won_domain': old_fields.char('Won domain', |
|||
help='Domain to find won objects'), |
|||
'field_date_id': old_fields.many2one('ir.model.fields', |
|||
string='Date Field', |
|||
help='The date to use for the time period evaluated'), |
|||
'start_date': old_fields.date('Start Date'), |
|||
'end_date': old_fields.date('End Date'), # no start and end = always active |
|||
'content': old_fields.char('Line template', help='Mako template to show content'), |
|||
'value_field_monetary': old_fields.boolean('Value is monetary'), |
|||
'cache': old_fields.boolean('Cache'), |
|||
'active': old_fields.boolean('Active'), |
|||
'sequence': old_fields.integer('Sequence', help='Sequence number for ordering'), |
|||
} |
|||
precision = fields.Float('Precision', help='round(Value/precision) * precision. E.g. 12345,333333 will be rounded to 12345,33 for precision=0.01, and to 12000 for precision=1000', default=0.01) |
|||
agenda = fields.Boolean('Agenda', help='Split records by date: overdue, today, tomorrow, later') |
|||
_defaults = { |
|||
'active': True, |
|||
'cache': False, |
|||
'limit': None, |
|||
'order': None, |
|||
} |
|||
|
|||
@api.one |
|||
def get_data(self, user): |
|||
|
|||
domain = safe_eval(self.domain, {'user': user}) |
|||
won_domain = safe_eval(self.won_domain or '[]', {'user': user}) |
|||
|
|||
field_date_name = self.field_date_id and self.field_date_id.name |
|||
if self.start_date and field_date_name: |
|||
domain.append((field_date_name, '>=', self.start_date)) |
|||
if self.end_date and field_date_name: |
|||
domain.append((field_date_name, '<=', self.end_date)) |
|||
|
|||
res = { |
|||
'name': self.name, |
|||
'type': self.type, |
|||
'model': self.model_id.model, |
|||
'domain': str(domain), |
|||
'precision': self.precision, |
|||
} |
|||
obj = self.env[self.model_id.model] |
|||
if self.type == 'list': |
|||
total_count = obj.search_count(domain) |
|||
groups = [{'test': lambda r: True}] |
|||
if self.agenda: |
|||
today = date.today() |
|||
tomorrow = today + timedelta(days=1) |
|||
def r2date(r): |
|||
d = getattr(r, field_date_name) |
|||
if d: |
|||
d = datetime.strptime(d, self.field_date_id.ttype=='date' and DEFAULT_SERVER_DATE_FORMAT or DEFAULT_SERVER_DATETIME_FORMAT) |
|||
d = d.date() |
|||
else: |
|||
d = date.today() |
|||
return d |
|||
groups = [ |
|||
{ |
|||
'label': _('Overdue'), |
|||
'class': 'overdue', |
|||
'test': lambda r: r2date(r) < today, |
|||
'mandatory': False, |
|||
}, |
|||
{ |
|||
'label': _('Today'), |
|||
'class': 'today', |
|||
'test': lambda r: r2date(r) == today, |
|||
'mandatory': True, |
|||
}, |
|||
{ |
|||
'label': _('Tomorrow'), |
|||
'class': 'tomorrow', |
|||
'test': lambda r: r2date(r) == tomorrow, |
|||
'mandatory': False, |
|||
}, |
|||
{ |
|||
'label': _('Later'), |
|||
'class': 'later', |
|||
'test': lambda r: r2date(r) > tomorrow, |
|||
'mandatory': False, |
|||
}, |
|||
] |
|||
for g in groups: |
|||
g['lines'] = [] |
|||
|
|||
res.update({ |
|||
'more': self.limit and self.limit < total_count, |
|||
'total_count': total_count, |
|||
'agenda': self.agenda, |
|||
'groups': groups, |
|||
}) |
|||
for r in obj.search(domain, limit=self.limit, order=self.order): |
|||
mako = mako_template_env.from_string(tools.ustr(self.content)) |
|||
content = mako.render({'record':r}) |
|||
r_json = { |
|||
'id': r.id, |
|||
#'fields': dict( (f,getattr(r,f)) for f in fields), |
|||
'display_mode': 'progress', |
|||
'state': 'inprogress', |
|||
'completeness': 0, |
|||
'name': content, |
|||
'description': '', |
|||
} |
|||
if self.value_field_id: |
|||
r_json['current'] = getattr(r, self.value_field_id.name) |
|||
if self.value_field_monetary: |
|||
r_json['monetary'] = 1 |
|||
for g in groups: |
|||
if g['test'](r): |
|||
g['lines'].append(r_json) |
|||
break |
|||
for g in groups: |
|||
del g['test'] |
|||
elif self.type == 'funnel': |
|||
stage_ids = [] # [key] |
|||
for group in obj.read_group(domain, [], [self.stage_field_id.name]): |
|||
key = group[self.stage_field_id.name] |
|||
if isinstance(key, (list, tuple)): |
|||
key = key[0] |
|||
stage_ids.append(key) |
|||
|
|||
stages = [] # [{'name':Name, 'id': key}] |
|||
if self.stage_field_id.ttype == 'selection': |
|||
d = dict (self.stage_field_id.selection) |
|||
stages = [ {'id':id, 'name':d[id]} for id in stage_ids ] |
|||
else: # many2one |
|||
stage_model = self.stage_field_id.relation |
|||
for r in self.env[stage_model].browse(stage_ids): |
|||
stages.append({'id': r.id, 'name':r.name_get()[0][1]}) |
|||
|
|||
value_field_name = self.value_field_id.name |
|||
for stage in stages: |
|||
d = copy.copy(domain) |
|||
d.append( (self.stage_field_id.name, '=', stage['id']) ) |
|||
result = obj.read_group(d, [value_field_name], []) |
|||
stage['closed_value'] = result and result[0][value_field_name] or 0.0 |
|||
stage['domain'] = str(d) |
|||
|
|||
# won value |
|||
d = domain + won_domain |
|||
result = obj.read_group(domain, [value_field_name], []) |
|||
won = {'name': _('Won'), |
|||
'id':'__won__', |
|||
'closed_value': result and result[0][value_field_name] or 0.0 |
|||
} |
|||
stages.append(won) |
|||
cur = 0 |
|||
for stage in reversed(stages): |
|||
cur += stage['closed_value'] |
|||
stage['abs_value'] = cur |
|||
total_value = stages[0]['abs_value'] |
|||
precision = self.precision |
|||
for s in stages: |
|||
s['rel_value'] = round(100*s['abs_value']/total_value/precision)*precision if total_value else 100 |
|||
# dummy fields |
|||
s['display_mode'] = 'progress' |
|||
s['monetary'] = 1 |
|||
|
|||
res['stages'] = stages |
|||
res['won'] = won |
|||
res['conversion_rate'] = stages[-1]['rel_value'] |
|||
elif self.type == 'slice': |
|||
value_field_name = self.value_field_id.name |
|||
for f,d in [('total', domain), ('won', won_domain)]: |
|||
result = obj.read_group(d, [value_field_name], []) |
|||
res[f] = result and result[0][value_field_name] or 0.0 |
|||
|
|||
res['domain'] = str(domain) |
|||
res['won_domain'] = str(won_domain) |
|||
|
|||
precision = self.precision |
|||
total_value = res['total'] |
|||
res['slice'] = round(100*res['won']/res['total']/precision)*precision if res['total'] else 100 |
|||
# dummy fields |
|||
res['display_mode'] = 'progress' |
|||
res['monetary'] = self.value_field_monetary |
|||
return res |
|||
|
|||
class mail_wall_widgets_cache(models.Model): |
|||
_name = 'mail.wall.widgets.cache' |
|||
|
|||
cache = fields.Text('Cached data') |
|||
res_id = fields.Integer('Resource ID') |
|||
res_model = fields.Integer('Resource Model') |
|||
user_id = fields.Many2one('res.users') |
|||
|
|||
class res_users(models.Model): |
|||
_inherit = 'res.users' |
|||
|
|||
@api.v7 |
|||
def get_serialised_mail_wall_widgets_summary(self, cr, uid, excluded_categories=None, context=None): |
|||
return self._get_serialised_mail_wall_widgets_summary(cr, uid, uid, excluded_categories=excluded_categories, context=context)[0] |
|||
|
|||
@api.one |
|||
def _get_serialised_mail_wall_widgets_summary(self, excluded_categories=None): |
|||
""" |
|||
[ |
|||
{ |
|||
'id': ..., |
|||
'model': ..., |
|||
'currency': <res.currency id>, |
|||
'data': (depend on model) |
|||
}, |
|||
] |
|||
""" |
|||
user = self.env.user |
|||
res = [] |
|||
model = 'mail.wall.widgets.widget' |
|||
domain = [('group_ids', 'in', user.groups_id.ids), ('active', '=', True)] |
|||
for widget in self.env[model].search(domain, order='sequence'): |
|||
if widget.cache: |
|||
#TODO |
|||
continue |
|||
res.append({ |
|||
'model': model, |
|||
'id': widget.id, |
|||
'currency': user.company_id.currency_id.id, |
|||
'data': widget.get_data(user)[0], |
|||
}) |
|||
return res |
|||
|
|||
#def get_challenge_suggestions(self, cr, uid, context=None): |
|||
# """Return the list of challenges suggested to the user""" |
|||
# challenge_info = [] |
|||
# challenge_obj = self.pool.get('mail_wall_widgets.challenge') |
|||
# challenge_ids = challenge_obj.search(cr, uid, [('invited_user_ids', 'in', uid), ('state', '=', 'inprogress')], context=context) |
|||
# for challenge in challenge_obj.browse(cr, uid, challenge_ids, context=context): |
|||
# values = { |
|||
# 'id': challenge.id, |
|||
# 'name': challenge.name, |
|||
# 'description': challenge.description, |
|||
# } |
|||
# challenge_info.append(values) |
|||
# return challenge_info |
@ -1,2 +0,0 @@ |
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
|||
access_mail_wall_widgets,mail.wall.widgets.widget,model_mail_wall_widgets_widget,,1,1,1,1 |
Before Width: 100 | Height: 100 | Size: 2.1 KiB |
@ -1,58 +0,0 @@ |
|||
.openerp .oe_mail_wall .oe_mail_wall_aside .oe_mail_wall_widgets{ |
|||
background-color:inherit; |
|||
} |
|||
.oe_open_record:hover, .oe_open_record_list:hover{ |
|||
cursor:pointer; |
|||
} |
|||
.oe_goal_outer_box .more{ |
|||
text-align:center; |
|||
padding: 10px 5px; |
|||
} |
|||
|
|||
.openerp .oe_mail_wall .oe_goal .oe_goals_list.funnel .oe_cell.oe_goal_current { |
|||
font-size: 150%; |
|||
font-weight: bold; |
|||
min-width: 65px; |
|||
padding: 0 5px; |
|||
} |
|||
.openerp .oe_mail_wall .oe_goal .oe_goals_list .oe_cell.oe_goal_current .oe_form_field_monetary{ |
|||
font-weight: normal; |
|||
font-size: 70%; |
|||
white-space: nowrap; |
|||
} |
|||
.openerp .oe_mail_wall .oe_goal .oe_goals_list .oe_cell.oe_goal_current .oe_form_field_monetary .oe_form_char_content { |
|||
font-weight: bold; |
|||
font-size: 142%; /* 1/.7 */ |
|||
} |
|||
|
|||
.openerp .oe_mail_wall .oe_goal .oe_goals_list .oe_cell.oe_goal_current span.small { |
|||
font-weight: normal; |
|||
font-size: 70%; |
|||
} |
|||
.oe_open_record:hover, .oe_open_record_list_funnel:hover{ |
|||
cursor:pointer; |
|||
} |
|||
|
|||
.openerp .oe_mail_wall .list_group{ |
|||
margin-bottom:0.6em; |
|||
} |
|||
.openerp .oe_mail_wall .list_group .group_label{ |
|||
padding: 0 0 0.1em 1em; |
|||
font-size:120%; |
|||
} |
|||
.openerp .oe_mail_wall .list_group.overdue .group_label{ |
|||
color:red; |
|||
} |
|||
.openerp .oe_mail_wall .list_group.today .group_label{ |
|||
font-weight:bold; |
|||
} |
|||
.openerp .oe_mail_wall .list_group.later .group_label{ |
|||
color:grey; |
|||
} |
|||
|
|||
.openerp .oe_mail_wall .list_group .empty_list{ |
|||
background-color:white; |
|||
padding:10px 0; |
|||
color:grey; |
|||
text-align:center; |
|||
} |
@ -1,155 +0,0 @@ |
|||
openerp.mail_wall_widgets = function(instance) { |
|||
var QWeb = instance.web.qweb; |
|||
var _t = instance.web._t; |
|||
|
|||
instance.mail_wall_widgets.Sidebar = instance.web.Widget.extend({ |
|||
template: 'mail_wall_widgets.UserWallSidebar', |
|||
init: function (parent, action) { |
|||
var self = this; |
|||
this._super(parent, action); |
|||
this.deferred = $.Deferred(); |
|||
self.money_df = $.Deferred() |
|||
self.money_df.resolve(); |
|||
self.money_cache = {} |
|||
//$(document).off('keydown.klistener');
|
|||
this.widget_templates = { |
|||
'mail.wall.widgets.widget': "mail_wall_widgets.Widget" |
|||
} |
|||
}, |
|||
events: { |
|||
'click .oe_open_record': function(event){ |
|||
var $t = $(event.currentTarget); |
|||
this.do_action({ |
|||
'name': _t('Details'), |
|||
'type': 'ir.actions.act_window', |
|||
'res_model': $t.parent().parent().attr('data-model'), |
|||
'res_id': parseInt($t.attr('data-id')), |
|||
'target': 'current', |
|||
'views': [[false, 'form'],[false, 'list']], |
|||
'domain': $t.parent().parent().attr('data-domain'), |
|||
}) |
|||
}, |
|||
'click .oe_open_record_list': function(event){ |
|||
var $t = $(event.currentTarget); |
|||
this.do_action({ |
|||
'name': _t('More...'), |
|||
'type': 'ir.actions.act_window', |
|||
'res_model': $t.parent().attr('data-model'), |
|||
'target': 'current', |
|||
'views': [[false, 'list'],[false, 'form']], |
|||
'domain': $t.parent().attr('data-domain'), |
|||
}) |
|||
}, |
|||
'click .oe_open_record_list_funnel': function(event){ |
|||
var $t = $(event.currentTarget); |
|||
this.do_action({ |
|||
'name': _t('More...'), |
|||
'type': 'ir.actions.act_window', |
|||
'res_model': $t.parent().attr('data-model'), |
|||
'target': 'current', |
|||
'views': [[false, 'list'],[false, 'form']], |
|||
'domain': $t.attr('data-domain'), |
|||
}) |
|||
}, |
|||
}, |
|||
start: function() { |
|||
var self = this; |
|||
this._super.apply(this, arguments); |
|||
self.get_widgets_info(); |
|||
}, |
|||
get_widgets_info: function() { |
|||
var self = this; |
|||
self.dfm = new instance.web.form.DefaultFieldManager(self); |
|||
new instance.web.Model('res.users').call('get_serialised_mail_wall_widgets_summary', []).then(function(result) { |
|||
if (result.length === 0) { |
|||
self.$el.find(".oe_mail_wall_widgets").hide(); |
|||
} else { |
|||
self.$el.find(".oe_mail_wall_widgets").empty(); |
|||
_.each(result, function(item){ |
|||
var $item = $(QWeb.render(self.widget_templates[item.model], {info: item})); |
|||
self.render_money_fields($item); |
|||
self.render_float_fields($item); |
|||
//self.render_user_avatars($item);
|
|||
self.$el.find('.oe_mail_wall_widgets').append($item); |
|||
}); |
|||
} |
|||
}); |
|||
}, |
|||
render_money_fields: function(item) { |
|||
var self = this; |
|||
// Generate a FieldMonetary for each .oe_goal_field_monetary
|
|||
item.find(".oe_goal_field_monetary").each(function() { |
|||
var currency_id = parseInt( $(this).attr('data-id'), 10); |
|||
var precision = parseFloat( $(this).attr('data-precision') , 10) || 1; |
|||
var digits = [69,0]; |
|||
if (precision && precision<1) |
|||
digits[1] = ($(this).attr('data-precision') || '0.01').slice(2).indexOf('1')+1; |
|||
var money_field = new instance.web.form.FieldMonetary(self.dfm, { |
|||
attrs: { |
|||
'modifiers': '{"readonly": true}', |
|||
'digits': digits |
|||
} |
|||
}); |
|||
//money_field.set('currency', currency_id);
|
|||
money_field.set('value', parseInt(parseFloat($(this).text(), 10)/precision)*precision); |
|||
money_field.replace($(this)); |
|||
|
|||
self.money_df = |
|||
self.money_df.then(function(){ |
|||
var callback = function(){ |
|||
money_field.set({'currency_info': self.money_cache[currency_id]}) |
|||
} |
|||
if (self.money_cache[currency_id]){ |
|||
callback(); |
|||
return; |
|||
} |
|||
var req = new instance.web.Model("res.currency").query(["symbol", "position"]).filter([["id", "=", currency_id]]).first() |
|||
return req.then(function(res){ |
|||
self.money_cache[currency_id] = res; |
|||
callback(); |
|||
}) |
|||
}) |
|||
}); |
|||
}, |
|||
render_float_fields: function(item) { |
|||
var self = this; |
|||
// Generate a FieldMonetary for each .oe_goal_field_monetary
|
|||
item.find(".oe_goal_field_float").each(function() { |
|||
var value = $(this).text(); |
|||
if (!value) |
|||
return; |
|||
var precision = parseFloat( $(this).attr('data-precision'), 10) || 1; |
|||
var digits = [69,0]; |
|||
if (precision && precision<1) |
|||
digits[1] = ($(this).attr('data-precision') || '0.01').slice(2).indexOf('1')+1; |
|||
|
|||
value = instance.web.format_value(parseFloat(value), {type: "float", digits: digits}, '') |
|||
$(this).text(value) |
|||
}); |
|||
}, |
|||
render_user_avatars: function(item) { |
|||
var self = this; |
|||
item.find(".oe_user_avatar").each(function() { |
|||
var user_id = parseInt( $(this).attr('data-id'), 10); |
|||
var url = instance.session.url('/web/binary/image', {model: 'res.users', field: 'image_small', id: user_id}); |
|||
$(this).attr("src", url); |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
instance.web.WebClient.include({ |
|||
to_kitten: function() { |
|||
this._super(); |
|||
new instance.web.Model('mail_wall_widgets.badge').call('check_progress', []); |
|||
} |
|||
}); |
|||
|
|||
instance.mail.Wall.include({ |
|||
start: function() { |
|||
this._super(); |
|||
var sidebar = new instance.mail_wall_widgets.Sidebar(this); |
|||
sidebar.appendTo($('.oe_mail_wall_aside')); |
|||
}, |
|||
}); |
|||
|
|||
}; |
@ -1,131 +0,0 @@ |
|||
<templates> |
|||
<t t-name="mail_wall_widgets.UserWallSidebar" class="oe_mail_wall_widgets_user_wall_sidebar"> |
|||
<div> |
|||
<div class="oe_mail_wall_widgets"></div> |
|||
</div> |
|||
</t> |
|||
<t t-name="mail_wall_widgets.Widget"> |
|||
<div class="oe_goal"> |
|||
<div> |
|||
<a class="oe_update_challenge oe_e" rol="button" t-attf-id="{info.id}" t-attf-model="{info.model}">e</a> |
|||
<h4><t t-esc="info.data.name" /><t t-if="info.data.total_count or info.data.total_count==0"> (<t t-esc="info.data.total_count"/>)</t></h4> |
|||
</div> |
|||
|
|||
<t t-if="info.model=='mail.wall.widgets.widget' and info.data.type == 'list'"> |
|||
<div class="oe_table oe_goals_list" t-att-data-model="info.data.model" t-att-data-domain="info.data.domain"> |
|||
<div t-foreach="info.data.groups" t-as="group" t-if="group.lines.length or group.mandatory" t-attf-class="list_group #{group.class or ''}"> |
|||
<div t-if="group.label" class="group_label"> |
|||
<t t-esc="group.label"/> |
|||
</div> |
|||
<div t-foreach="group.lines" t-as="line" t-attf-class="oe_row oe_goal_outer_box oe_open_record record #{line.state == 'reached' ? 'oe_goal_reached' : ''} #{line.display_mode != 'progress' ? 'oe_no_progress' : ''}" t-att-data-id="line.id" > |
|||
<t t-if="line.display_mode == 'progress'"> |
|||
<div class="oe_goal_progress_background"></div> |
|||
<div class="oe_goal_progress" t-attf-style="#{line.display_mode == 'progress' ? 'width: '+line.completeness+'%;' : 'width:0;'}"></div> |
|||
<div class="oe_cell oe_goal_current" ><span t-attf-class="#{line.monetary ? 'oe_goal_field_monetary' : 'oe_goal_field_float'}" t-attf-data-id="#{line.monetary ? info.currency : ''}" t-attf-data-precision="#{info.data.precision or ''}"><t t-esc="line.current" /></span></div> |
|||
</t> |
|||
<div class="oe_cell"> |
|||
<span t-att-title="line.description"><t t-raw="line.name" /></span> |
|||
</div> |
|||
</div> |
|||
<t t-if="!group.lines.length"> |
|||
<div class="empty_list">No records</div> |
|||
</t> |
|||
</div> |
|||
|
|||
<div t-if="info.data.more" class="oe_row oe_goal_outer_box oe_open_record_list"> |
|||
<div class="oe_goal_progress_background"></div> |
|||
<div class="more"> |
|||
More... |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</t> |
|||
<t t-if="info.model=='mail.wall.widgets.widget' and info.data.type == 'funnel'"> |
|||
<div class="oe_table oe_goals_list funnel" t-att-data-model="info.data.model" t-att-data-domain="info.data.domain"> |
|||
<div t-foreach="info.data.stages" t-as="line" t-attf-class="oe_row oe_goal_outer_box oe_open_record_list_funnel record #{line.state == 'reached' ? 'oe_goal_reached' : ''} #{line.display_mode != 'progress' ? 'oe_no_progress' : ''}" t-att-data-id="line.id" t-att-data-domain="line.domain" > |
|||
<t t-if="line.display_mode == 'progress'"> |
|||
<div class="oe_goal_progress_background"></div> |
|||
<div class="oe_goal_progress" t-attf-style="#{line.display_mode == 'progress' ? 'width: '+line.rel_value+'%;' : 'width:0;'}"></div> |
|||
<div class="oe_cell oe_goal_current"><span class="oe_goal_field_float" t-attf-data-precision="#{info.data.precision or ''}"><t t-esc="line.rel_value" /></span><span class="small">%</span></div> |
|||
</t> |
|||
<div class="oe_cell"> |
|||
<span t-att-title="line.description"><b><t t-raw="line.name" /></b></span> - <span t-attf-class="#{line.monetary ? 'oe_goal_field_monetary' : 'oe_goal_field_float'}" t-attf-data-id="#{line.monetary ? info.currency : ''}" t-attf-data-precision="#{info.data.precision or ''}"><t t-esc="line.abs_value" /></span><t t-if="line.suffix"> <t t-esc="line.suffix"/></t> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</t> |
|||
<t t-if="info.model=='mail.wall.widgets.widget' and info.data.type == 'slice'"> |
|||
<div class="oe_table oe_goals_list funnel" t-att-data-model="info.data.model" t-att-data-domain="info.data.domain"> |
|||
<t t-set="line" t-value="info.data"/> |
|||
<div t-attf-class="oe_row oe_goal_outer_box oe_open_record_list record #{line.state == 'reached' ? 'oe_goal_reached' : ''} #{line.display_mode != 'progress' ? 'oe_no_progress' : ''}" t-att-data-id="line.id" t-att-data-domain="line.won_domain" > |
|||
<t t-if="line.display_mode == 'progress'"> |
|||
<div class="oe_goal_progress_background"></div> |
|||
<div class="oe_goal_progress" t-attf-style="#{line.display_mode == 'progress' ? 'width: '+line.slice+'%;' : 'width:0;'}"></div> |
|||
<div class="oe_cell oe_goal_current"><t t-esc="line.slice" /><span class="small">%</span></div> |
|||
</t> |
|||
<div class="oe_cell"> |
|||
<span t-att-title="line.description"><b><span t-attf-class="#{line.monetary ? 'oe_goal_field_monetary' : ''}" t-attf-data-id="#{line.monetary ? info.currency : ''}"><t t-esc="line.won" /></span></b></span> from <span t-attf-class="#{line.monetary ? 'oe_goal_field_monetary' : 'oe_goal_field_float'}" t-attf-data-id="#{line.monetary ? info.currency : ''}" t-attf-data-precision="#{info.data.precision or ''}"><t t-esc="line.total" /></span><t t-if="line.suffix"> <t t-esc="line.suffix"/></t> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</t> |
|||
|
|||
<t t-if="0 and challenge.visibility_mode == 'ranking'"> |
|||
<div t-foreach="challenge.lines" t-as="line" class="oe_goals_list oe_table"> |
|||
<div class="oe_row"> |
|||
<div class="oe_cell oe_thead" colspan="3" t-attf-title="#{line.description ? line.description : ''}"> |
|||
<strong><t t-esc="line.name"/></strong> |
|||
<br/> |
|||
<div class="oe_grey"> |
|||
<t t-if="line.definition_condition == 'higher'"> |
|||
Target: |
|||
</t> |
|||
<t t-if="line.definition_condition == 'lower'"> |
|||
Target: <= |
|||
</t> |
|||
<span t-attf-class="#{line.monetary ? 'oe_goal_field_monetary' : ''}" t-attf-data-id="#{line.monetary ? challenge.currency : ''}"><t t-esc="line.target" /></span><t t-if="line.suffix"> <t t-esc="line.suffix"/></t> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div t-foreach="line.goals" t-as="goal" t-attf-class="#{goal.id == line.own_goal_id ? 'oe_bold' : ''}"> |
|||
<div t-attf-class="oe_row oe_goal_outer_box #{goal.state == 'reached' ? 'oe_goal_reached' : ''} #{line.display_mode != 'progress' ? 'oe_no_progress' : ''}"> |
|||
<t t-if="line.display_mode == 'progress'"> |
|||
<div class="oe_goal_progress_background"></div> |
|||
<div class="oe_goal_progress" t-attf-style="#{line.display_mode == 'progress' ? 'width: '+goal.completeness+'%;' : 'width:0;'}"></div> |
|||
</t> |
|||
|
|||
<div class="oe_cell col0"><t t-esc="goal.rank" /></div> |
|||
<div class="oe_cell col1"><img class="oe_user_avatar" t-attf-alt="#{goal.name}" t-attf-data-id="#{goal.user_id}"/></div> |
|||
<div class="oe_cell col2"> |
|||
<t t-if="line.display_mode == 'progress'"> |
|||
<!-- progress, action on current value --> |
|||
<t t-esc="goal.name"/><br/> |
|||
<t t-if="goal.id != line.own_goal_id or (line.computation_mode != 'manually' and !line.action)"> |
|||
<span t-attf-class="#{line.monetary ? 'oe_goal_field_monetary' : ''}" t-attf-data-id="#{line.monetary ? challenge.currency : ''}"><t t-esc="goal.current" /></span><t t-if="line.suffix"> <t t-esc="line.suffix"/></t> |
|||
</t> |
|||
<t t-if="goal.id == line.own_goal_id and (line.action or line.computation_mode == 'manually')"> |
|||
<a class="oe_goal_action" t-att-id="line.own_goal_id"> |
|||
<span t-attf-class="#{line.monetary ? 'oe_goal_field_monetary' : ''}" t-attf-data-id="#{line.monetary ? challenge.currency : ''}"><t t-esc="goal.current" /></span><t t-if="line.suffix"> <t t-esc="line.suffix"/></t> |
|||
</a> |
|||
</t> |
|||
</t> |
|||
<t t-if="line.display_mode != 'progress'"> |
|||
<!-- not progress, action on user name --> |
|||
<t t-if="goal.id != line.own_goal_id or (line.computation_mode != 'manually' and !line.action)"> |
|||
<t t-esc="goal.name"/> |
|||
</t> |
|||
<t t-if="goal.id == line.own_goal_id and (line.action or line.computation_mode == 'manually')"> |
|||
<a class="oe_goal_action" t-att-id="line.own_goal_id"><t t-esc="goal.name"/></a> |
|||
</t> |
|||
</t> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</t> |
|||
</div> |
|||
</t> |
|||
|
|||
</templates> |
@ -1,105 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
<template id="assets_backend" name="assets" inherit_id="web.assets_backend"> |
|||
<xpath expr="." position="inside"> |
|||
<link rel="stylesheet" href="/mail_wall_widgets/static/src/css/main.css"/> |
|||
<script type="text/javascript" src="/mail_wall_widgets/static/src/js/main.js"></script> |
|||
</xpath> |
|||
</template> |
|||
|
|||
<!-- Widget --> |
|||
<record id="mail_wall_widgets_widget_action" model="ir.actions.act_window"> |
|||
<field name="name">Widgets</field> |
|||
<field name="res_model">mail.wall.widgets.widget</field> |
|||
<field name="view_mode">tree,form</field> |
|||
<field name="help" type="html"> |
|||
<p class="oe_view_nocontent_create"> |
|||
Click to create a Widget. |
|||
</p> |
|||
<p> |
|||
Widget allows to show some information at the inbox |
|||
</p> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="mail_wall_widgets_list_view" model="ir.ui.view"> |
|||
<field name="name">Widget list view</field> |
|||
<field name="model">mail.wall.widgets.widget</field> |
|||
<field name="arch" type="xml"> |
|||
<tree string="Widgets"> |
|||
<field name="name"/> |
|||
<field name="sequence"/> |
|||
<field name="domain"/> |
|||
</tree> |
|||
</field> |
|||
</record> |
|||
|
|||
|
|||
<record id="mail_wall_widgets_form_view" model="ir.ui.view"> |
|||
<field name="name">Widget form view</field> |
|||
<field name="model">mail.wall.widgets.widget</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Widget"> |
|||
<sheet> |
|||
<label for="name" class="oe_edit_only"/> |
|||
<h1> |
|||
<field name="name" class="oe_inline"/> |
|||
</h1> |
|||
|
|||
<field name="type" class="oe_inline"/> |
|||
<label for="description" class="oe_edit_only"/> |
|||
<div> |
|||
<field name="description" class="oe_inline"/> |
|||
</div> |
|||
|
|||
<group string="How to select records?"> |
|||
|
|||
<field name="model_id" class="oe_inline"/> |
|||
<field name="domain" /> |
|||
<field name="won_domain" attrs="{'invisible':[('type', 'not in', ['funnel','slice'])]}" /> |
|||
<field name="field_date_id" attrs="{'required':[('agenda','=',True)]}"/> |
|||
<field name="start_date"/> |
|||
<field name="end_date"/> |
|||
</group> |
|||
<group string="How to select users?"> |
|||
<field name="group_ids" class="oe_inline" widget="many2many_tags"/> |
|||
</group> |
|||
<group string="How show data?"> |
|||
<field name="stage_field_id" attrs="{'invisible':[('type', 'not in', ['funnel'])]}"/> |
|||
<field name="value_field_id" class="oe_inline"/> |
|||
<field name="value_field_monetary" class="oe_inline"/> |
|||
<field name="precision" class="oe_inline"/> |
|||
<field name="content" attrs="{'invisible':[('type', 'not in', ['list'])]}"/> |
|||
<field name="limit" attrs="{'invisible':[('type', 'not in', ['list'])]}" class="oe_inline"/> |
|||
<field name="order" attrs="{'invisible':[('type', 'not in', ['list'])]}" class="oe_inline"/> |
|||
<field name="agenda" attrs="{'invisible':[('type', 'not in', ['list'])]}" class="oe_inline"/> |
|||
</group> |
|||
<group string="Other"> |
|||
<field name="sequence" class="oe_inline"/> |
|||
<field name="active"/> |
|||
</group> |
|||
</sheet> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="mail_wall_widgets_search_view" model="ir.ui.view"> |
|||
<field name="name">Widget Search</field> |
|||
<field name="model">mail.wall.widgets.widget</field> |
|||
<field name="arch" type="xml"> |
|||
<search string="Search Widget"> |
|||
<field name="name"/> |
|||
<field name="model_id"/> |
|||
<group expand="0" string="Group By"> |
|||
<filter string="Model" domain="[]" context="{'group_by':'model_id'}"/> |
|||
</group> |
|||
</search> |
|||
</field> |
|||
</record> |
|||
|
|||
<!-- menus in settings - technical feature required --> |
|||
<menuitem id="mail_wall_widgets_widget_menu" parent="gamification.gamification_menu" action="mail_wall_widgets_widget_action" sequence="50"/> |
|||
|
|||
</data> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue