diff options
| author | Mahendra Barad (OpenERP) <mba@tinyerp.com> | 2014-01-07 18:41:34 +0530 |
|---|---|---|
| committer | Mahendra Barad (OpenERP) <mba@tinyerp.com> | 2014-01-07 18:41:34 +0530 |
| commit | 8eb7fb82de5bd5b7ec412f77d04d7b929a41a928 (patch) | |
| tree | a7ba226b1fa43eb6d5cc8e636aadf40ac26bb404 | |
| parent | 0562d90529bd43141d1996a13e8760cd5d1b6875 (diff) | |
[IMP]added the legend widget for priority and kanban state
bzr revid: mba@tinyerp.com-20140107131134-fho22izhbw86w1w5
| -rw-r--r-- | addons/crm/crm.py | 10 | ||||
| -rw-r--r-- | addons/crm/crm_lead.py | 14 | ||||
| -rw-r--r-- | addons/crm/crm_lead_demo.xml | 6 | ||||
| -rw-r--r-- | addons/crm/crm_lead_view.xml | 15 | ||||
| -rw-r--r-- | addons/hr_recruitment/hr_recruitment.py | 13 | ||||
| -rw-r--r-- | addons/hr_recruitment/hr_recruitment_view.xml | 27 | ||||
| -rw-r--r-- | addons/project/project.py | 4 | ||||
| -rw-r--r-- | addons/project/project_view.xml | 8 | ||||
| -rw-r--r-- | addons/project_issue/project_issue.py | 15 | ||||
| -rw-r--r-- | addons/project_issue/project_issue_demo.xml | 2 | ||||
| -rw-r--r-- | addons/project_issue/project_issue_view.xml | 44 |
11 files changed, 66 insertions, 92 deletions
diff --git a/addons/crm/crm.py b/addons/crm/crm.py index a98fcadb959..700047768ba 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -28,11 +28,11 @@ from openerp.osv import fields from openerp.osv import osv AVAILABLE_PRIORITIES = [ - ('1', 'Highest'), - ('2', 'High'), - ('3', 'Normal'), - ('4', 'Low'), - ('5', 'Lowest'), + ('0', 'Lowest'), + ('1', 'Low'), + ('2', 'Normal'), + ('3', 'High'), + ('4', 'Highest'), ] class crm_case_channel(osv.osv): diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index eaf51293355..c13e5703897 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -445,19 +445,7 @@ class crm_lead(format_address, osv.osv): return True def set_priority(self, cr, uid, ids, priority, context=None): - """ Set lead priority - """ - return self.write(cr, uid, ids, {'priority': priority}, context=context) - - def set_high_priority(self, cr, uid, ids, context=None): - """ Set lead priority to high - """ - return self.set_priority(cr, uid, ids, '1', context=context) - - def set_normal_priority(self, cr, uid, ids, context=None): - """ Set lead priority to normal - """ - return self.set_priority(cr, uid, ids, '3', context=context) + return self.write(cr, uid, ids, {'priority': str(priority)}, context=context) def _merge_get_result_type(self, cr, uid, opps, context=None): """ diff --git a/addons/crm/crm_lead_demo.xml b/addons/crm/crm_lead_demo.xml index dab17888d7a..c3785081d4f 100644 --- a/addons/crm/crm_lead_demo.xml +++ b/addons/crm/crm_lead_demo.xml @@ -174,7 +174,7 @@ Contact: +1 813 494 5005</field> <field name="type_id" ref="type_lead8"/> <field name="categ_ids" eval="[(6, 0, [categ_oppor4])]"/> <field name="channel_id" ref=""/> - <field name="priority">5</field> + <field name="priority">4</field> <field name="section_id" ref="crm_case_section_2"/> <field name="user_id" ref="base.user_root"/> <field name="stage_id" ref="stage_lead1"/> @@ -525,7 +525,7 @@ Andrew</field> <field name="type_id" ref="type_lead5"/> <field name="categ_ids" eval="[(6, 0, [categ_oppor3])]"/> <field name="channel_id" ref="crm_case_channel_direct"/> - <field name="priority">5</field> + <field name="priority">4</field> <field name="section_id" ref="section_sales_department"/> <field name="user_id" ref="base.user_demo"/> <field name="stage_id" ref="crm.stage_lead5"/> @@ -543,7 +543,7 @@ Andrew</field> <field name="type_id" ref="type_lead8"/> <field name="categ_ids" eval="[(6, 0, [categ_oppor7])]"/> <field name="channel_id" ref="crm_case_channel_website"/> - <field name="priority">5</field> + <field name="priority">4</field> <field eval="time.strftime('%Y-%m-6')" name="date_deadline"/> <field name="section_id" ref="section_sales_department"/> <field name="user_id" ref="base.user_root"/> diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 1107234b928..9c5746c7ead 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -302,9 +302,16 @@ <field name="title_action"/> </div> <div class="oe_kanban_bottom_right"> - <a t-if="record.priority.raw_value == 1" type="object" name="set_normal_priority" class="oe_e oe_star_on">7</a> - <a t-if="record.priority.raw_value != 1" type="object" name="set_high_priority" class="oe_e oe_star_off">7</a> - <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar" t-if="record.user_id.value"/> + <table> + <tr> + <td groups="base.group_user"> + <field name="priority" class="oe_inline" widget="legend" options="{'action':'set_priority'}"/> + </td> + <td> + <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/> + </td> + </tr> + </table> </div> <div class="oe_kanban_footer_left"> <t t-raw="record.message_summary.raw_value"/> @@ -394,6 +401,7 @@ name="action_makeMeeting" context="{'search_default_attendee_id': active_id, 'default_attendee_id' : active_id}"/> </div> + <field name="priority" class="oe_inline" widget="legend" options="{'action':'set_priority'}"/> <div class="oe_title"> <label for="name" class="oe_edit_only"/> <h1><field name="name"/></h1> @@ -422,7 +430,6 @@ <field name="title_action" class="oe_inline" nolabel="1" placeholder="e.g. Call for proposal"/> </div> <field name="date_deadline"/> - <field name="priority"/> </group> <group> diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index c293c689a5b..60f4ecafb4d 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -27,12 +27,11 @@ from openerp.tools.translate import _ from openerp.tools import html2plaintext AVAILABLE_PRIORITIES = [ - ('', ''), - ('5', 'Not Good'), - ('4', 'On Average'), - ('3', 'Good'), - ('2', 'Very Good'), - ('1', 'Excellent') + ('0', 'Not Good'), + ('1', 'On Average'), + ('2', 'Good'), + ('3', 'Very Good'), + ('4', 'Excellent') ] class hr_recruitment_source(osv.osv): @@ -467,7 +466,7 @@ class hr_applicant(osv.Model): def set_priority(self, cr, uid, ids, priority, *args): """Set applicant priority """ - return self.write(cr, uid, ids, {'priority': priority}) + return self.write(cr, uid, ids, {'priority': str(priority)}) def set_high_priority(self, cr, uid, ids, *args): """Set applicant priority to high diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml index bd90ccc9a45..54387490709 100644 --- a/addons/hr_recruitment/hr_recruitment_view.xml +++ b/addons/hr_recruitment/hr_recruitment_view.xml @@ -85,6 +85,7 @@ attrs="{'invisible':[('survey','=',False)]}"/> <button name="action_get_attachment_tree_view" string="Documents" type="object"/> </div> + <field name="priority" class="oe_inline" widget="legend" options="{'action':'set_priority'}"/> <div class="oe_title"> <label for="name" class="oe_edit_only"/> <h1><field name="name"/></h1> @@ -113,7 +114,6 @@ <field name="date_action"/> <field name="title_action" class="oe_inline" placeholder="e.g. Call for interview"/> </div> - <field name="priority"/> <field name="source_id"/> <field name="reference"/> </group> @@ -277,21 +277,16 @@ </div> <div style="width:240px"><field name="categ_ids"/></div> <div class="oe_kanban_right"> - <t t-set="priority" t-value="record.priority.raw_value || 5"/> - <a type="object" name="set_priority" args="['3']" t-if="priority gt 3"> - <img src="/web/static/src/img/icons/star-off.png" width="16" height="16" title="Good"/> - </a> - <a type="object" name="set_priority" args="['5']" t-if="priority lte 3"> - <img t-attf-src="/web/static/src/img/icons/star-#{priority lte 3 ? 'on' : 'off'}.png" width="16" height="16" title="Good"/> - </a> - <a type="object" name="set_priority" args="['2']"> - <img t-attf-src="/web/static/src/img/icons/star-#{priority lte 2 ? 'on' : 'off'}.png" width="16" height="16" title="Very Good"/> - </a> - <a type="object" name="set_priority" args="['1']"> - <img t-attf-src="/web/static/src/img/icons/star-#{priority == 1 ? 'on' : 'off'}.png" width="16" height="16" title="Excellent"/> - </a> - <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/> - + <table> + <tr> + <td groups="base.group_user"> + <field name="priority" class="oe_inline" widget="legend" options="{'action':'set_priority'}"/> + </td> + <td> + <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/> + </td> + </tr> + </table> </div> <div class="oe_kanban_footer_left" style="margin-top:5px;"> <t t-raw="record.message_summary.raw_value"/> diff --git a/addons/project/project.py b/addons/project/project.py index 1e822d6c8f4..600b20b6b04 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -764,7 +764,7 @@ class task(osv.osv): " * Normal is the default situation\n" " * Blocked indicates something is preventing the progress of this task\n" " * Ready for next stage indicates the task is ready to be pulled to the next stage", - readonly=True, required=False), + required=False), 'create_date': fields.datetime('Create Date', readonly=True, select=True), 'write_date': fields.datetime('Last Modification Date', readonly=True, select=True), #not displayed in the view but it might be useful with base_action_rule module (and it needs to be defined first for that) 'date_start': fields.datetime('Starting Date',select=True), @@ -823,6 +823,8 @@ class task(osv.osv): _order = "priority, sequence, date_start, name, id" def set_kanban_state(self, cr, uid, ids, state, context=None): + print 'state>>>>>>>>>>',ids + print 'state>>>>>>>>>>',state self.write(cr, uid, ids, {'kanban_state': state }, context=context); def set_priority(self, cr, uid, ids, priority, context=None): diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 3630779a9c0..e91bfda0d6b 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -375,8 +375,8 @@ <h1> <field name="name" placeholder="Task summary..." class="oe_inline"/> <div class="oe_right"> - <field name="kanban_state" class="oe_inline" widget="legend" options="{'legend_field':'kanban_state','action':'set_kanban_state'}" /> - <field name="priority" class="oe_inline" widget="legend" options="{'legend_field':'priority','action':'set_priority'}"/> + <field name="kanban_state" class="oe_inline" widget="legend" options="{'action':'set_kanban_state'}" /> + <field name="priority" class="oe_inline" widget="legend" options="{'action':'set_priority'}"/> </div> </h1> <group> @@ -513,10 +513,10 @@ <table> <tr> <td groups="base.group_user"> - <field name="kanban_state" class="oe_inline" widget="legend" options="{'legend_field':'kanban_state','action':'set_kanban_state'}" /> + <field name="kanban_state" class="oe_inline" widget="legend" options="{'action':'set_kanban_state'}" /> </td> <td groups="base.group_user"> - <field name="priority" class="oe_inline" widget="legend" options="{'legend_field':'priority','action':'set_priority'}"/> + <field name="priority" class="oe_inline" widget="legend" options="{'action':'set_priority'}"/> </td> <td> <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/> diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 8e789e03658..0b66fd9376d 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -250,7 +250,7 @@ class project_issue(osv.Model): " * Normal is the default situation\n" " * Blocked indicates something is preventing the progress of this issue\n" " * Ready for next stage indicates the issue is ready to be pulled to the next stage", - readonly=True, required=False), + required=False), 'email_from': fields.char('Email', size=128, help="These people will receive email.", select=1), 'email_cc': fields.char('Watchers Emails', size=256, help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"), 'date_open': fields.datetime('Opened', readonly=True,select=True), @@ -308,17 +308,10 @@ class project_issue(osv.Model): def set_priority(self, cr, uid, ids, priority, *args): """Set lead priority """ - return self.write(cr, uid, ids, {'priority' : priority}) + return self.write(cr, uid, ids, {'priority' : str(priority)}) - def set_high_priority(self, cr, uid, ids, *args): - """Set lead priority to high - """ - return self.set_priority(cr, uid, ids, '1') - - def set_normal_priority(self, cr, uid, ids, *args): - """Set lead priority to normal - """ - return self.set_priority(cr, uid, ids, '3') + def set_kanban_state(self, cr, uid, ids, state, context=None): + self.write(cr, uid, ids, {'kanban_state': state }, context=context); def copy(self, cr, uid, id, default=None, context=None): issue = self.read(cr, uid, id, ['name'], context=context) diff --git a/addons/project_issue/project_issue_demo.xml b/addons/project_issue/project_issue_demo.xml index 63fa37c84c3..29e5b05a1d1 100644 --- a/addons/project_issue/project_issue_demo.xml +++ b/addons/project_issue/project_issue_demo.xml @@ -35,7 +35,7 @@ <!-- Issues --> <record id="crm_case_buginaccountsmodule0" model="project.issue"> <field eval="time.strftime('%Y-%m-08 10:15:00')" name="date"/> - <field name="priority">5</field> + <field name="priority">4</field> <field name="user_id" ref="base.user_root"/> <field name="partner_id" ref="base.res_partner_2"/> <field name="section_id" ref="crm.section_sales_department"/> diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index 68c6712f530..b9f9828af6f 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -55,10 +55,10 @@ <label for="name" class="oe_edit_only"/> <h1> <field name="name" class="oe_inline"/> - <field name="kanban_state" invisible='1'/> - <button name="set_kanban_state_done" help="In Progress" attrs="{'invisible': [('kanban_state', 'in', ['done','blocked'])]}" type="object" icon="gtk-normal" class="oe_link oe_right"/> - <button name="set_kanban_state_blocked" help="Ready for Next Stage" attrs="{'invisible': [('kanban_state', 'in', ['normal','blocked'])]}" type="object" icon="gtk-yes" class="oe_link oe_right"/> - <button name="set_kanban_state_normal" help="Blocked" attrs="{'invisible': [('kanban_state', 'in', ['done','normal'])]}" type="object" icon="gtk-no" class="oe_link oe_right"/> + <div class="oe_right"> + <field name="kanban_state" class="oe_inline" widget="legend" options="{'action':'set_kanban_state'}" /> + <field name="priority" class="oe_inline" widget="legend" options="{'action':'set_priority'}"/> + </div> </h1> <label for="categ_ids" class="oe_edit_only"/> <field name="categ_ids" widget="many2many_tags"/> @@ -78,7 +78,6 @@ <group> <field name="id"/> <field name="version_id" groups="base.group_user"/> - <field name="priority" groups="base.group_user"/> <label for="task_id" groups="base.group_user"/> <div groups="base.group_user"> <field name="task_id" on_change="onchange_task_id(task_id)" class="oe_inline" context="{'default_project_id':project_id}"/> @@ -219,28 +218,19 @@ <div class="oe_kanban_footer_left"> <field name="categ_ids"/> <div class="oe_right"> - <span class="oe_kanban_highlight" groups="base.group_user"> - <a t-if="record.kanban_state.raw_value === 'normal'" type="object" string="In Progress" name="set_kanban_state_done" class="oe_kanban_status"> </a> - <a t-if="record.kanban_state.raw_value === 'done'" type="object" string="Ready for next stage" name="set_kanban_state_blocked" class="oe_kanban_status oe_kanban_status_green"> </a> - <a t-if="record.kanban_state.raw_value === 'blocked'" type="object" string="Blocked" name="set_kanban_state_normal" class="oe_kanban_status oe_kanban_status_red"> </a> - <t t-set="priority" t-value="record.priority.raw_value || 5"/> - <a type="object" name="set_priority" args="['3']" t-if="priority gt 3" title="Normal Priority"> - <img src="/web/static/src/img/icons/star-off.png" width="16" height="16"/> - </a> - <a type="object" name="set_priority" args="['5']" t-if="priority lte 3" title="Normal Priority"> - <img t-attf-src="/web/static/src/img/icons/star-#{priority lte 3 ? 'on' : 'off'}.png" width="16" height="16"/> - </a> - <a type="object" name="set_priority" args="['2']" title="High Priority"> - <img t-attf-src="/web/static/src/img/icons/star-#{priority lte 2 ? 'on' : 'off'}.png" width="16" height="16"/> - </a> - <a type="object" name="set_priority" args="['1']" title="Highest Priority"> - <img t-attf-src="/web/static/src/img/icons/star-#{priority == 1 ? 'on' : 'off'}.png" width="16" height="16"/> - </a> - </span> - <t t-if="record.date_deadline.raw_value and record.date_deadline.raw_value lt (new Date())"> - <span t-attf-class="oe_kanban_status oe_kaban_status_red"> </span> - </t> - <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/> + <table> + <tr> + <td groups="base.group_user"> + <field name="kanban_state" class="oe_inline" widget="legend" options="{'action':'set_kanban_state'}" /> + </td> + <td groups="base.group_user"> + <field name="priority" class="oe_inline" widget="legend" options="{'action':'set_priority'}"/> + </td> + <td> + <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/> + </td> + </tr> + </table> </div> </div> <div class="oe_kanban_footer_left"> |
