Skip to content

Commit

Permalink
Merge PR #597 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by alexey-pelykh
  • Loading branch information
OCA-git-bot committed Mar 18, 2024
2 parents 082efb5 + 5fbec0c commit d602ed5
Show file tree
Hide file tree
Showing 23 changed files with 1,710 additions and 26 deletions.
7 changes: 7 additions & 0 deletions hr_timesheet_purchase_order/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (C) 2024 Cetmix OÜ
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "HR Timesheet Purchase Order",
"version": "14.0.1.0.0",
Expand All @@ -10,11 +13,15 @@
"hr_timesheet_sheet",
"purchase",
],
"maintainers": ["dessanhemrayev", "aleuffre", "renda-dev"],
"external_dependencies": {},
"demo": [],
"data": [
"security/ir.model.access.csv",
"data/ir_actions_server.xml",
"data/hr_timesheet_cron.xml",
"views/hr_employee_view.xml",
"views/res_partner_view.xml",
"views/hr_timesheet_sheet_view.xml",
"views/purchase_order_view.xml",
"views/res_config_settings_view.xml",
Expand Down
11 changes: 11 additions & 0 deletions hr_timesheet_purchase_order/data/hr_timesheet_cron.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="ir_cron_auto_generate_po" model="ir.cron">
<field name="name">HR Timesheet : Auto generate Purchase Order</field>
<field name="model_id" ref="model_hr_timesheet_recurrence" />
<field name="state">code</field>
<field name="code">model._cron_generate_auto_po()</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
</odoo>
4 changes: 4 additions & 0 deletions hr_timesheet_purchase_order/data/ir_actions_server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<field name="name">Create Purchase Order</field>
<field name="model_id" ref="model_hr_timesheet_sheet" />
<field name="binding_model_id" ref="model_hr_timesheet_sheet" />
<field
name="groups_id"
eval="[(6, 0, [ref('hr_timesheet.group_timesheet_manager')])]"
/>
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">
Expand Down
2 changes: 2 additions & 0 deletions hr_timesheet_purchase_order/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from . import res_partner
from . import hr_timesheet_recurrence
from . import hr_employee_base
from . import hr_timesheet_sheet
from . import res_config_settings
Expand Down
50 changes: 50 additions & 0 deletions hr_timesheet_purchase_order/models/consts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import calendar
import datetime

from dateutil.rrule import FR, MO, SA, SU, TH, TU, WE

MONTH_SELECTION = [(month.lower(), month) for month in calendar.month_name[1:]]
WEEKDAY_SELECTION = [(weekday[:3].lower(), weekday) for weekday in calendar.day_name]

current_year = datetime.datetime.now().year
DAYS_IN_MONTHS = {
calendar.month_name[month].lower(): calendar.monthrange(current_year, month)[1]
for month in range(1, 13)
}
WEEKS_SELECTION = [
("first", "First"),
("second", "Second"),
("third", "Third"),
("last", "Last"),
]
UNIT_SELECTION = [
("day", "Days"),
("week", "Weeks"),
("month", "Months"),
("year", "Years"),
]
DAYS = {
"mon": MO,
"tue": TU,
"wed": WE,
"thu": TH,
"fri": FR,
"sat": SA,
"sun": SU,
}

TYPE_SELECTION = [
("forever", "Forever"),
("until", "End Date"),
("after", "Number of Repetitions"),
]

ON_MONTH_SELECTION = [
("date", "Date of the Month"),
("day", "Day of the Month"),
]

ON_YEAR_SELECTION = [
("date", "Date of the Year"),
("day", "Day of the Year"),
]
8 changes: 5 additions & 3 deletions hr_timesheet_purchase_order/models/hr_employee_base.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Copyright (C) 2024 Cetmix OÜ
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


from odoo import fields, models


class HrEmployeeBase(models.AbstractModel):
_inherit = "hr.employee.base"

allow_generate_purchase_order = fields.Boolean(
string="Generate POs from Timesheet", default=False
)
allow_generate_purchase_order = fields.Boolean(string="Generate POs from Timesheet")
billing_partner_id = fields.Many2one("res.partner")
Loading

0 comments on commit d602ed5

Please sign in to comment.