diff options
| author | Raphael Collet <rco@openerp.com> | 2015-09-02 10:22:16 +0200 |
|---|---|---|
| committer | Raphael Collet <rco@openerp.com> | 2015-09-02 14:29:42 +0200 |
| commit | ed95043d7e0c04efd46f033f41bb401a3c24ea91 (patch) | |
| tree | 397c41994a91377c296ea720d971b32632807f42 /addons | |
| parent | 8af431d9063bf36e10278b4a1e7b9391dc6e2bda (diff) | |
[IMP] *: add archive/unarchive feature on some models
Add the statbutton, search filter, and enable the kanban column archiving on
models `res.partner`, `crm.lead`, `event.event`, `hr.employee`, `hr.applicant`,
`mail.mass_mailing`, `mail.mass_mailing.list`, `product.product`,
`project.project`, `project.task`, `project.issue`.
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/crm/crm_lead_view.xml | 25 | ||||
| -rw-r--r-- | addons/event/models/event.py | 1 | ||||
| -rw-r--r-- | addons/event/views/event_views.xml | 6 | ||||
| -rw-r--r-- | addons/hr/hr_view.xml | 10 | ||||
| -rw-r--r-- | addons/hr_recruitment/views/hr_recruitment_views.xml | 8 | ||||
| -rw-r--r-- | addons/mass_mailing/models/mass_mailing.py | 4 | ||||
| -rw-r--r-- | addons/mass_mailing/views/mass_mailing.xml | 12 | ||||
| -rw-r--r-- | addons/product/product_view.xml | 10 | ||||
| -rw-r--r-- | addons/project/project_view.xml | 29 | ||||
| -rw-r--r-- | addons/project_issue/project_issue_view.xml | 12 | ||||
| -rw-r--r-- | addons/resource/resource.py | 3 |
11 files changed, 88 insertions, 32 deletions
diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 1e5727df77e..deeb488e329 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -106,25 +106,24 @@ <header> <button name="%(crm.action_crm_lead2opportunity_partner)d" string="Convert to Opportunity" type="action" help="Convert to Opportunity" class="oe_highlight"/> - <button name="action_set_unactive" string="Archive" - type="object" class="oe_highlight" - attrs="{'invisible': ['|', ('active','=',False), ('probability', '<', 100)]}"/> <button name="action_set_won" string="Mark Won" type="object" class="oe_highlight" attrs="{'invisible': ['|', ('active','=',False), ('probability', '=', 100)]}"/> <button name="action_set_lost" string="Mark Lost" type="object" class="oe_highlight" attrs="{'invisible': [('active', '=', False)]}"/> - <button name="action_set_active" string="Unarchive" - type="object" class="oe_highlight" - attrs="{'invisible': [('active', '=', True)]}"/> <field name="stage_id" widget="statusbar" clickable="True" domain="['&', ('team_ids', '=', team_id), '|', ('type', '=', type), ('type', '=', 'both')]" options="{'fold_field': 'fold'}" on_change="onchange_stage_id(stage_id)"/> </header> <sheet> - <div class="oe_button_box" name="button_box"/> + <div class="oe_button_box" name="button_box"> + <button name="toggle_active" type="object" class="oe_stat_button" icon="fa-archive" + attrs="{'invisible': [('active', '=', True), ('probability', '<', 100)]}"> + <field name="active" widget="boolean_button" options='{"terminology": "archive"}'/> + </button> + </div> <div class="label label-danger pull-right" attrs="{'invisible': ['|', ('probability', '>', 0), ('active', '=', True)]}">Lost</div> <div class="label label-success pull-right" attrs="{'invisible': [('probability', '<', 100)]}">Won</div> <div class="oe_title"> @@ -192,7 +191,6 @@ </group> <group string="Opportunity" name="misc"> <field name="probability" groups="base.group_no_one"/> - <field name="active"/> </group> <group string="Analysis" groups="base.group_no_one"> <field name="date_open"/> @@ -408,9 +406,6 @@ <field name="arch" type="xml"> <form string="Opportunities"> <header> - <button name="action_set_unactive" string="Archive" - type="object" class="oe_highlight" - attrs="{'invisible': ['|', ('active','=',False), ('probability', '<', 100)]}"/> <button name="action_set_won" string="Mark Won" type="object" class="oe_highlight" attrs="{'invisible': ['|', ('active','=',False), ('probability', '=', 100)]}"/> @@ -418,9 +413,6 @@ type="action" class="oe_highlight" context="{'default_lead_id': active_id}" attrs="{'invisible': [('active', '=', False)]}"/> - <button name="action_set_active" string="Unarchive" - type="object" class="oe_highlight" - attrs="{'invisible': [('active', '=', True)]}"/> <field name="stage_id" widget="statusbar" clickable="True" options="{'fold_field': 'fold'}" domain="['&', ('team_ids', '=', team_id), '|', ('type', '=', type), ('type', '=', 'both')]" @@ -428,6 +420,10 @@ </header> <sheet> <div class="oe_button_box" name="button_box"> + <button name="toggle_active" type="object" class="oe_stat_button" icon="fa-archive" + attrs="{'invisible': [('active', '=', True), ('probability', '<', 100)]}"> + <field name="active" widget="boolean_button" options='{"terminology": "archive"}'/> + </button> <button class="oe_stat_button" type="object" context="{'partner_id': partner_id}" name="action_schedule_meeting" icon="fa-calendar"> @@ -553,7 +549,6 @@ <field name="source_id" /> </group> <group string="Misc" name="Misc"> - <field name="active"/> <field name="day_open" groups="base.group_no_one"/> <field name="day_close" groups="base.group_no_one"/> <field name="referred"/> diff --git a/addons/event/models/event.py b/addons/event/models/event.py index 59f34be38b7..a83f4fe8f36 100644 --- a/addons/event/models/event.py +++ b/addons/event/models/event.py @@ -31,6 +31,7 @@ class event_event(models.Model): name = fields.Char( string='Name', translate=True, required=True, readonly=False, states={'done': [('readonly', True)]}) + active = fields.Boolean(default=True, track_visibility="onchange") user_id = fields.Many2one( 'res.users', string='Responsible', default=lambda self: self.env.user, diff --git a/addons/event/views/event_views.xml b/addons/event/views/event_views.xml index b7303499da7..a6e523467be 100644 --- a/addons/event/views/event_views.xml +++ b/addons/event/views/event_views.xml @@ -66,6 +66,11 @@ </header> <sheet> <div class="oe_button_box" name="button_box" groups="base.group_user"> + <button name="toggle_active" type="object" + class="oe_stat_button" icon="fa-archive"> + <field name="active" widget="boolean_button" + options='{"terminology": "archive"}'/> + </button> <button name="%(event.act_event_registration_from_event)d" type="action" class="oe_stat_button oe_event_attendee_button" @@ -230,6 +235,7 @@ <separator/> <filter string="Unconfirmed" name="draft" domain="[('state','=','draft')]" help="Events in New state"/> <filter string="Confirmed" domain="[('state','=','confirm')]" help="Confirmed events"/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> <separator/> <filter string="My Events" help="My Events" domain="[('user_id','=',uid)]"/> <separator/> diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml index d95947029a1..03bc1f133f9 100644 --- a/addons/hr/hr_view.xml +++ b/addons/hr/hr_view.xml @@ -20,7 +20,13 @@ <field name="arch" type="xml"> <form string="Employee"> <sheet> - <div class="oe_button_box" name="button_box"/> + <div class="oe_button_box" name="button_box" groups="base.group_hr_user"> + <button name="toggle_active" type="object" + class="oe_stat_button" icon="fa-archive"> + <field name="active" widget="boolean_button" + options='{"terminology": "archive"}'/> + </button> + </div> <field name="image" widget='image' class="oe_avatar" options='{"preview_image":"image_medium"}'/> <div class="oe_title"> <label for="name" class="oe_edit_only"/> @@ -75,7 +81,6 @@ <page string="HR Settings" groups="base.group_hr_user"> <group> <group string='Status' name="active_group"> - <field name="active"/> <field name="company_id" groups="base.group_multi_company" on_change="onchange_company(company_id)"/> <field name="user_id" on_change="onchange_user(name, image, user_id)" string="Related User" context="{'default_groups_ref': ['base.group_user']}"/> @@ -120,6 +125,7 @@ <field name="category_ids" groups="base.group_hr_user"/> <field name="job_id" /> <filter string="Important Messages" name="message_needaction" domain="[('message_needaction','=',True)]"/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> <group expand="0" string="Group By"> <filter string="Manager" domain="[]" context="{'group_by':'parent_id'}"/> <filter string="Coach" domain="[]" context="{'group_by':'coach_id'}"/> diff --git a/addons/hr_recruitment/views/hr_recruitment_views.xml b/addons/hr_recruitment/views/hr_recruitment_views.xml index 636b7d74eab..bd12e351475 100644 --- a/addons/hr_recruitment/views/hr_recruitment_views.xml +++ b/addons/hr_recruitment/views/hr_recruitment_views.xml @@ -107,6 +107,11 @@ attrs="{'invisible': [('emp_id', '=', False)]}"> <field name="employee_name" widget="statinfo" string="Employee"/> </button> + <button name="toggle_active" type="object" + class="oe_stat_button" icon="fa-archive"> + <field name="active" widget="boolean_button" + options='{"terminology": "archive"}'/> + </button> </div> <div class="oe_title"> <label for="name" class="oe_edit_only"/> @@ -142,7 +147,6 @@ <field name="medium_id" groups="base.group_no_one" /> <field name="source_id"/> <field name="reference"/> - <field name="active" invisible="1"/> </group> <group string="Job"> <field name="survey" invisible="1"/> @@ -214,6 +218,7 @@ domain="[('date_action','<>',False)]" help="Filter and view on next actions and date"/> <separator/> <filter string="Important Messages" name="message_needaction" domain="[('message_needaction','=',True)]"/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> <field name="job_id"/> <field name="department_id"/> <field name="user_id"/> @@ -269,6 +274,7 @@ <field name="categ_ids"/> <field name="message_needaction_counter"/> <field name="attachment_number"/> + <field name="active"/> <templates> <t t-name="kanban-tooltip"> <ul class="oe_kanban_tooltip"> diff --git a/addons/mass_mailing/models/mass_mailing.py b/addons/mass_mailing/models/mass_mailing.py index 2357586e1ab..10b2a22f11f 100644 --- a/addons/mass_mailing/models/mass_mailing.py +++ b/addons/mass_mailing/models/mass_mailing.py @@ -40,6 +40,7 @@ class MassMailingList(osv.Model): _columns = { 'name': fields.char('Mailing List', required=True), + 'active': fields.boolean('Active'), 'create_date': fields.datetime('Creation Date'), 'contact_nbr': fields.function( _get_contact_nbr, type='integer', @@ -61,6 +62,7 @@ class MassMailingList(osv.Model): <p class="o_message_paragraph">Join our Marketing newsletter and get <strong>this white paper instantly</strong></p>""" _defaults = { + 'active': True, 'popup_content': _get_default_popup_content, } @@ -475,6 +477,7 @@ class MassMailing(osv.Model): _columns = { 'name': fields.char('Subject', required=True), + 'active': fields.boolean('Active'), 'email_from': fields.char('From', required=True), 'create_date': fields.datetime('Creation Date'), 'sent_date': fields.datetime('Sent Date', oldname='date', copy=False), @@ -597,6 +600,7 @@ class MassMailing(osv.Model): return res _defaults = { + 'active': True, 'state': 'draft', 'email_from': lambda self, cr, uid, ctx=None: self.pool['mail.message']._get_default_from(cr, uid, context=ctx), 'reply_to': lambda self, cr, uid, ctx=None: self.pool['mail.message']._get_default_from(cr, uid, context=ctx), diff --git a/addons/mass_mailing/views/mass_mailing.xml b/addons/mass_mailing/views/mass_mailing.xml index 14aa062b2c1..5276eb16156 100644 --- a/addons/mass_mailing/views/mass_mailing.xml +++ b/addons/mass_mailing/views/mass_mailing.xml @@ -230,6 +230,7 @@ <search string="Mailing Lists"> <field name="name"/> <field name="create_date"/> + <filter name="inactive" string="Archived" domain="[('active','=',False)]"/> <group expand="0" string="Group By"> <filter string="Creation Month" name="group_create_date" context="{'group_by': 'create_date'}"/> @@ -258,6 +259,11 @@ <form string="Contact List"> <sheet> <div class="oe_button_box" name="button_box"> + <button name="toggle_active" type="object" + class="oe_stat_button" icon="fa-archive"> + <field name="active" widget="boolean_button" + options='{"terminology": "archive"}'/> + </button> <button name="%(mass_mailing.action_view_mass_mailing_contacts_from_list)d" type="action" icon="fa-user" class="oe_stat_button"> <field name="contact_nbr" string="Recipients" widget="statinfo"/> @@ -308,6 +314,7 @@ <search string="Mass Mailings"> <field name="name" string="Mailings"/> <field name="mass_mailing_campaign_id"/> + <filter name="inactive" string="Archived" domain="[('active','=',False)]"/> <group expand="0" string="Group By"> <filter string="Status" name="group_state" context="{'group_by': 'state'}"/> @@ -432,6 +439,11 @@ type="action" class="oe_stat_button"> <field name="bounced_ratio" string="Bounced" widget="percentpie"/> </button> + <button name="toggle_active" type="object" + class="oe_stat_button" icon="fa-archive"> + <field name="active" widget="boolean_button" + options='{"terminology": "archive"}'/> + </button> </div> <group> diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index 87016325176..2f792de3ced 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -40,6 +40,7 @@ <filter string="Products" name="consumable" domain="[('type','=','consu')]" help="Products your store in the inventory"/> <separator/> <filter string="Can be Sold" name="filter_to_sell" domain="[('sale_ok','=',1)]"/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> <field string="Attributes" name="attribute_line_ids"/> <field name="pricelist_id" widget="selection" context="{'pricelist': self}" filter_domain="[]" groups="product.group_sale_pricelist"/> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! --> </search> @@ -80,7 +81,13 @@ <field name="is_product_variant" invisible="1"/> <field name='product_variant_count' invisible='1'/> <field name="id" invisible="True"/> - <div class="oe_button_box" name="button_box"/> + <div class="oe_button_box" name="button_box"> + <button name="toggle_active" type="object" groups="base.group_no_one" + class="oe_stat_button" icon="fa-archive"> + <field name="active" widget="boolean_button" + options='{"terminology": "archive"}'/> + </button> + </div> <field name="image_medium" widget="image" class="oe_avatar"/> <div class="oe_title"> <label class="oe_edit_only" for="name" string="Product Name"/> @@ -99,7 +106,6 @@ <field name="type" on_change="onchange_type(type, context)"/> </group> <group name="group_standard_price"> - <field name="active" groups="base.group_no_one"/> <field name="list_price"/> <label for="standard_price" groups="base.group_user"/> <div name="standard_price_uom" groups="base.group_user"> diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 911b9128a72..2cbea588298 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -35,6 +35,7 @@ <filter string="New" name="draft" domain="[('stage_id.sequence', '<=', 1)]"/> <separator/> <filter string="Important Messages" name="message_needaction" domain="[('message_needaction','=',True)]"/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> <group expand="0" string="Group By"> <filter string="Project" name="project" context="{'group_by':'project_id'}"/> <filter string="Task" context="{'group_by':'name'}"/> @@ -76,9 +77,6 @@ <field name="arch" type="xml"> <form string="Project"> <header> - <button name="set_template" string="Set as Template" type="object" states="open" groups="base.group_user"/> - <button string="New Project Based on Template" name="duplicate_template" type="object" states="template" class="oe_highlight" groups="base.group_user"/> - <button name="reset_project" string="Reset as Project" type="object" states="template" class="oe_highlight" groups="base.group_user"/> <field name="state" widget="statusbar" clickable="True"/> </header> <sheet string="Project"> @@ -91,6 +89,13 @@ <button class="oe_stat_button" name="attachment_tree_view" type="object" icon="fa-files-o"> <field string="Documents" name="doc_count" widget="statinfo"/> </button> + <button name="toggle_active" type="object" + confirm="(Un)archiving a project automatically (un)archives its tasks and issues. Do you want to proceed?" + class="oe_stat_button" icon="fa-archive" + attrs="{'invisible':[('state','in',['open', 'pending'])]}"> + <field name="active" widget="boolean_button" + options='{"terminology": "archive"}'/> + </button> </div> <div class="oe_title"> <h1> @@ -121,7 +126,6 @@ </group> <group string="Configuration" groups="base.group_no_one"> <field name="sequence" groups="base.group_no_one"/> - <field name="active" attrs="{'invisible':[('state','in',['open', 'pending', 'template'])]}"/> </group> </group> </page> @@ -165,6 +169,7 @@ <filter string="Followed by Me" domain="[('message_is_follower','=',True)]"/> <separator/> <filter string="Important Messages" name="message_needaction" domain="[('message_needaction','=',True)]"/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> <field name="user_id" string="Project Manager"/> <field name="partner_id" string="Contact" filter_domain="[('partner_id', 'child_of', self)]"/> <group expand="0" string="Group By"> @@ -245,14 +250,21 @@ options="{'fold_field': 'fold'}"/> </header> <sheet string="Task"> + <div class="oe_button_box" name="button_box"> + <button name="toggle_active" type="object" groups="base.group_user" + class="oe_stat_button" icon="fa-archive"> + <field name="active" widget="boolean_button" + options='{"terminology": "archive"}'/> + </button> + <field name="kanban_state" widget="kanban_state_selection" + options='{ + "states_legend_field": "stage_id", + "states_legend": {"normal": "legend_normal", "blocked": "legend_blocked", "done": "legend_done"}}'/> + </div> <div class="oe_title"> <h1 class="o_row"> <field name="priority" widget="priority"/> <field name="name" placeholder="Task Title..."/> - <field name="kanban_state" widget="kanban_state_selection" - options='{ - "states_legend_field": "stage_id", - "states_legend": {"normal": "legend_normal", "blocked": "legend_blocked", "done": "legend_done"}}'/> </h1> </div> <group> @@ -325,6 +337,7 @@ <field name="message_needaction_counter"/> <field name="tag_ids"/> <field name="displayed_image_id"/> + <field name="active"/> <templates> <t t-name="kanban-box"> <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click"> diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index ad6d9a7f4e9..ee69b24da9f 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -12,6 +12,13 @@ options="{'fold_field': 'fold'}"/> </header> <sheet string="Issue"> + <div class="oe_button_box" name="button_box"> + <button name="toggle_active" type="object" groups="base.group_no_one" + class="oe_stat_button" icon="fa-archive"> + <field name="active" widget="boolean_button" + options='{"terminology": "archive"}'/> + </button> + </div> <div class="row"> <h1 class="col-xs-11"> <field name="name" class="oe_inline" placeholder="Issue Summary..."/> @@ -59,9 +66,6 @@ <field name="inactivity_days"/> <field name="days_since_creation"/> </group> - <group groups="base.group_no_one"> - <field name="active"/> - </group> </group> </page> </notebook> @@ -122,6 +126,7 @@ <separator/> <filter string="Create Day" context="{'group_by':'create_date:day'}" help="Create Date"/> <filter string="Last Message" name="group_message_last_post" context="{'group_by':'message_last_post:week'}"/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> </group> </search> </field> @@ -153,6 +158,7 @@ <field name="user_id"/> <field name="date_deadline"/> <field name="message_needaction_counter"/> + <field name="active"/> <templates> <t t-name="kanban-tooltip"> <ul class="oe_kanban_tooltip"> diff --git a/addons/resource/resource.py b/addons/resource/resource.py index 6f558c04392..250cca8d1bb 100644 --- a/addons/resource/resource.py +++ b/addons/resource/resource.py @@ -666,7 +666,8 @@ class resource_resource(osv.osv): _columns = { 'name': fields.char("Name", required=True), 'code': fields.char('Code', size=16, copy=False), - 'active' : fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the resource record without removing it."), + 'active' : fields.boolean('Active', track_visibility='onchange', + help="If the active field is set to False, it will allow you to hide the resource record without removing it."), 'company_id' : fields.many2one('res.company', 'Company'), 'resource_type': fields.selection([('user','Human'),('material','Material')], 'Resource Type', required=True), 'user_id' : fields.many2one('res.users', 'User', help='Related user name for the resource to manage its access.'), |
