diff --git a/hr_luncheon_voucher/__init__.py b/hr_luncheon_voucher/__init__.py index 35e7c96..9b42961 100644 --- a/hr_luncheon_voucher/__init__.py +++ b/hr_luncheon_voucher/__init__.py @@ -1,4 +1,2 @@ -# -*- coding: utf-8 -*- - from . import models from . import wizard diff --git a/hr_luncheon_voucher/models/__init__.py b/hr_luncheon_voucher/models/__init__.py index aefe482..3cff762 100644 --- a/hr_luncheon_voucher/models/__init__.py +++ b/hr_luncheon_voucher/models/__init__.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from . import calendar_event_type from . import hr_employee from . import hr_lv_allocation diff --git a/hr_luncheon_voucher/models/calendar_event_type.py b/hr_luncheon_voucher/models/calendar_event_type.py index 3d7b79f..7680df3 100644 --- a/hr_luncheon_voucher/models/calendar_event_type.py +++ b/hr_luncheon_voucher/models/calendar_event_type.py @@ -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, ) diff --git a/hr_luncheon_voucher/models/hr_employee.py b/hr_luncheon_voucher/models/hr_employee.py index af053bb..81cb5d9 100644 --- a/hr_luncheon_voucher/models/hr_employee.py +++ b/hr_luncheon_voucher/models/hr_employee.py @@ -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): diff --git a/hr_luncheon_voucher/models/hr_lv_allocation.py b/hr_luncheon_voucher/models/hr_lv_allocation.py index 1be56c0..30e432f 100644 --- a/hr_luncheon_voucher/models/hr_lv_allocation.py +++ b/hr_luncheon_voucher/models/hr_lv_allocation.py @@ -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)], diff --git a/hr_luncheon_voucher/models/res_config_settings.py b/hr_luncheon_voucher/models/res_config_settings.py index 88c25ea..0cc460f 100644 --- a/hr_luncheon_voucher/models/res_config_settings.py +++ b/hr_luncheon_voucher/models/res_config_settings.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from odoo import fields, models diff --git a/hr_luncheon_voucher/views/res_config_settings_views.xml b/hr_luncheon_voucher/views/res_config_settings_views.xml index f0eb2c1..58800bb 100644 --- a/hr_luncheon_voucher/views/res_config_settings_views.xml +++ b/hr_luncheon_voucher/views/res_config_settings_views.xml @@ -9,14 +9,16 @@

Employee Luncheon Vouchers

-
+
diff --git a/hr_luncheon_voucher/wizard/__init__.py b/hr_luncheon_voucher/wizard/__init__.py index 9da2498..5654c38 100644 --- a/hr_luncheon_voucher/wizard/__init__.py +++ b/hr_luncheon_voucher/wizard/__init__.py @@ -1,3 +1 @@ -# -*- coding: utf-8 -*- - from . import generate_lv_allocations_wizard diff --git a/hr_luncheon_voucher/wizard/generate_lv_allocations_wizard.py b/hr_luncheon_voucher/wizard/generate_lv_allocations_wizard.py index 440a6c9..f56d9f7 100644 --- a/hr_luncheon_voucher/wizard/generate_lv_allocations_wizard.py +++ b/hr_luncheon_voucher/wizard/generate_lv_allocations_wizard.py @@ -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 )