[IMP] hr_work_entry : make general UX improvements
This commit aims to improve usability of work entries by improving the form and adding a default start and end hour going from 9 to 17 task - 3062158 closes odoo/odoo#118252 X-original-commit: 36eca7e6b0ad6b3570ce2478b10ec4da1a157617 Related: odoo/enterprise#39592 Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
@@ -221,8 +221,7 @@ msgstr ""
|
||||
|
||||
#. module: hr_work_entry
|
||||
#: model:ir.model.fields,field_description:hr_work_entry.field_hr_work_entry__duration
|
||||
#: model_terms:ir.ui.view,arch_db:hr_work_entry.hr_work_entry_view_form
|
||||
msgid "Period"
|
||||
msgid "Duration"
|
||||
msgstr ""
|
||||
|
||||
#. module: hr_work_entry
|
||||
|
||||
@@ -21,8 +21,8 @@ class HrWorkEntry(models.Model):
|
||||
employee_id = fields.Many2one('hr.employee', required=True, domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", index=True)
|
||||
date_start = fields.Datetime(required=True, string='From')
|
||||
date_stop = fields.Datetime(compute='_compute_date_stop', store=True, readonly=False, string='To')
|
||||
duration = fields.Float(compute='_compute_duration', store=True, string="Period", readonly=False)
|
||||
work_entry_type_id = fields.Many2one('hr.work.entry.type', index=True)
|
||||
duration = fields.Float(compute='_compute_duration', store=True, string="Duration", readonly=False)
|
||||
work_entry_type_id = fields.Many2one('hr.work.entry.type', index=True, default=lambda self: self.env['hr.work.entry.type'].search([], limit=1))
|
||||
color = fields.Integer(related='work_entry_type_id.color', readonly=True)
|
||||
state = fields.Selection([
|
||||
('draft', 'Draft'),
|
||||
|
||||
@@ -46,27 +46,23 @@
|
||||
Note: Validated work entries cannot be modified.
|
||||
</div>
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
<field name="name" placeholder="Work Entry Name" attrs="{'readonly': [('state', '=', 'validated')]}"/>
|
||||
</h1>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="name" string="Description" placeholder="Work Entry Name" attrs="{'readonly': [('state', '=', 'validated')]}"/>
|
||||
<field name="employee_id" attrs="{'readonly': [('state', '!=', 'draft')]}" />
|
||||
<field name="work_entry_type_id" attrs="{'readonly': [('state', '=', 'validated')]}" options="{'no_create': True, 'no_open': True}"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="date_start" attrs="{'readonly': [('state', '!=', 'draft')]}" />
|
||||
<field name="date_stop" attrs="{'readonly': [('state', '!=', 'draft')]}" required="1"/>
|
||||
<label for="duration" string="Period"/>
|
||||
<label for="duration"/>
|
||||
<div class="o_row mw-50 mw-sm-25">
|
||||
<field name="duration"
|
||||
nolabel="1"
|
||||
widget="float_time"
|
||||
class="o_hr_narrow_field"
|
||||
attrs="{'readonly': [('state', '!=', 'draft')]}" />
|
||||
<span class="ml8">Hours</span>
|
||||
<span>Hours</span>
|
||||
</div>
|
||||
<field name="company_id" invisible="1"/>
|
||||
</group>
|
||||
|
||||
@@ -59,8 +59,15 @@ msgstr ""
|
||||
#. module: hr_work_entry_contract
|
||||
#: model_terms:ir.ui.view,arch_db:hr_work_entry_contract.hr_work_entry_regeneration_wizard
|
||||
msgid ""
|
||||
"<span class=\"text-muted\">Warning: Work Entry Regeneration will erase all "
|
||||
"manual configuration (work entry type, deferred time off, ...).</span>"
|
||||
"<span class=\"text-muted\">Warning: The work entry regeneration will delete "
|
||||
"all manual changes on the selected period.</span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: hr_work_entry_contract
|
||||
#: model_terms:ir.ui.view,arch_db:hr_work_entry_contract.hr_work_entry_regeneration_wizard
|
||||
msgid ""
|
||||
"<span class=\"text-muted\">Attention: Regenerating these work entries will result in all the manual\n"
|
||||
" configurations (work entry type, homeworking location, ...) to be lost.</span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: hr_work_entry_contract
|
||||
|
||||
@@ -96,6 +96,7 @@ class TestWorkEntry(TestWorkEntryBase):
|
||||
'date_start': self.start,
|
||||
'date_stop': self.end,
|
||||
})
|
||||
work_entry1.work_entry_type_id = False
|
||||
self.assertFalse(work_entry1.action_validate(), "It should not validate work_entries without a type")
|
||||
self.assertEqual(work_entry1.state, 'conflict', "It should change to conflict state")
|
||||
work_entry1.work_entry_type_id = self.work_entry_type
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</group>
|
||||
</group>
|
||||
<div>
|
||||
<span class="text-muted">Warning: Work Entry Regeneration will erase all manual configuration (work entry type, deferred time off, ...).</span>
|
||||
<span class="text-muted">Warning: The work entry regeneration will delete all manual changes on the selected period.</span>
|
||||
</div>
|
||||
<field name="search_criteria_completed" invisible="1"/>
|
||||
<field name="valid" invisible="1"/>
|
||||
@@ -55,9 +55,10 @@
|
||||
attrs="{'invisible': ['|', ('search_criteria_completed', '=', False), ('valid', '=', False)]}"/>
|
||||
<button name="regenerate_work_entries_disabled"
|
||||
string="Regenerate Work Entries"
|
||||
class="btn btn-primary disabled"
|
||||
class="btn btn-primary"
|
||||
disabled="1"
|
||||
attrs="{'invisible': [('search_criteria_completed', '=', True), ('valid', '=', True)]}"/>
|
||||
<button string="Discard" class="btn-secondary" special="cancel" data-hotkey="z"/>
|
||||
<button name="cancel_button" string="Cancel" class="btn-secondary" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user