-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move sale_timesheet_custom_fields from onesteinbv/ProjectManagement
- Loading branch information
Showing
6 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2024 Onestein (<http://www.onestein.eu>) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Timesheet Custom Fields", | ||
"version": "16.0.1.0.0", | ||
"summary": "Adds custom fields and related filters", | ||
"author": "Onestein", | ||
"license": "AGPL-3", | ||
"website": "https://www.onestein.nl", | ||
"category": "Human Resources", | ||
"depends": [ | ||
"sale_timesheet", | ||
], | ||
"data": [ | ||
"views/hr_timesheet_views.xml", | ||
], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * sale_timesheet_custom_fields | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-03-26 12:39+0000\n" | ||
"PO-Revision-Date: 2024-03-26 12:39+0000\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: sale_timesheet_custom_fields | ||
#: model_terms:ir.ui.view,arch_db:sale_timesheet_custom_fields.hr_timesheet_line_search | ||
msgid "Day" | ||
msgstr "Dag" | ||
|
||
#. module: sale_timesheet_custom_fields | ||
#: model_terms:ir.ui.view,arch_db:sale_timesheet_custom_fields.hr_timesheet_line_search | ||
msgid "Group By" | ||
msgstr "Groepeer op" | ||
|
||
#. module: sale_timesheet_custom_fields | ||
#: model:ir.model.fields,field_description:sale_timesheet_custom_fields.field_account_analytic_line__project_user_id | ||
#: model_terms:ir.ui.view,arch_db:sale_timesheet_custom_fields.hr_timesheet_line_search | ||
msgid "Project Manager" | ||
msgstr "Projectleider" | ||
|
||
#. module: sale_timesheet_custom_fields | ||
#: model_terms:ir.ui.view,arch_db:sale_timesheet_custom_fields.hr_timesheet_line_search | ||
msgid "Week" | ||
msgstr "" | ||
|
||
#. module: sale_timesheet_custom_fields | ||
#: model:ir.model.fields,field_description:sale_timesheet_custom_fields.field_account_analytic_line__week_number | ||
msgid "Week Number" | ||
msgstr "Weeknummer" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import account_analytic_line |
19 changes: 19 additions & 0 deletions
19
sale_timesheet_custom_fields/models/account_analytic_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2024 Onestein (<http://www.onestein.eu>) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class AccountAnalyticLine(models.Model): | ||
_inherit = "account.analytic.line" | ||
|
||
@api.depends("date") | ||
def _compute_week_number(self): | ||
for line in self: | ||
week_number = line.date.isocalendar() | ||
line.week_number = "W%s %s" % (str(week_number[1]), (str(week_number[0]))) | ||
|
||
project_user_id = fields.Many2one( | ||
"res.users", related="project_id.user_id", store=True | ||
) | ||
week_number = fields.Char(compute="_compute_week_number", store=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="hr_timesheet_line_tree" model="ir.ui.view"> | ||
<field name="name">account.analytic.line.tree</field> | ||
<field name="model">account.analytic.line</field> | ||
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_tree" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='unit_amount']" position="after"> | ||
<field name="week_number" optional="show" /> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
<record id="hr_timesheet_line_search" model="ir.ui.view"> | ||
<field name="model">account.analytic.line</field> | ||
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_search"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="/search" position="inside"> | ||
<group string="Group By" name="groupby"> | ||
<filter name="groupby_project_manager" string="Project Manager" context="{'group_by': 'project_user_id'}"/> | ||
<filter name="groupby_week_number" string="Week" context="{'group_by': 'week_number'}"/> | ||
<filter name="groupby_day" string="Day" context="{'group_by': 'date:day'}"/> | ||
</group> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</odoo> |