diff options
| author | Hitesh Trivedi <htr@openerp.com> | 2015-11-10 14:41:56 +0530 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2016-03-10 13:06:03 +0100 |
| commit | ed589ca98a2910fa802b51a577d6a36c6d511c27 (patch) | |
| tree | 0e25e356246608c919d12aed93496a649b7bed05 | |
| parent | 54245deebda56a24f7a2b266cc93f72670f77eef (diff) | |
[ADD] Add (Un)archive button on form view of following model
- slide.channel
- slide.slide
- forum.post
- forum.forum
- blog.blog
- blog.post
- survey.survey (only for closed surveys)
- stock.location.route
- stock.warehouse.orderpoint
- stock.picking.type
- stock.incoterms
- stock.warehouse
- stock.location.path
- stock.location
- crm.team
- mrp.bom
- mrp.routing
- mrp.workcenter
- fleet.vehicle.log.contract
- fleet.vehicle
- event.track
- crm.claim
- hr.equipment.request
- hr.equipment
- hr.department
- res.currency
- procurement.rule
22 files changed, 286 insertions, 20 deletions
diff --git a/addons/fleet/fleet.py b/addons/fleet/fleet.py index 4565e1eefd1..a3b382a97a7 100644 --- a/addons/fleet/fleet.py +++ b/addons/fleet/fleet.py @@ -312,6 +312,7 @@ class fleet_vehicle(osv.Model): _order= 'license_plate asc' _columns = { 'name': fields.function(_vehicle_name_get_fnc, type="char", string='Name', store=True), + 'active': fields.boolean('Active'), 'company_id': fields.many2one('res.company', 'Company'), 'license_plate': fields.char('License Plate', required=True, help='License plate number of the vehicle (ie: plate number for a car)'), 'vin_sn': fields.char('Chassis Number', help='Unique number written on the vehicle motor (VIN/SN number)', copy=False), @@ -351,6 +352,7 @@ class fleet_vehicle(osv.Model): } _defaults = { + 'active': True, 'doors': 5, 'odometer_unit': 'kilometers', 'state_id': _get_default_state, @@ -761,6 +763,7 @@ class fleet_vehicle_log_contract(osv.Model): _order='state desc,expiration_date' _columns = { 'name': fields.function(_vehicle_contract_name_get_fnc, type="text", string='Name', store=True), + 'active': fields.boolean('Active'), 'start_date': fields.date('Contract Start Date', help='Date when the coverage of the contract begins'), 'expiration_date': fields.date('Contract Expiration Date', help='Date when the coverage of the contract expirates (by default, one year after begin date)'), 'days_left': fields.function(get_days_left, type='integer', string='Warning Date'), @@ -779,6 +782,7 @@ class fleet_vehicle_log_contract(osv.Model): 'cost_amount': fields.related('cost_id', 'amount', string='Amount', type='float', store=True), #we need to keep this field as a related with store=True because the graph view doesn't support (1) to address fields from inherited table and (2) fields that aren't stored in database } _defaults = { + 'active': True, 'purchaser_id': lambda self, cr, uid, ctx: self.pool.get('res.users').browse(cr, uid, uid, context=ctx).partner_id.id or False, 'date': fields.date.context_today, 'start_date': fields.date.context_today, diff --git a/addons/fleet/fleet_view.xml b/addons/fleet/fleet_view.xml index d914720631d..b88beedbfd9 100644 --- a/addons/fleet/fleet_view.xml +++ b/addons/fleet/fleet_view.xml @@ -191,6 +191,9 @@ </header> <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="return_action_to_open" type="object" class="oe_stat_button" @@ -296,6 +299,7 @@ <field name="model">fleet.vehicle</field> <field name="arch" type="xml"> <tree string="Vehicle" decoration-warning="contract_renewal_due_soon and not contract_renewal_overdue" decoration-danger="contract_renewal_overdue"> + <field name="active" invisible="1"/> <field name="license_plate" /> <field name="model_id" /> <field name="driver_id" /> @@ -322,6 +326,8 @@ <field name="location"/> <field name="state_id" /> <filter name="alert_true" domain="['|',('contract_renewal_due_soon','=',True),('contract_renewal_overdue','=',True)]" string="Has Alert(s)"/> + <separator/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> <group expand="1" string="Group By"> <filter name="groupby_status" context="{'group_by' : 'state_id'}" string="Status"/> <filter name="groupby_model" context="{'group_by' : 'model_id'}" string="Model"/> @@ -424,6 +430,11 @@ <field name="state" widget="statusbar" /> </header> <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> + </div> <group col="2"> <group string="Contract details"> <field name="vehicle_id" on_change="on_change_vehicle(vehicle_id)"/> @@ -504,6 +515,7 @@ <field name="model">fleet.vehicle.log.contract</field> <field name="arch" type="xml"> <tree string="Contract logs" decoration-warning="days_left>0 and days_left<15" decoration-danger="days_left==0" decoration-muted="state=='closed'"> + <field name="active" invisible="1"/> <field name="start_date" /> <field name="expiration_date" /> <field name="days_left" invisible="1"/> @@ -530,6 +542,16 @@ </field> </record> + <record id="fleet_vehicle_log_contract_view_search" model="ir.ui.view"> + <field name="name">fleet.vehicle.log.contract.search</field> + <field name="model">fleet.vehicle.log.contract</field> + <field name="arch" type="xml"> + <search string="Vehicles Contracts"> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> + </search> + </field> + </record> + <record model='ir.actions.act_window' id='fleet_vehicle_log_contract_act'> <field name="name">Vehicles Contracts</field> <field name="res_model">fleet.vehicle.log.contract</field> diff --git a/addons/hr/hr.py b/addons/hr/hr.py index cdd88e67d0c..b2f285e8007 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -282,6 +282,7 @@ class hr_department(osv.osv): _columns = { 'name': fields.char('Department Name', required=True), 'complete_name': fields.function(_dept_name_get_fnc, type="char", string='Name'), + 'active': fields.boolean('Active'), 'company_id': fields.many2one('res.company', 'Company', select=True, required=False), 'parent_id': fields.many2one('hr.department', 'Parent Department', select=True), 'child_ids': fields.one2many('hr.department', 'parent_id', 'Child Departments'), @@ -293,6 +294,7 @@ class hr_department(osv.osv): } _defaults = { + 'active': True, 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr.department', context=c), } diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml index ffe98d23d95..60d89915ead 100644 --- a/addons/hr/hr_view.xml +++ b/addons/hr/hr_view.xml @@ -423,6 +423,11 @@ <field name="arch" type="xml"> <form string="department"> <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> + </div> <group col="4"> <field name="name"/> <field name="manager_id"/> @@ -458,6 +463,8 @@ <field name="name" string="Department"/> <field name="manager_id" /> <filter string="Unread Messages" name="message_needaction" domain="[('message_needaction','=',True)]"/> + <separator/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> </search> </field> </record> diff --git a/addons/hr_equipment/models/hr_equipment.py b/addons/hr_equipment/models/hr_equipment.py index fa7ebe2e95f..5e3c2dac7ec 100644 --- a/addons/hr_equipment/models/hr_equipment.py +++ b/addons/hr_equipment/models/hr_equipment.py @@ -106,6 +106,7 @@ class HrEquipment(models.Model): return recs.name_get() name = fields.Char('Asset Name', required=True, translate=True) + active = fields.Boolean(default=True) user_id = fields.Many2one('res.users', string='Technician', track_visibility='onchange') employee_id = fields.Many2one('hr.employee', string='Assigned to Employee', track_visibility='onchange') department_id = fields.Many2one('hr.department', string='Assigned to Department', track_visibility='onchange') diff --git a/addons/hr_equipment/views/hr_equipment_views.xml b/addons/hr_equipment/views/hr_equipment_views.xml index 475af318e1e..2e25903569f 100644 --- a/addons/hr_equipment/views/hr_equipment_views.xml +++ b/addons/hr_equipment/views/hr_equipment_views.xml @@ -17,6 +17,8 @@ <filter string="My Requests" domain="['|', ('employee_id.user_id', '=', uid), ('department_id.manager_id.user_id', '=', uid)]"/> <separator/> <filter string="Unread Messages" name="message_needaction" domain="[('message_needaction','=',True)]"/> + <separator/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> <group expand='0' string='Group by...'> <filter string='Users' domain="[]" context="{'group_by': 'user_id'}"/> <filter string='Category' domain="[]" context="{'group_by' : 'category_id'}"/> @@ -38,9 +40,12 @@ <field name="stage_id" widget="statusbar" clickable="true" readonly="1"/> </header> <sheet> - <div class="oe_right"> - <field name="kanban_state" class="oe_inline" widget="kanban_state_selection"/> + <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> </div> + <field name="kanban_state" widget="kanban_state_selection"/> <div class="oe_title"> <label for="name" class="oe_edit_only" string="Subject"/> <h1> @@ -54,7 +59,6 @@ <field name="category_id" groups="base.group_hr_manager"/> <field name="request_date" groups="base.group_no_one"/> <field name="close_date" groups="base.group_no_one"/> - <field name="active" invisible="1"/> </group> <group> <field name="user_id" string="Repair Responsible"/> @@ -139,6 +143,7 @@ <tree string="maintenance Request" decoration-bf="message_needaction==True"> <field name="message_needaction" invisible="1"/> <field name="name"/> + <field name="active" invisible="1"/> <field name="request_date" groups="base.group_no_one"/> <field name="employee_id"/> <field name="user_id"/> @@ -201,6 +206,9 @@ <form string="Equipments"> <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="%(hr_equipment_request_action_from_equipment)d" type="action" class="oe_stat_button" @@ -318,6 +326,7 @@ <tree string="Assign To Employee" decoration-bf="message_needaction==True"> <field name="message_needaction" invisible="1"/> <field name="name"/> + <field name="active" invisible="1"/> <field name="employee_id" string="Employee"/> <field name="department_id" string="Department"/> <field name="assign_date" groups="base.group_no_one"/> @@ -346,6 +355,8 @@ <filter string="My Equipments" domain="[('employee_id.user_id', '=', uid)]"/> <separator/> <filter string="Unread Messages" name="message_needaction" domain="[('message_needaction','=',True)]"/> + <separator/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> <group expand='0' string='Group by...'> <filter string='Users' domain="[]" context="{'group_by': 'user_id'}"/> <filter string='Category' domain="[]" context="{'group_by': 'category_id'}"/> diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 2ac1033f67e..0d3c52fd487 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -51,6 +51,7 @@ class mrp_workcenter(osv.osv): _description = 'Work Center' _inherits = {'resource.resource':"resource_id"} _columns = { + 'active': fields.boolean('Active'), 'note': fields.text('Description', help="Description of the Work Center. Explain here what's a cycle according to this Work Center."), 'capacity_per_cycle': fields.float('Capacity per Cycle', help="Number of operations this Work Center can do in parallel. If this Work Center represents a team of 5 workers, the capacity per cycle is 5."), 'time_cycle': fields.float('Time for 1 cycle (hour)', help="Time in hours for doing one cycle."), @@ -67,6 +68,7 @@ class mrp_workcenter(osv.osv): 'product_id': fields.many2one('product.product','Work Center Product', help="Fill this product to easily track your production costs in the analytic accounting."), } _defaults = { + 'active': True, 'capacity_per_cycle': 1.0, 'resource_type': 'material', } diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index 7e6c5ffdbb0..5fe94191487 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -166,6 +166,7 @@ <tree string="Work Center"> <field name="code"/> <field name="name"/> + <field name="active" invisible="1"/> <field name="resource_type"/> <field name="company_id" groups="base.group_multi_company"/> </tree> @@ -176,6 +177,11 @@ <field name="model">mrp.workcenter</field> <field name="arch" type="xml"> <form string="Work Center"> + <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> + </div> <group col="4"> <group> <field name="name"/> @@ -185,7 +191,6 @@ <group> <field name="code"/> <field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/> - <field name="active"/> </group> </group> <notebook> @@ -221,7 +226,7 @@ <search string="Search for mrp workcenter"> <field name="name" string="Mrp Workcenter" filter_domain="['|',('name','ilike',self),('code','ilike',self)]"/> <field name="resource_type"/> - <filter string="Inactive" domain="[('active','=',False)]"/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> <group expand="0" string="Group By..."> <filter string="Type" domain="[]" context="{'group_by':'resource_type'}"/> <filter string="Company" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/> @@ -299,6 +304,11 @@ <field name="arch" type="xml"> <form string="Routing"> <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> + </div> <group> <group> <field name="name"/> @@ -307,7 +317,6 @@ <group> <field name="location_id"/> <field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/> - <field name="active"/> </group> </group> <notebook> @@ -329,6 +338,7 @@ <tree string="Routing"> <field name="code"/> <field name="name"/> + <field name="active" invisible="1"/> <field name="location_id"/> <field name="company_id" groups="base.group_multi_company"/> </tree> @@ -340,7 +350,7 @@ <field name="arch" type="xml"> <search string="Routing"> <field name="name" string="Routing" filter_domain="['|',('name','ilike',self),('code','ilike',self)]"/> - <filter string="Inactive" domain="[('active','=',False)]"/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> <field name="location_id"/> <field name="company_id" groups="base.group_multi_company"/> <group expand="0" string="Group By..."> @@ -380,6 +390,11 @@ <field name="arch" type="xml"> <form string="Bill of Material"> <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> + </div> <group> <group> <field name="product_tmpl_id" on_change="onchange_product_tmpl_id(product_tmpl_id, product_qty, context)"/> @@ -422,7 +437,6 @@ <group> <field name="position"/> <field name="sequence"/> - <field name="active"/> </group> <group> <field name="date_start"/> @@ -453,6 +467,7 @@ <field name="model">mrp.bom</field> <field name="arch" type="xml"> <tree string="Bill of Materials"> + <field name="active" invisible="1"/> <field name="product_tmpl_id"/> <field name="code"/> <field name="product_id" groups="product.group_product_variant"/> @@ -466,6 +481,7 @@ <field name="model">mrp.bom</field> <field name="arch" type="xml"> <search string="Search Bill Of Material"> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> <field name="code"/> <field name="bom_line_ids" string="Components"/> <field name="product_tmpl_id" string="Product"/> diff --git a/addons/procurement/procurement_view.xml b/addons/procurement/procurement_view.xml index 474385414d8..bcc3f24b4a8 100644 --- a/addons/procurement/procurement_view.xml +++ b/addons/procurement/procurement_view.xml @@ -240,6 +240,8 @@ <field name="arch" type="xml"> <search string="Search Procurement"> <filter string="Global" name="route_false" domain="[('route_id','=',False)]" help="If the route is global"/> + <separator/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> </search> </field> </record> @@ -251,6 +253,7 @@ <field name="arch" type="xml"> <tree string="Procurement Rules"> <field name="name"/> + <field name="active" invisible="1"/> <field name="action"/> <field name='company_id' groups="base.group_multi_company"/> </tree> @@ -263,13 +266,17 @@ <field eval="10" name="priority"/> <field name="arch" type="xml"> <form string="Procurement Rule"> + <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> + </div> <div class="oe_title"> <label for="name" class="oe_edit_only"/> <h1><field name="name" placeholder="e.g. Buy"/></h1> </div> <group name="general"> <group> - <field name="active"/> <field name="action"/> </group> <group> diff --git a/addons/sales_team/views/crm_team_views.xml b/addons/sales_team/views/crm_team_views.xml index 1d5c36d9da6..146d40c71fd 100644 --- a/addons/sales_team/views/crm_team_views.xml +++ b/addons/sales_team/views/crm_team_views.xml @@ -13,6 +13,8 @@ <field name="arch" type="xml"> <search string="Salesteams Search"> <filter name="personal" string="My Salesteams" domain="['|', ('member_ids', '=', uid), ('user_id', '=', uid)]"/> + <separator/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> <field name="name"/> <field name="user_id"/> <field name="code"/> @@ -50,6 +52,11 @@ <field name="arch" type="xml"> <form string="Sales Team"> <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> + </div> <div class="oe_title"> <label for="name" class="oe_edit_only" string="Sales team"/> <h1> @@ -87,9 +94,6 @@ </field> </page> <page string="More Info" name="more_info" groups="base.group_no_one"> - <group> - <field name="active"/> - </group> <group string="Company" groups="base.group_multi_company"> <field name="company_id" options="{'no_create': True}"/> </group> @@ -112,6 +116,7 @@ <field name="arch" type="xml"> <tree string="Sales Team"> <field name="name"/> + <field name="active" invisible="1"/> <field name="code"/> <field name="user_id"/> </tree> diff --git a/addons/stock/stock.py b/addons/stock/stock.py index c91b081b245..b4342595342 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -3295,6 +3295,7 @@ class stock_warehouse(osv.osv): _columns = { 'name': fields.char('Warehouse Name', required=True, select=True), + 'active': fields.boolean('Active'), 'company_id': fields.many2one('res.company', 'Company', required=True, readonly=True, select=True, help='The company is automatically set from your user preferences.'), 'partner_id': fields.many2one('res.partner', 'Address'), 'view_location_id': fields.many2one('stock.location', 'View Location', required=True, domain=[('usage', '=', 'view')]), @@ -3387,6 +3388,7 @@ class stock_warehouse(osv.osv): self.write(cr, uid, [warehouse.id, wh.id], {'route_ids': [(4, inter_wh_route_id)]}, context=context) _defaults = { + 'active': True, 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', context=c), 'reception_steps': 'one_step', 'delivery_steps': 'ship_only', diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 0fc6cd5dbc8..185e78bc548 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -311,6 +311,9 @@ <field name="arch" type="xml"> <form string="Stock Location"> <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 string="Current Stock" class="oe_stat_button" icon="fa-building-o" name="%(location_open_quants)d" type="action" @@ -333,7 +336,6 @@ <field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/> <field name="scrap_location"/> <field name="return_location"/> - <field name="active"/> </group> <group string="Localization" name="localization"> <field name="posx"/> @@ -361,6 +363,8 @@ <filter name="customer" string="Customer" domain="[('usage', '=', 'customer')]" help="Customer Locations"/> <filter name="supplier" string="Vendor" domain="[('usage', '=', 'supplier')]" help="Vendor Locations"/> <field name="location_id" string="Parent Location"/> + <separator/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> </search> </field> </record> @@ -372,6 +376,7 @@ <field name="priority" eval="2"/> <field name="arch" type="xml"> <tree string="Stock Location" decoration-info="usage=='view'" decoration-danger="usage=='internal'"> + <field name="active" invisible="1"/> <field name="complete_name"/> <field name="usage"/> <field name="company_id" groups="base.group_multi_company"/> @@ -421,6 +426,8 @@ <field name="arch" type="xml"> <search string="Search Stock Location Paths"> <filter string="Global" name="route_false" domain="[('route_id','=',False)]" help="If the route is global"/> + <separator/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> </search> </field> </record> @@ -433,6 +440,7 @@ <field name="location_from_id" /> <field name="location_dest_id" /> <field name="name" /> + <field name="active" invisible="1"/> </tree> </field> </record> @@ -442,15 +450,17 @@ <field name="model">stock.location.path</field> <field name="arch" type="xml"> <form string="Location Paths"> + <div class="oe_button_box" name="button_box"> + <button name="toggle_active" type="object" class="oe_stat_button" icon="fa-archive" groups="stock.group_adv_location"> + <field name="active" widget="boolean_button" options='{"terminology": "archive"}'/> + </button> + </div> <div class="oe_title"> <label for="name" class="oe_edit_only"/> <h1><field name="name"/></h1> </div> <group> <group> - <field name="active"/> - </group> - <group> <field name="sequence"/> </group> </group> @@ -529,6 +539,9 @@ <form string="Warehouse"> <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="view_all_routes_for_wh" string="Routes" icon="fa-refresh" @@ -583,11 +596,21 @@ <field name="arch" type="xml"> <tree string="Warehouse"> <field name="name"/> + <field name="active" invisible="1"/> <field name="lot_stock_id" groups="stock.group_stock_multi_locations"/> <field name="partner_id"/> </tree> </field> </record> + <record id="stock_warehouse_view_search" model="ir.ui.view"> + <field name="name">stock.warehouse.search</field> + <field name="model">stock.warehouse</field> + <field name="arch" type="xml"> + <search string="Warehouse"> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> + </search> + </field> + </record> <record id="action_warehouse_form" model="ir.actions.act_window"> <field name="name">Warehouses</field> <field name="res_model">stock.warehouse</field> @@ -1568,6 +1591,7 @@ <field name="model">stock.incoterms</field> <field name="arch" type="xml"> <tree string="Incoterms"> + <field name="active" invisible="1"/> <field name="code"/> <field colspan="4" name="name"/> </tree> @@ -1579,15 +1603,28 @@ <field name="arch" type="xml"> <form string="Incoterms"> <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> + </div> <group> <field name="name"/> <field name="code"/> - <field name="active"/> </group> </sheet> </form> </field> </record> + <record id="stock_incoterms_view_search" model="ir.ui.view"> + <field name="name">stock.incoterms.search</field> + <field name="model">stock.incoterms</field> + <field name="arch" type="xml"> + <search string="Incoterms"> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> + </search> + </field> + </record> <record id="action_incoterms_tree" model="ir.actions.act_window"> <field name="name">Incoterms</field> <field name="res_model">stock.incoterms</field> @@ -1606,6 +1643,7 @@ <field name="name"/> <field name="sequence_id"/> <field name="warehouse_id"/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> </search> </field> </record> @@ -1616,6 +1654,7 @@ <tree string="Operation Types"> <field name="sequence" widget="handle"/> <field name="name"/> + <field name="active" invisible="1"/> <field name="warehouse_id"/> <field name="sequence_id"/> </tree> @@ -1627,6 +1666,11 @@ <field name="arch" type="xml"> <form string="Operation Types"> <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> + </div> <group> <group> <field name="name"/> @@ -1727,6 +1771,7 @@ <field name="arch" type="xml"> <tree string="Reordering Rules"> <field name="name"/> + <field name="active" invisible="1"/> <field name="warehouse_id" groups="stock.group_stock_multi_locations"/> <field name="location_id" groups="stock.group_stock_multi_locations"/> <field name="product_id"/> @@ -1747,6 +1792,7 @@ <field name="location_id" groups="stock.group_stock_multi_locations"/> <field name="company_id" groups="base.group_multi_company"/> <field name="product_id"/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> <group expand="0" string="Group By"> <filter string="Warehouse" domain="[]" context="{'group_by':'warehouse_id'}"/> <filter string="Location" domain="[]" context="{'group_by':'location_id'}"/> @@ -1762,6 +1808,9 @@ <form string="Reordering Rules"> <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="%(stock.do_view_procurement_op)d" type="action" string="Procurements" class="oe_stat_button" icon="fa-refresh"/> </div> <group> @@ -1784,7 +1833,6 @@ <field name="qty_multiple" string="Quantity Multiple"/> </group> <group string="Misc"> - <field name="active" /> <label for="lead_days"/> <div class="o_row"> <field name="lead_days"/> @@ -2178,6 +2226,7 @@ <tree string="Routes"> <field name="sequence" widget="handle" /> <field name="name"/> + <field name="active" invisible="1"/> </tree> </field> </record> @@ -2189,6 +2238,11 @@ <field name="arch" type="xml"> <form string="Route"> <sheet> + <div class="oe_button_box" name="button_box"> + <button name="toggle_active" type="object" class="oe_stat_button" icon="fa-archive" groups="stock.group_adv_location"> + <field name="active" widget="boolean_button" options='{"terminology": "archive"}'/> + </button> + </div> <div class="oe_title"> <label for="name" class="oe_edit_only"/> <h1><field name="name"/></h1> @@ -2196,7 +2250,6 @@ <group> <group> <field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/> - <field name="active" groups="stock.group_adv_location" /> </group> <group> <field name="sequence" string="Sequence" groups="base.group_no_one"/> @@ -2232,6 +2285,16 @@ </field> </record> + <record id="stock_location_route_view_search" model="ir.ui.view"> + <field name="name">stock.location.route.search</field> + <field name="model">stock.location.route</field> + <field name="arch" type="xml"> + <search string="Route"> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> + </search> + </field> + </record> + <record id="action_routes_form" model="ir.actions.act_window"> <field name="name">Routes</field> <field name="res_model">stock.location.route</field> diff --git a/addons/survey/survey.py b/addons/survey/survey.py index c9af62b2a9e..015957ca175 100644 --- a/addons/survey/survey.py +++ b/addons/survey/survey.py @@ -185,6 +185,7 @@ class survey_survey(osv.Model): help="This message will be displayed when survey is completed"), 'quizz_mode': fields.boolean(string='Quiz mode'), 'active': fields.boolean(string="Active"), + 'is_closed': fields.related('stage_id', 'closed', type='boolean'), } def _default_stage(self, cr, uid, context=None): diff --git a/addons/survey/views/survey_views.xml b/addons/survey/views/survey_views.xml index 9c05a385f8a..7aaa3706766 100644 --- a/addons/survey/views/survey_views.xml +++ b/addons/survey/views/survey_views.xml @@ -114,6 +114,7 @@ <form string="Survey"> <field name="id" invisible="1"/> <field name="tot_start_survey" invisible="1"/> + <field name="is_closed" invisible="1"/> <header groups="base.group_survey_manager"> <button name="action_test_survey" string="Design Survey" type="object" class="oe_highlight"/> <button name="action_test_survey" string="Test Survey" type="object" attrs="{'invisible': [('id', '=', False)]}"/> @@ -124,7 +125,7 @@ <field name="stage_id" widget="statusbar" clickable="True" /> </header> <sheet> - <div class="oe_button_box" name="button_box"> + <div class="oe_button_box" name="button_box" attrs="{'invisible': [('is_closed', '=', False)]}"> <button name="toggle_active" type="object" class="oe_stat_button" icon="fa-archive"> <field name="active" widget="boolean_button" options='{"terminology": "archive"}'/> </button> @@ -164,6 +165,7 @@ <field name="model">survey.survey</field> <field name="arch" type="xml"> <tree string="Survey"> + <field name="active" invisible="1"/> <field name="title" /> <field name="stage_id" /> <field name="tot_sent_survey" string="Invitations sent" /> @@ -224,6 +226,15 @@ </kanban> </field> </record> + <record id="survey_survey_view_search" model="ir.ui.view"> + <field name="name">survey.survey.search</field> + <field name="model">survey.survey</field> + <field name="arch" type="xml"> + <search string="Survey"> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> + </search> + </field> + </record> <record model="ir.actions.act_window" id="action_survey_form"> <field name="name">Surveys</field> diff --git a/addons/website_blog/models/website_blog.py b/addons/website_blog/models/website_blog.py index e3d9368d96a..24194f2eefc 100644 --- a/addons/website_blog/models/website_blog.py +++ b/addons/website_blog/models/website_blog.py @@ -20,8 +20,23 @@ class Blog(osv.Model): _columns = { 'name': fields.char('Blog Name', required=True, translate=True), 'subtitle': fields.char('Blog Subtitle', translate=True), + 'active': fields.boolean('Active'), } + _defaults = { + 'active': True, + } + + def write(self, cr, uid, ids, vals, context=None): + res = super(Blog, self).write(cr, uid, ids, vals, context=context) + if 'active' in vals: + # archiving/unarchiving a blog does it on its posts, too + BlogPost = self.pool['blog.post'] + ctx = dict(context or {}, active_test=False) + post_ids = BlogPost.search(cr, uid, [('blog_id', 'in', ids)], context=ctx) + BlogPost.write(cr, uid, post_ids, {'active': vals['active']}, context=context) + return res + def all_tags(self, cr, uid, ids, min_limit=1, context=None): req = """ SELECT @@ -96,6 +111,7 @@ class BlogPost(osv.Model): 'name': fields.char('Title', required=True, translate=True), 'subtitle': fields.char('Sub Title', translate=True), 'author_id': fields.many2one('res.partner', 'Author'), + 'active': fields.boolean('Active'), 'cover_properties': fields.text('Cover Properties'), 'blog_id': fields.many2one( 'blog.blog', 'Blog', @@ -139,6 +155,7 @@ class BlogPost(osv.Model): _defaults = { 'name': '', + 'active': True, 'content': _default_content, 'cover_properties': '{"background-image": "none", "background-color": "oe_none", "opacity": "0.6", "resize_class": ""}', 'author_id': lambda self, cr, uid, ctx=None: self.pool['res.users'].browse(cr, uid, uid, context=ctx).partner_id.id, diff --git a/addons/website_blog/views/website_blog_views.xml b/addons/website_blog/views/website_blog_views.xml index 3c8dd896e1a..a59b21b71e0 100644 --- a/addons/website_blog/views/website_blog_views.xml +++ b/addons/website_blog/views/website_blog_views.xml @@ -10,6 +10,7 @@ <field name="arch" type="xml"> <tree string="Blogs"> <field name="name"/> + <field name="active" invisible="1"/> </tree> </field> </record> @@ -19,6 +20,11 @@ <field name="arch" type="xml"> <form string="Blog"> <sheet> + <div class="oe_button_box" name="button_box"> + <button name="toggle_active" type="object" confirm="(Un)archiving a blog automatically (un)archives its posts. Do you want to proceed?" class="oe_stat_button" icon="fa-archive"> + <field name="active" widget="boolean_button" options='{"terminology": "archive"}'/> + </button> + </div> <group> <field name="name"/> </group> @@ -38,6 +44,7 @@ <field name="arch" type="xml"> <tree string="Blog Posts"> <field name="name"/> + <field name="active" invisible="1"/> <field name="blog_id"/> <field name="create_uid" invisible="1"/> <field name="write_uid"/> @@ -53,6 +60,9 @@ <form string="Blog Post"> <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 class="oe_stat_button" name="website_publish_button" type="object" icon="fa-globe"> <field name="website_published" widget="website_button"/> @@ -88,6 +98,7 @@ <field name="model">blog.post</field> <field name="arch" type="xml"> <search string="Blog Post"> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> <field name="name" string="Content" filter_domain="['|', ('name','ilike',self), ('content','ilike',self)]"/> <field name="write_uid"/> <field name="blog_id"/> @@ -115,6 +126,16 @@ </record> <menuitem id="menu_page" parent="menu_website_blog_root" name="Blog Posts" action="action_blog_post" sequence="10"/> + <record id="blog_blog_view_search" model="ir.ui.view"> + <field name="name">blog.blog.search</field> + <field name="model">blog.blog</field> + <field name="arch" type="xml"> + <search string="Blog"> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> + </search> + </field> + </record> + <record model="ir.actions.act_window" id="action_blog_blog"> <field name="name">Blogs</field> <field name="res_model">blog.blog</field> diff --git a/addons/website_event_track/models/event.py b/addons/website_event_track/models/event.py index 4cd518c5832..74aab70c98b 100644 --- a/addons/website_event_track/models/event.py +++ b/addons/website_event_track/models/event.py @@ -33,6 +33,7 @@ class event_track(models.Model): _inherit = ['mail.thread', 'ir.needaction_mixin', 'website.seo.metadata', 'website.published.mixin'] name = fields.Char('Title', required=True, translate=True) + active = fields.Boolean(default=True) user_id = fields.Many2one('res.users', 'Responsible', track_visibility='onchange', default=lambda self: self.env.user) partner_id = fields.Many2one('res.partner', 'Proposed by') partner_name = fields.Char('Partner Name') diff --git a/addons/website_event_track/views/event_backend.xml b/addons/website_event_track/views/event_backend.xml index bb36b51e0e9..1739e6cef5d 100644 --- a/addons/website_event_track/views/event_backend.xml +++ b/addons/website_event_track/views/event_backend.xml @@ -75,6 +75,8 @@ <field name="state"/> <field name="speaker_ids"/> <filter string="Unread Messages" name="message_needaction" domain="[('message_needaction','=',True)]"/> + <separator/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> <group expand="0" string="Group By"> <filter string="Responsible" context="{'group_by': 'user_id'}"/> <filter string="Status" context="{'group_by':'state'}"/> @@ -95,6 +97,9 @@ </header> <sheet string="Track"> <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> <field name="website_url" invisible="1"/> <button class="oe_stat_button" name="website_publish_button" type="object" icon="fa-globe"> @@ -145,6 +150,7 @@ <field name="arch" type="xml"> <tree string="Event Track"> <field name="name"/> + <field name="active" invisible="1"/> <field name="event_id"/> </tree> </field> diff --git a/addons/website_forum/models/forum.py b/addons/website_forum/models/forum.py index ef6e66b50dd..4189921f0d6 100644 --- a/addons/website_forum/models/forum.py +++ b/addons/website_forum/models/forum.py @@ -47,6 +47,7 @@ class Forum(models.Model): # description and use name = fields.Char('Forum Name', required=True, translate=True) + active = fields.Boolean(default=True) faq = fields.Html('Guidelines', default=_get_default_faq, translate=True) description = fields.Text( 'Description', @@ -154,6 +155,14 @@ class Forum(models.Model): def create(self, values): return super(Forum, self.with_context(mail_create_nolog=True, mail_create_nosubscribe=True)).create(values) + @api.multi + def write(self, vals): + res = super(Forum, self).write(vals) + if 'active' in vals: + # archiving/unarchiving a forum does it on its posts, too + self.env['forum.post'].with_context(active_test=False).search([('forum_id', 'in', self.ids)]).write({'active': vals['active']}) + return res + @api.model def _tag_to_write_vals(self, tags=''): Tag = self.env['forum.tag'] @@ -500,6 +509,10 @@ class Post(models.Model): body, subtype = _('Question Edited'), 'website_forum.mt_question_edit' obj_id = post obj_id.message_post(body=body, subtype=subtype) + if 'active' in vals: + answers = self.env['forum.post'].with_context(active_test=False).search([('parent_id', 'in', self.ids)]) + if answers: + answers.write({'active': vals['active']}) return res @api.multi diff --git a/addons/website_forum/views/forum.xml b/addons/website_forum/views/forum.xml index c04a229d7d5..fb5941a22d8 100644 --- a/addons/website_forum/views/forum.xml +++ b/addons/website_forum/views/forum.xml @@ -13,6 +13,7 @@ <field name="arch" type="xml"> <tree string="Forums"> <field name="name"/> + <field name="active" invisible="1"/> <field name="allow_question"/> <field name="allow_link"/> <field name="allow_discussion"/> @@ -26,6 +27,11 @@ <field name="arch" type="xml"> <form string="Forum"> <sheet> + <div class="oe_button_box" name="button_box"> + <button name="toggle_active" type="object" confirm="(Un)archiving a forum automatically (un)archives its posts. Do you want to proceed?" class="oe_stat_button" icon="fa-archive"> + <field name="active" widget="boolean_button" options='{"terminology": "archive"}'/> + </button> + </div> <label for="name" class="oe_edit_only"/> <h1> <field name="name"/> @@ -101,6 +107,16 @@ </field> </record> + <record id="forum_view_search" model="ir.ui.view"> + <field name="name">forum.forum.search</field> + <field name="model">forum.forum</field> + <field name="arch" type="xml"> + <search string="Forum"> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> + </search> + </field> + </record> + <record id="action_forum_forum" model="ir.actions.act_window"> <field name="name">Forums</field> <field name="res_model">forum.forum</field> @@ -117,6 +133,7 @@ <field name="arch" type="xml"> <tree string="Forum Posts"> <field name="name"/> + <field name="active" invisible="1"/> <field name="forum_id"/> </tree> </field> @@ -128,6 +145,11 @@ <field name="arch" type="xml"> <form string="Forum Post"> <sheet> + <div class="oe_button_box" name="button_box"> + <button name="toggle_active" type="object" confirm="(Un)archiving a post automatically (un)archives its answers. Do you want to proceed?" class="oe_stat_button" icon="fa-archive"> + <field name="active" widget="boolean_button" options='{"terminology": "archive"}'/> + </button> + </div> <label for="name" class="oe_edit_only"/> <h1> <field name="name" placeholder="Name"/> @@ -188,6 +210,8 @@ <filter string="Answers" domain="[('parent_id', '!=', False)]" /> <filter string="Accepted Answer" domain="[('is_correct' , '!=', False), ('parent_id', '!=', False)]" /> <filter string="Answered Questions" domain="[('child_count', '!=', 0), ('parent_id', '=', False)]" /> + <separator/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> <group expand="0" string="Group By"> <filter string="Forum" domain="[]" context="{'group_by': 'forum_id'}"/> <filter string="Author" domain="[]" context="{'group_by': 'create_uid'}"/> diff --git a/addons/website_slides/models/slides.py b/addons/website_slides/models/slides.py index 34e31c58cf7..18081d33a81 100644 --- a/addons/website_slides/models/slides.py +++ b/addons/website_slides/models/slides.py @@ -30,6 +30,7 @@ class Channel(models.Model): } name = fields.Char('Name', translate=True, required=True) + active = fields.Boolean(default=True) description = fields.Html('Description', translate=True) sequence = fields.Integer(default=10, help='Display order') category_ids = fields.One2many('slide.category', 'channel_id', string="Categories") @@ -151,6 +152,14 @@ class Channel(models.Model): if self.visibility == 'public': self.group_ids = False + @api.multi + def write(self, vals): + res = super(Channel, self).write(vals) + if 'active' in vals: + # archiving/unarchiving a channel does it on its slides, too + self.with_context(active_test=False).mapped('slide_ids').write({'active': vals['active']}) + return res + class Category(models.Model): """ Channel contain various categories to manage its slides """ @@ -247,6 +256,7 @@ class Slide(models.Model): # description name = fields.Char('Title', required=True, translate=True) + active = fields.Boolean(default=True) description = fields.Text('Description', translate=True) channel_id = fields.Many2one('slide.channel', string="Channel", required=True) category_id = fields.Many2one('slide.category', string="Category", domain="[('channel_id', '=', channel_id)]") diff --git a/addons/website_slides/view/website_slides_backend.xml b/addons/website_slides/view/website_slides_backend.xml index 4be8102e84b..cbc64eae105 100644 --- a/addons/website_slides/view/website_slides_backend.xml +++ b/addons/website_slides/view/website_slides_backend.xml @@ -41,6 +41,9 @@ <form string="Slide"> <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 class="oe_stat_button" name="website_publish_button" type="object" icon="fa-globe"> <field name="website_published" widget="website_button"/> @@ -107,6 +110,7 @@ <field name="arch" type="xml"> <tree string="Slides"> <field name="name"/> + <field name="active" invisible="1"/> <field name="slide_type"/> <field name="channel_id"/> <field name="category_id"/> @@ -123,6 +127,8 @@ <field name="name"/> <filter name="published" string="Published" domain="[('website_published', '=', True)]"/> <filter name="not_published" string="Waiting for validation" domain="[('website_published', '=', False)]"/> + <separator/> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> <group expand="0" string="Group By"> <filter string="Channel" domain="[]" context="{'group_by': 'channel_id'}"/> <filter string="Category" domain="[]" context="{'group_by': 'category_id'}"/> @@ -195,6 +201,9 @@ <form string="Channels"> <sheet> <div class="oe_button_box" name="button_box"> + <button name="toggle_active" type="object" confirm="(Un)archiving a channel automatically (un)archives its slides. Do you want to proceed?" class="oe_stat_button" icon="fa-archive"> + <field name="active" widget="boolean_button" options='{"terminology": "archive"}'/> + </button> <button class="oe_stat_button" name="website_publish_button" type="object" icon="fa-globe"> <field name="website_published" widget="website_button"/> @@ -254,12 +263,23 @@ <tree string="Channel"> <field name="sequence" widget="handle"/> <field name="name"/> + <field name="active" invisible="1"/> <field name="visibility"/> <field name="promote_strategy"/> </tree> </field> </record> + <record id="slide_channel_view_search" model="ir.ui.view"> + <field name="name">slide.channel.search</field> + <field name="model">slide.channel</field> + <field name="arch" type="xml"> + <search string="Channel"> + <filter string="Archived" name="inactive" domain="[('active','=',False)]"/> + </search> + </field> + </record> + <record id="action_slide_channels" model="ir.actions.act_window"> <field name="name">Channels</field> <field name="res_model">slide.channel</field> |
