mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] pms: wizard unify line room ids
This commit is contained in:
1
pms/wizards/__init__.py
Normal file
1
pms/wizards/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import wizard_reservation
|
||||
18
pms/wizards/wizard_reservation.py
Normal file
18
pms/wizards/wizard_reservation.py
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
class ReservationWizard(models.TransientModel):
|
||||
_name = 'pms.reservation.wizard'
|
||||
allowed_rooms = fields.One2many('pms.room', compute="_compute_allowed_rooms")
|
||||
options = fields.Many2one('pms.room', string='Room')
|
||||
|
||||
def _compute_allowed_rooms(self):
|
||||
for record in self:
|
||||
record.allowed_rooms = self._context.get('rooms_available')
|
||||
|
||||
def unify(self):
|
||||
if self.options:
|
||||
for record in self:
|
||||
for line in self.env['pms.reservation'].search([('id', '=', self._context.get('active_id'))]).reservation_line_ids:
|
||||
line.room_id = self.options
|
||||
|
||||
24
pms/wizards/wizard_reservation.xml
Normal file
24
pms/wizards/wizard_reservation.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" ?>
|
||||
<odoo>
|
||||
<record id="reservation_wizard" model="ir.ui.view">
|
||||
<field name="name">Reservation Wizard</field>
|
||||
<field name="model">pms.reservation.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Choose The Details">
|
||||
<group>
|
||||
<field name="options"
|
||||
string="Suggested rooms to unify the reservation:"
|
||||
options="{'no_create': True,'no_open': True}"
|
||||
required="1"
|
||||
domain="[('id', 'in', allowed_rooms)]"/>
|
||||
<field name="allowed_rooms" invisible="1"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="unify" string="Unify" type="object" class="oe_highlight" />
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user