[NEW] hr-luncheon-vouchers: create addons
This commit is contained in:
29
hr-luncheon-voucher/wizard/generate_lv_allocations_wizard.py
Normal file
29
hr-luncheon-voucher/wizard/generate_lv_allocations_wizard.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from odoo import _, api, 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"),
|
||||
required=True
|
||||
)
|
||||
date_to = fields.Datetime(
|
||||
string=_("End Date"),
|
||||
required=True
|
||||
)
|
||||
|
||||
def generate_lv_allocations(self):
|
||||
values = {}
|
||||
values["distrib_campaign_name"] = self.distrib_campaign_name
|
||||
values["date_from"] = self.date_from
|
||||
values["date_to"] = self.date_to
|
||||
employees = self.env["hr.employee"].search(
|
||||
[
|
||||
("id", "in", self.env.context.get("active_ids")),
|
||||
]
|
||||
)
|
||||
employees.generate_mass_lv_allocation(values)
|
||||
# Open lv allocation tree view
|
||||
return self.env["ir.actions.act_window"]._for_xml_id("hr-luncheon-voucher.act_lv_allocations")
|
Reference in New Issue
Block a user