[MIG] hr_luncheon_voucher: migrate to 18.0
This commit is contained in:
1
hr_luncheon_voucher/wizard/__init__.py
Normal file
1
hr_luncheon_voucher/wizard/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import generate_lv_allocations_wizard
|
||||
26
hr_luncheon_voucher/wizard/generate_lv_allocations_wizard.py
Normal file
26
hr_luncheon_voucher/wizard/generate_lv_allocations_wizard.py
Normal file
@@ -0,0 +1,26 @@
|
||||
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", 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"
|
||||
)
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="lv_allocations_requests_wizard" model="ir.ui.view">
|
||||
<field name="name">lv.allocations.requests.wizard</field>
|
||||
<field name="model">generate.lv.allocation.requests</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create Luncheon Vouchers allocations requests">
|
||||
<group name="dates" string="Period to consider">
|
||||
<group>
|
||||
<field name="distrib_campaign_name" />
|
||||
<field name="date_from" widget="date" />
|
||||
<field name="date_to" widget="date" />
|
||||
</group>
|
||||
</group>
|
||||
<footer>
|
||||
<button
|
||||
string="Create allocations requests"
|
||||
name="generate_lv_allocations"
|
||||
type="object"
|
||||
class="btn-primary"
|
||||
/>
|
||||
<button
|
||||
string="Cancel"
|
||||
class="btn-secondary"
|
||||
special="cancel"
|
||||
/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record
|
||||
id="lv_allocations_requests_wizard_action"
|
||||
model="ir.actions.act_window"
|
||||
>
|
||||
<field name="name">Create Luncheon Vouchers allocations requests</field>
|
||||
<field name="res_model">generate.lv.allocation.requests</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="lv_allocations_requests_wizard" />
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user