[REF] hr_luncheon_voucher: remove useless code

This commit is contained in:
Stéphan Sainléger
2023-02-01 22:37:15 +01:00
parent 8579e22474
commit cc901c2e62
9 changed files with 26 additions and 49 deletions

View File

@@ -1,4 +1,2 @@
# -*- coding: utf-8 -*-
from . import models
from . import wizard

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from . import calendar_event_type
from . import hr_employee
from . import hr_lv_allocation

View File

@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
from odoo import fields, models, _
from odoo import fields, models
class MeetingType(models.Model):
@@ -8,12 +6,12 @@ class MeetingType(models.Model):
_inherit = "calendar.event.type"
ref = fields.Char(
string=_("Reference"),
string="Reference",
copy=False,
store=True,
)
remove_luncheon_voucher = fields.Boolean(
string=_("Remove luncheon voucher"),
string="Remove luncheon voucher",
copy=True,
store=True,
)

View File

@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
from xml.dom.minicompat import EmptyNodeList
from odoo import fields, models, api, _
from odoo import fields, models
class HrEmployeeBase(models.AbstractModel):
@@ -10,17 +8,17 @@ class HrEmployeeBase(models.AbstractModel):
lv_allocations_ids = fields.One2many("hr.lv.allocation", "employee_id")
total_acquired_lv = fields.Integer(
string=_("Total allocated luncheon vouchers"), store=True, copy=False
string="Total allocated luncheon vouchers", store=True, copy=False
)
distributed_lv = fields.Integer(
string=_("Distributed luncheon vouchers"), store=True, copy=False
string="Distributed luncheon vouchers", store=True, copy=False
)
dued_lv = fields.Integer(
string=_("Remaining luncheon vouchers"), store=True, copy=False
string="Remaining luncheon vouchers", store=True, copy=False
)
default_monthly_lv = fields.Integer(
string=_("Default monthly distribution"), store=True, copy=True
string="Default monthly distribution", store=True, copy=True
)
def refresh_lv_values(self):

View File

@@ -1,18 +1,13 @@
# -*- coding: utf-8 -*-
import math
from datetime import datetime, date, timedelta, time
from datetime import datetime, timedelta, time
from dateutil.rrule import rrule, DAILY
from pytz import timezone, UTC, utc
from pytz import UTC
from odoo import fields, models, api, _
from odoo import fields, models, api
class LuncheonVouchersAllocation(models.Model):
_name = "hr.lv.allocation"
_description = "Luncheon Vouchers Allocation"
_order = "create_date desc"
_inherit = ["mail.thread", "mail.activity.mixin"]
_mail_post_access = "read"
name = fields.Char('Name')
distrib_campaign_name = fields.Char('Distribution campaign')
@@ -24,30 +19,25 @@ class LuncheonVouchersAllocation(models.Model):
],
string="Status",
readonly=True,
tracking=True,
copy=False,
default="draft",
help="The status is set to 'Draft', when an allocation request is created."
+ "\nThe status is 'Confirmed', when an allocation request is confirmed by HR manager."
+ "\nThe status is 'Distributed', when the luncheon vouchers have been distributed.",
help="The status is set to 'Draft', when an allocation request is created. The status is 'Confirmed', when an allocation request is confirmed by HR manager. The status is 'Distributed', when the luncheon vouchers have been distributed.",
)
date_from = fields.Datetime(
string=_("Start Date"),
string="Start Date",
store=True,
readonly=False,
copy=False,
tracking=True,
states={
"confirmed": [("readonly", True)],
"distributed": [("readonly", True)],
},
)
date_to = fields.Datetime(
string=_("End Date"),
string="End Date",
store=True,
readonly=False,
copy=False,
tracking=True,
states={
"confirmed": [("readonly", True)],
"distributed": [("readonly", True)],
@@ -56,41 +46,37 @@ class LuncheonVouchersAllocation(models.Model):
employee_id = fields.Many2one(
"hr.employee",
store=True,
string=_("Employee"),
string="Employee",
index=True,
readonly=False,
ondelete="restrict",
tracking=True,
states={
"confirmed": [("readonly", True)],
"distributed": [("readonly", True)],
},
)
number_acquired_lv = fields.Integer(
string=_("Acquired Vouchers"),
string="Acquired Vouchers",
store=True,
readonly=False,
tracking=True,
states={
"confirmed": [("readonly", True)],
"distributed": [("readonly", True)],
},
)
number_dued_lv = fields.Integer(
string=_("Dued Vouchers"),
string="Dued Vouchers",
store=True,
readonly=False,
tracking=True,
states={
"confirmed": [("readonly", True)],
"distributed": [("readonly", True)],
},
)
number_distributed_lv = fields.Integer(
string=_("Distributed Vouchers"),
string="Distributed Vouchers",
store=True,
readonly=False,
tracking=True,
states={
"confirmed": [("readonly", False)],
"distributed": [("readonly", True)],

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from odoo import fields, models

View File

@@ -9,14 +9,16 @@
<xpath expr="//div[@name='employee_rights_setting_container']/.." position="inside">
<h2>Employee Luncheon Vouchers</h2>
<div class="row mt16 o_settings_container" name="employee_lv_container">
<div class="col-12 col-lg-6 o_setting_box" id="employee_lv_halfday_cancel" title="Luncheon Vouchers Half-day Cancel">
<div class="col-12 col-lg-6 o_setting_box" id="employee_lv_halfday_cancel"
title="Luncheon Vouchers Half-day Cancel">
<div class="o_setting_left_pane">
<field name="hr_half_day_cancels_voucher" />
</div>
<div class="o_setting_right_pane">
<label for="hr_half_day_cancels_voucher" />
<div class="text-muted" name="hr_presence_options_advanced">
Voucher is acquired only if the employee worked during all his attendance.
Voucher is acquired only if the employee worked during all his
attendance.
</div>
</div>
</div>

View File

@@ -1,3 +1 @@
# -*- coding: utf-8 -*-
from . import generate_lv_allocations_wizard

View File

@@ -1,16 +1,17 @@
from odoo import _, api, fields, models
from odoo import fields, models
class GenerateLVAllocationRequests(models.TransientModel):
_name = "generate.lv.allocation.requests"
_description = "Generate Luncheon Vouchers Allocations Requests"
distrib_campaign_name = fields.Char('Distribution campaign', required=True)
date_from = fields.Datetime(
string=_("Start Date"),
string="Start Date",
required=True
)
date_to = fields.Datetime(
string=_("End Date"),
string="End Date",
required=True
)