diff options
| author | Swapnesh Shah <swapneshshah111@gmail.com> | 2020-05-08 18:19:05 +0000 |
|---|---|---|
| committer | Swapnesh Shah <swapneshshah111@gmail.com> | 2020-05-09 05:24:38 +0000 |
| commit | 2eecd986798a6323d9d6a56a901144edf5446f81 (patch) | |
| tree | f91f4c4e7bf72cb3d2106e3cbfc95a7263353d7a | |
| parent | ce08c58f3156bccb1206149be9eec95f518fce36 (diff) | |
[IMP] resource: add possibility to archive resource calendar
Before this commit, It was not possible to Hide Working Time or Deleting Working Time if Resource is linked to it.
Now we add, Active field to Hide Working timw without removing it.
closes odoo/odoo#50963
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
| -rw-r--r-- | addons/resource/models/resource.py | 2 | ||||
| -rw-r--r-- | addons/resource/views/resource_views.xml | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/addons/resource/models/resource.py b/addons/resource/models/resource.py index 2f8029f3547..4c2f2409dc7 100644 --- a/addons/resource/models/resource.py +++ b/addons/resource/models/resource.py @@ -177,6 +177,8 @@ class ResourceCalendar(models.Model): return res name = fields.Char(required=True) + active = fields.Boolean("Active", default=True, + help="If the active field is set to false, it will allow you to hide the Working Time without removing it.") company_id = fields.Many2one( 'res.company', 'Company', default=lambda self: self.env.company) diff --git a/addons/resource/views/resource_views.xml b/addons/resource/views/resource_views.xml index 2dffc9c16c2..b6712584bfc 100644 --- a/addons/resource/views/resource_views.xml +++ b/addons/resource/views/resource_views.xml @@ -240,6 +240,8 @@ <search string="Search Working Time"> <field name="name" string="Working Time"/> <field name="company_id" groups="base.group_multi_company"/> + <separator/> + <filter string="Archived" name="inactive" domain="[('active', '=', False)]"/> </search> </field> </record> @@ -250,6 +252,7 @@ <field name="arch" type="xml"> <form string="Working Time"> <sheet string="Working Time"> + <widget name="web_ribbon" text="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/> <div class="oe_button_box" name="button_box"> <button name="%(resource_calendar_leaves_action_from_calendar)d" type="action" string="Time Off" icon="fa-plane" @@ -265,6 +268,7 @@ </h1> <group name="resource_details"> <group> + <field name="active" invisible="1"/> <field name="company_id" groups="base.group_multi_company"/> <field name="hours_per_day" widget="float_time"/> <field name="tz"/> |
