[REF]GOLEM Resources : wizard should be in wizard folder

This commit is contained in:
Fabien BOURGEOIS 2018-02-18 08:55:13 +01:00
parent 661c7fecfe
commit 2b70d2c1b0
7 changed files with 101 additions and 36 deletions

View File

@ -16,4 +16,4 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from . import models
from . import models, wizard

View File

@ -20,7 +20,7 @@
'name': 'GOLEM non-profit resources',
'summary': 'GOLEM resources management',
'description': ''' GOLEM resources management ''',
'version': '10.0.1.0.3',
'version': '10.0.1.0.4',
'category': 'GOLEM',
'author': 'Youssef El Ouahby, Fabien Bourgeois',
'license': 'AGPL-3',
@ -29,5 +29,6 @@
'depends': ['product'],
'data': ['views/golem_resources_views.xml',
'views/golem_reservation_views.xml',
'wizard/golem_reservation_rejection_views.xml',
'security/ir.model.access.csv']
}

View File

@ -20,21 +20,6 @@
from odoo import models, fields, api, _, exceptions
class GolemResourceRejectionWizard(models.TransientModel):
"""GOLEM Resource wizard : refusal reason for a reservation """
_name = "golem.resource.rejection.wizard"
reservation_id = fields.Many2one('golem.reservation', required=True)
reason = fields.Text(required=True)
@api.multi
def validate(self, vals):
""" Sets reservation status to rejected and add reason """
self.ensure_one()
rejection = self[0]
rejection.reservation_id.write({'status': 'rejected',
'rejection_reason': rejection.reason})
#modèle de base : ressources
class GolemResources(models.Model):
@ -108,7 +93,7 @@ class GolemReservation(models.Model):
reservation_id = self[0]
return {'name' : _('Please enter the rejection reason'),
'type' : 'ir.actions.act_window',
'res_model' : 'golem.resource.rejection.wizard',
'res_model' : 'golem.reservation.rejection.wizard',
'context': {'default_reservation_id': reservation_id.id},
'view_mode': 'form',
'target': 'new'}

View File

@ -112,23 +112,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<menuitem id="resource_reservation_menu" name="Reservations"
parent="resources_menu" action="action_reservation" sequence="20" />
<record model="ir.ui.view" id="golem_resource_rejection_wizard_form_view">
<field name="name">GOLEM Resource Rejection Wizard Form</field>
<field name="model">golem.resource.rejection.wizard</field>
<field name="arch" type="xml">
<form string="Rejection reason">
<group>
<field name="reservation_id" readonly="1" />
<field name="reason" />
</group>
<footer>
<button name="validate" string="Validate" type="object"
class="oe_highlight" />
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
</data>
</odoo>

View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from . import golem_reservation_rejection

View File

@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
# Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
""" GOLEM Resources management """
from odoo import models, fields, api
class GolemReservationRejectionWizard(models.TransientModel):
"""GOLEM Resource wizard : refusal reason for a reservation """
_name = "golem.reservation.rejection.wizard"
reservation_id = fields.Many2one('golem.reservation', required=True)
reason = fields.Text(required=True)
@api.multi
def validate(self):
""" Sets reservation status to rejected and add reason """
self.ensure_one()
rejection = self[0]
rejection.reservation_id.write({'status': 'rejected',
'rejection_reason': rejection.reason})

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
Copyright 2018 Fabien Bourgeois <fabien@yaltik.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<odoo>
<data>
<!-- Forms -->
<record model="ir.ui.view" id="golem_reservation_rejection_wizard_form_view">
<field name="name">GOLEM Reservation Rejection Wizard Form</field>
<field name="model">golem.reservation.rejection.wizard</field>
<field name="arch" type="xml">
<form string="Rejection reason">
<group>
<field name="reservation_id" readonly="1" />
<field name="reason" />
</group>
<footer>
<button name="validate" string="Validate" type="object"
class="oe_highlight" />
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
</data>
</odoo>