diff options
| author | RomainLibert <rli@odoo.com> | 2019-07-16 07:55:57 +0000 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2019-07-16 12:03:42 +0000 |
| commit | 02c48e71f06ba335dcbde020d7fe28663e1afd00 (patch) | |
| tree | 68e5221b1e6f39755ed5cf23121221c012a96dba /addons | |
| parent | 22221a2b573a4daad9457bb2329a84bcef15d5df (diff) | |
[IMP] hr_timesheet: Improve general module UX (back2basics)
TaskID: 2025197
closes odoo/odoo#34855
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/hr_timesheet/models/hr_timesheet.py | 7 | ||||
| -rw-r--r-- | addons/hr_timesheet/report/hr_timesheet_report_view.xml | 31 | ||||
| -rw-r--r-- | addons/hr_timesheet/views/hr_timesheet_views.xml | 16 | ||||
| -rw-r--r-- | addons/project/views/project_views.xml | 15 | ||||
| -rw-r--r-- | addons/sale_timesheet/views/hr_timesheet_views.xml | 2 | ||||
| -rw-r--r-- | addons/uom/data/uom_data.xml | 1 |
6 files changed, 62 insertions, 10 deletions
diff --git a/addons/hr_timesheet/models/hr_timesheet.py b/addons/hr_timesheet/models/hr_timesheet.py index 200b4a0a84e..1fcfc4a70d0 100644 --- a/addons/hr_timesheet/models/hr_timesheet.py +++ b/addons/hr_timesheet/models/hr_timesheet.py @@ -14,6 +14,8 @@ class AccountAnalyticLine(models.Model): @api.model def default_get(self, field_list): result = super(AccountAnalyticLine, self).default_get(field_list) + if 'encoding_uom_id' in field_list: + result['encoding_uom_id'] = self.env.company.timesheet_encode_uom_id.id if not self.env.context.get('default_employee_id') and 'employee_id' in field_list and result.get('user_id'): result['employee_id'] = self.env['hr.employee'].search([('user_id', '=', result['user_id'])], limit=1).id return result @@ -23,6 +25,11 @@ class AccountAnalyticLine(models.Model): employee_id = fields.Many2one('hr.employee', "Employee") department_id = fields.Many2one('hr.department', "Department", compute='_compute_department_id', store=True, compute_sudo=True) + encoding_uom_id = fields.Many2one('uom.uom', compute='_compute_encoding_uom_id') + + def _compute_encoding_uom_id(self): + for analytic_line in self: + analytic_line.encoding_uom_id = self.env.company.timesheet_encode_uom_id @api.onchange('project_id') def onchange_project_id(self): diff --git a/addons/hr_timesheet/report/hr_timesheet_report_view.xml b/addons/hr_timesheet/report/hr_timesheet_report_view.xml index 49c25a8e63f..668ffd7c62c 100644 --- a/addons/hr_timesheet/report/hr_timesheet_report_view.xml +++ b/addons/hr_timesheet/report/hr_timesheet_report_view.xml @@ -2,7 +2,7 @@ <odoo> <data> <record id="act_hr_timesheet_report" model="ir.actions.act_window"> - <field name="name">By Employee</field> + <field name="name">Timesheets By Employee</field> <field name="res_model">account.analytic.line</field> <field name="domain">[('project_id', '!=', False)]</field> <field name="context">{'search_default_groupby_employee':1,}</field> @@ -25,6 +25,13 @@ <field name="act_window_id" ref="act_hr_timesheet_report"/> </record> + <record id="timesheet_action_view_report_by_employee_graph" model="ir.actions.act_window.view"> + <field name="sequence" eval="6"/> + <field name="view_mode">graph</field> + <field name="view_id" ref="hr_timesheet.view_hr_timesheet_line_graph"/> + <field name="act_window_id" ref="act_hr_timesheet_report"/> + </record> + <record model="ir.actions.act_window.view" id="act_hr_timesheet_report_tree"> <field name="sequence" eval="10"/> <field name="view_mode">tree</field> @@ -40,7 +47,7 @@ </record> <record id="timesheet_action_report_by_project" model="ir.actions.act_window"> - <field name="name">By Project</field> + <field name="name">Timesheets By Project</field> <field name="res_model">account.analytic.line</field> <field name="domain">[('project_id', '!=', False)]</field> <field name="context">{'search_default_groupby_project':1,}</field> @@ -63,6 +70,13 @@ <field name="act_window_id" ref="timesheet_action_report_by_project"/> </record> + <record id="timesheet_action_view_report_by_project_graph" model="ir.actions.act_window.view"> + <field name="sequence" eval="6"/> + <field name="view_mode">graph</field> + <field name="view_id" ref="hr_timesheet.view_hr_timesheet_line_graph"/> + <field name="act_window_id" ref="timesheet_action_report_by_project"/> + </record> + <record id="timesheet_action_view_report_by_project_tree" model="ir.actions.act_window.view"> <field name="sequence" eval="10"/> <field name="view_mode">tree</field> @@ -78,10 +92,10 @@ </record> <record id="timesheet_action_report_by_task" model="ir.actions.act_window"> - <field name="name">By Task</field> + <field name="name">Timesheets By Task</field> <field name="res_model">account.analytic.line</field> <field name="domain">[('project_id', '!=', False)]</field> - <field name="context">{'search_default_groupby_task':1,}</field> + <field name="context">{'search_default_groupby_project':1,'search_default_groupby_task':1,}</field> <field name="search_view_id" ref="hr_timesheet_line_search"/> <field name="help" type="html"> <p class="o_view_nocontent_smiling_face"> @@ -101,6 +115,13 @@ <field name="act_window_id" ref="timesheet_action_report_by_task"/> </record> + <record id="timesheet_action_view_report_by_task_graph" model="ir.actions.act_window.view"> + <field name="sequence" eval="6"/> + <field name="view_mode">graph</field> + <field name="view_id" ref="hr_timesheet.view_hr_timesheet_line_graph"/> + <field name="act_window_id" ref="timesheet_action_report_by_task"/> + </record> + <record id="timesheet_action_view_report_by_task_tree" model="ir.actions.act_window.view"> <field name="sequence" eval="10"/> <field name="view_mode">tree</field> @@ -122,7 +143,7 @@ sequence="99"/> <menuitem id="menu_timesheets_reports_timesheet" - name="Timesheet" + name="Timesheets" parent="menu_timesheets_reports" groups="hr_timesheet.group_timesheet_manager" sequence="10"/> diff --git a/addons/hr_timesheet/views/hr_timesheet_views.xml b/addons/hr_timesheet/views/hr_timesheet_views.xml index 700feb230fe..9aef1401601 100644 --- a/addons/hr_timesheet/views/hr_timesheet_views.xml +++ b/addons/hr_timesheet/views/hr_timesheet_views.xml @@ -24,7 +24,7 @@ <tree editable="top" string="Timesheet Activities" import="false"> <field name="date"/> <field name="name"/> - <field name="project_id" required="1"/> + <field name="project_id" required="1" context="{'form_view_ref': 'project.project_project_view_form_simplified',}"/> <field name="task_id" context="{'default_project_id': project_id}" domain="[('project_id', '=', project_id)]"/> <field name="unit_amount" widget="timesheet_uom" sum="Total"/> </tree> @@ -57,6 +57,18 @@ </field> </record> + <record id="view_hr_timesheet_line_graph" model="ir.ui.view"> + <field name="name">account.analytic.line.graph</field> + <field name="model">account.analytic.line</field> + <field name="arch" type="xml"> + <graph string="Timesheet"> + <field name="task_id" type="row"/> + <field name="project_id" type="row"/> + <field name="unit_amount" type="measure" widget="timesheet_uom"/> + </graph> + </field> + </record> + <record id="hr_timesheet_line_form" model="ir.ui.view"> <field name="name">account.analytic.line.form</field> <field name="model">account.analytic.line</field> @@ -68,7 +80,7 @@ <group> <group> <field name="date"/> - <field name="project_id" required="1"/> + <field name="project_id" required="1" context="{'form_view_ref': 'project.project_project_view_form_simplified',}"/> <field name="task_id"/> <field name="name"/> <field name="company_id" groups="base.group_multi_company"/> diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml index 9b2f80529ae..725cffbbb71 100644 --- a/addons/project/views/project_views.xml +++ b/addons/project/views/project_views.xml @@ -265,11 +265,22 @@ </div> </group> </group> + </form> + </field> + </record> + + <record id="project_project_view_form_simplified_footer" model="ir.ui.view"> + <field name="name">project.project.view.form.simplified</field> + <field name="model">project.project</field> + <field name="inherit_id" ref="project.project_project_view_form_simplified"/> + <field name="mode">primary</field> + <field name="arch" type="xml"> + <xpath expr="//group" position="after"> <footer> <button string="Create" name="open_tasks" type="object" class="btn-primary o_open_tasks"/> <button string="Discard" class="btn-secondary" special="cancel"/> </footer> - </form> + </xpath> </field> </record> @@ -277,7 +288,7 @@ <field name="name">Create a Project</field> <field name="res_model">project.project</field> <field name="view_mode">form</field> - <field name="view_id" ref="project_project_view_form_simplified"/> + <field name="view_id" ref="project_project_view_form_simplified_footer"/> <field name="target">new</field> </record> diff --git a/addons/sale_timesheet/views/hr_timesheet_views.xml b/addons/sale_timesheet/views/hr_timesheet_views.xml index 4a1f0d45619..64a5f86b1f5 100644 --- a/addons/sale_timesheet/views/hr_timesheet_views.xml +++ b/addons/sale_timesheet/views/hr_timesheet_views.xml @@ -33,7 +33,7 @@ Reporting --> <record id="timesheet_action_billing_report" model="ir.actions.act_window"> - <field name="name">By Billing Rate</field> + <field name="name">Timesheets By Billing Rate</field> <field name="res_model">account.analytic.line</field> <field name="view_mode">pivot,graph</field> <field name="domain">[('project_id', '!=', False)]</field> diff --git a/addons/uom/data/uom_data.xml b/addons/uom/data/uom_data.xml index 5021eb495ba..badda0920c1 100644 --- a/addons/uom/data/uom_data.xml +++ b/addons/uom/data/uom_data.xml @@ -52,6 +52,7 @@ <field name="factor" eval="1000"/> <field name="uom_type">smaller</field> </record> + <record id="product_uom_day" model="uom.uom"> <field name="name">Days</field> <field eval="uom_categ_wtime" name="category_id"/> |
