mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] Precommit improvements
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
from odoo import fields, models
|
||||
|
||||
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')
|
||||
_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')
|
||||
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
|
||||
|
||||
for line in (
|
||||
self.env["pms.reservation"]
|
||||
.search([("id", "=", self._context.get("active_id"))])
|
||||
.reservation_line_ids
|
||||
):
|
||||
line.room_id = self.options
|
||||
|
||||
@@ -1,24 +1,31 @@
|
||||
<?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>
|
||||
<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