forked from Yaltik/golem
[REF]GOLEM Resources : wizard should be in wizard folder
This commit is contained in:
parent
661c7fecfe
commit
2b70d2c1b0
@ -16,4 +16,4 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# 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/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from . import models
|
from . import models, wizard
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
'name': 'GOLEM non-profit resources',
|
'name': 'GOLEM non-profit resources',
|
||||||
'summary': 'GOLEM resources management',
|
'summary': 'GOLEM resources management',
|
||||||
'description': ''' GOLEM resources management ''',
|
'description': ''' GOLEM resources management ''',
|
||||||
'version': '10.0.1.0.3',
|
'version': '10.0.1.0.4',
|
||||||
'category': 'GOLEM',
|
'category': 'GOLEM',
|
||||||
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
@ -29,5 +29,6 @@
|
|||||||
'depends': ['product'],
|
'depends': ['product'],
|
||||||
'data': ['views/golem_resources_views.xml',
|
'data': ['views/golem_resources_views.xml',
|
||||||
'views/golem_reservation_views.xml',
|
'views/golem_reservation_views.xml',
|
||||||
|
'wizard/golem_reservation_rejection_views.xml',
|
||||||
'security/ir.model.access.csv']
|
'security/ir.model.access.csv']
|
||||||
}
|
}
|
||||||
|
@ -20,21 +20,6 @@
|
|||||||
|
|
||||||
from odoo import models, fields, api, _, exceptions
|
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
|
#modèle de base : ressources
|
||||||
class GolemResources(models.Model):
|
class GolemResources(models.Model):
|
||||||
@ -108,7 +93,7 @@ class GolemReservation(models.Model):
|
|||||||
reservation_id = self[0]
|
reservation_id = self[0]
|
||||||
return {'name' : _('Please enter the rejection reason'),
|
return {'name' : _('Please enter the rejection reason'),
|
||||||
'type' : 'ir.actions.act_window',
|
'type' : 'ir.actions.act_window',
|
||||||
'res_model' : 'golem.resource.rejection.wizard',
|
'res_model' : 'golem.reservation.rejection.wizard',
|
||||||
'context': {'default_reservation_id': reservation_id.id},
|
'context': {'default_reservation_id': reservation_id.id},
|
||||||
'view_mode': 'form',
|
'view_mode': 'form',
|
||||||
'target': 'new'}
|
'target': 'new'}
|
||||||
|
@ -112,23 +112,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<menuitem id="resource_reservation_menu" name="Reservations"
|
<menuitem id="resource_reservation_menu" name="Reservations"
|
||||||
parent="resources_menu" action="action_reservation" sequence="20" />
|
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>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
19
golem_ressources/wizard/__init__.py
Normal file
19
golem_ressources/wizard/__init__.py
Normal 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
|
36
golem_ressources/wizard/golem_reservation_rejection.py
Normal file
36
golem_ressources/wizard/golem_reservation_rejection.py
Normal 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})
|
@ -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>
|
Loading…
x
Reference in New Issue
Block a user