[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 models
from . import wizard from . import wizard

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from . import calendar_event_type from . import calendar_event_type
from . import hr_employee from . import hr_employee
from . import hr_lv_allocation 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): class MeetingType(models.Model):
@@ -8,12 +6,12 @@ class MeetingType(models.Model):
_inherit = "calendar.event.type" _inherit = "calendar.event.type"
ref = fields.Char( ref = fields.Char(
string=_("Reference"), string="Reference",
copy=False, copy=False,
store=True, store=True,
) )
remove_luncheon_voucher = fields.Boolean( remove_luncheon_voucher = fields.Boolean(
string=_("Remove luncheon voucher"), string="Remove luncheon voucher",
copy=True, copy=True,
store=True, store=True,
) )

View File

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

View File

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

View File

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

View File

@@ -9,14 +9,16 @@
<xpath expr="//div[@name='employee_rights_setting_container']/.." position="inside"> <xpath expr="//div[@name='employee_rights_setting_container']/.." position="inside">
<h2>Employee Luncheon Vouchers</h2> <h2>Employee Luncheon Vouchers</h2>
<div class="row mt16 o_settings_container" name="employee_lv_container"> <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"> <div class="o_setting_left_pane">
<field name="hr_half_day_cancels_voucher" /> <field name="hr_half_day_cancels_voucher" />
</div> </div>
<div class="o_setting_right_pane"> <div class="o_setting_right_pane">
<label for="hr_half_day_cancels_voucher" /> <label for="hr_half_day_cancels_voucher" />
<div class="text-muted" name="hr_presence_options_advanced"> <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> </div>
</div> </div>

View File

@@ -1,3 +1 @@
# -*- coding: utf-8 -*-
from . import generate_lv_allocations_wizard 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): class GenerateLVAllocationRequests(models.TransientModel):
_name = "generate.lv.allocation.requests" _name = "generate.lv.allocation.requests"
_description = "Generate Luncheon Vouchers Allocations Requests" _description = "Generate Luncheon Vouchers Allocations Requests"
distrib_campaign_name = fields.Char('Distribution campaign', required=True) distrib_campaign_name = fields.Char('Distribution campaign', required=True)
date_from = fields.Datetime( date_from = fields.Datetime(
string=_("Start Date"), string="Start Date",
required=True required=True
) )
date_to = fields.Datetime( date_to = fields.Datetime(
string=_("End Date"), string="End Date",
required=True required=True
) )