Commit fc34bfcb authored by Samuel Vannier's avatar Samuel Vannier 🚀
Browse files

Merge branch 'develop' into 'master'

Release

See merge request !1
parents 47639d77 14dc3666
......@@ -2,4 +2,7 @@
.vscode/
config/odoo.conf
odoo_pass
odoo_pg_pass
\ No newline at end of file
odoo_pg_pass
venv/
__pycache__/
*.pyc
\ No newline at end of file
# CinePrex - Projet
# CinéPrex - Projet
## Membres
### Membre
Membre :
* Clément Duez
* Samuel Vannier
* Hugo Porchet-Belmonte
......@@ -11,10 +11,11 @@ Membre :
````shell
docker-compose build
````
add ``,/mnt/extra-addons`` in the addons_path of ``conf/odoo.conf``
## Start application
````shell
docker-compose up
````
[localhost](http://localhost:8069)
\ No newline at end of file
Go to [localhost](http://localhost:8069)
\ No newline at end of file
from . import models
\ No newline at end of file
from . import models, controllers
\ No newline at end of file
......@@ -3,16 +3,30 @@
'name': "Cineprex BG",
'version': '0.1',
'depends': ['base'],
'author': ["La Rochelle Université"],
'author': ["Clément Duez, Hugo Porchet-Belmonte, Samuel Vannier"],
'website': "https://www.univ-larochelle.fr/",
'category': 'Project Management',
'description': """
Cineprex BG le module pour les BG cinemas.
""",
'depends': [
'base',
'website_sale',
],
'data': [
'security/ir.model.access.csv',
'security/security.xml',
'views/film_view.xml'
'views/film_view.xml',
'views/salle_view.xml',
'views/seance_view.xml',
'views/site_view.xml',
'views/tarif_view.xml',
'views/billet_view.xml',
'templates/cinemas_template.xml',
'templates/cinema_template.xml',
'templates/films_template.xml',
'templates/salles_template.xml',
],
'application': True,
'installable': True
}
}
\ No newline at end of file
from . import cineprex
\ No newline at end of file
import logging
from odoo import http
from odoo.http import request
import logging
_logger = logging.getLogger(__name__)
class Cineprex(http.Controller):
@http.route(['''/cinemas'''], type='http', auth="public", website=True, sitemap=True)
def cineprex_cinemas(self, **kw):
sites = http.request.env['cineprex.site'].search([])
return request.render("cineprex-bg.cineprex-cinemas", {"sites": sites})
@http.route(['''/cinemas/<int:cinema_id>'''], type='http', auth="public", website=True, sitemap=True)
def cineprex_cinema(self, cinema_id, **kw):
cinema = http.request.env['cineprex.site'].browse(cinema_id)
# get salle
salle_id = cinema.read(["id_salle"])[0]["id_salle"]
salles = http.request.env['cineprex.salle'].browse(salle_id)
return request.render("cineprex-bg.cineprex-cinema", {"cinema": cinema, "salles": salles})
@http.route(['''/films'''], type='http', auth="public", website=True, sitemap=True)
def cineprex_films(self, **kw):
films = http.request.env['cineprex.film'].search([])
return request.render("cineprex-bg.cineprex-films", {"films": films})
@http.route(['''/salles/<int:cinema_id>'''], type='http', auth="public", website=True, sitemap=True)
def cineprex_salles_for_cinema(self, cinema_id, **kw):
cinema = http.request.env['cineprex.site'].browse(cinema_id)
# get salle
salle_id = cinema.read(["id_salle"])[0]["id_salle"]
salles = http.request.env['cineprex.salle'].browse(salle_id)
return request.render("cineprex-bg.cineprex-salles", {"salles": salles})
\ No newline at end of file
from . import films
\ No newline at end of file
from . import site, salle, film, seance, tarif, billet
from odoo import models, fields, api
class Billet(models.Model):
_name = "cineprex.billet"
_description = "Billet pour une séance"
seance = fields.Many2one(comodel_name='cineprex.seance')
tarif = fields.Many2one(comodel_name='cineprex.tarif')
\ No newline at end of file
from odoo import models, fields
class Film(models.Model):
_name = 'cineprex.film'
_rec_name = "nom"
_description = "Un film diffuser ou diffusable"
film_id = fields.Integer("ID")
nom = fields.Char("Nom")
realisateur = fields.Char("Realisateur")
annee = fields.Date("Date de sortie")
duree = fields.Float('Durée')
affiche = fields.Image('Affiche')
tout_public = fields.Boolean("Film tout public")
id_seance = fields.One2many(comodel_name="cineprex.seance", inverse_name="id_film")
cinemas = fields.Many2many(comodel_name="cineprex.site")
from odoo import models, fields
class Film(models.Model):
_name = 'cineBG.name'
name = fields.Char()
from odoo import models, fields, api
class Salle(models.Model):
_name = "cineprex.salle"
_rec_name = 'information'
_description = "Une salle noire"
salle_id = fields.Integer("ID")
nb_de_place = fields.Integer('Places Disponibles')
type_salle = fields.Selection(
[('GRANDE_SALLE', 'Grande Salle'), ('PETITE_SALLE', 'Petite salle'), ('DOLBY_ATMOS', 'Dolby Atmos'), ('4K', '4K'), ('ICE', 'ICE')])
id_site = fields.Many2one(comodel_name="cineprex.site")
id_seance = fields.One2many(
comodel_name="cineprex.seance", inverse_name="id_salle")
information = fields.Char(string="Information", compute="_getname")
@api.depends('id_site', 'salle_id')
def _getname(self):
for salle in self:
salle.information = f"[ {salle.id_site.nom} ] Salle n°{salle.id}"
from odoo import models, fields, api
class Seance(models.Model):
_name = 'cineprex.seance'
_rec_name = 'information'
_description = "Seance de cinema un film + Salle + horaire"
seance_id = fields.Integer("ID")
date_start = fields.Datetime("Début Seance")
date_end = fields.Datetime("Fin Seance")
id_salle = fields.Many2one(comodel_name='cineprex.salle')
id_film = fields.Many2one(comodel_name='cineprex.film')
information = fields.Char(string="Information", compute="_getname")
place_vendue = fields.One2many(comodel_name="cineprex.billet", inverse_name="seance")
@api.depends('id_film', 'id_salle', 'seance_id')
def _getname(self):
for seance in self:
seance.information = f"[ {seance.id_film.nom} ] Salle n°{seance.id_salle.salle_id} le {seance.date_start}"
from odoo import models, fields
class Site(models.Model):
_name = 'cineprex.site'
_rec_name = 'nom'
_description = "Site de cinéma"
site_id = fields.Integer('ID')
nom = fields.Char("Nom")
localisation = fields.Text("Localisation")
photo = fields.Image("Photo")
id_salle = fields.One2many(comodel_name="cineprex.salle", inverse_name="id_site")
films = fields.Many2many(comodel_name="cineprex.film")
from odoo import models, fields, api
class Tarif(models.Model):
_name = "cineprex.tarif"
_rec_name = 'nom'
_description = "Réduction applicable en %."
currency_id = fields.Many2one('res.currency', string='Currency')
prix = fields.Monetary('Prix')
nom = fields.Char("Nom")
\ No newline at end of file
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_cinema_film,access.cinema.film,model_cineprex_film,group_cinema_directeur_general,1,1,1,1
access_cinema_salle,access.cinema.salle,model_cineprex_salle,group_cinema_directeur_general,1,1,1,1
access_cinema_site,access.cinema.site,model_cineprex_site,group_cinema_directeur_general,1,1,1,1
access_cinema_seance,access.cinema.seance,model_cineprex_seance,group_cinema_directeur_general,1,1,1,1
access_cinema_tarif,access.cinema.tarif,model_cineprex_tarif,group_cinema_directeur_general,1,1,1,1
access_cinema_billet,access.cinema.billet,model_cineprex_billet,group_cinema_directeur_general,1,1,1,1
\ No newline at end of file
<odoo></odoo>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record model="res.groups" id="group_cinema_directeur_general">
<field name="name">Directeur Général</field>
</record>
<record model="res.groups" id="group_cinema_directeur">
<field name="name">Directeur Cinéma</field>
</record>
<record model="res.groups" id="group_cinema_vendeur">
<field name="name">Employé vendeur</field>
</record>
<record model="res.groups" id="group_cinema_comptable">
<field name="name">Comptable</field>
</record>
</odoo>
<?xml version='1.0' encoding='utf-8'?>
<odoo>
<template id="cineprex-cinema" name="Cinema">
<t t-call="website.layout">
<div style="width:80%" class="container d-flex">
<div class="row m-2">
<div class="col-sm">
<img t-att-src="'data:image/png;base64,%s' % to_text(cinema.photo)" class="img-thumbnail"/>
</div>
<div class="col-sm">
<h2>
<t t-esc="cinema.nom"/>
</h2>
<p>
<t t-esc="cinema.localisation"/>
</p>
<h2>Nos Salles :</h2>
<t t-foreach="salles" t-as="salle">
<h4>Salle n°
<t t-esc="salle.id"/>
</h4>
<p>
<p>
<b>Type de la salle :</b>
<t t-esc="salle.type_salle"/>
</p>
<p>
<t t-esc="salle.nb_de_place"/>
Places
</p>
</p>
</t>
</div>
</div>
</div>
</t>
</template>
</odoo>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="cineprex-cinemas" name="Cineprex">
<t t-call="website.layout">
<div style="width:80%" class="d-flex mx-auto mt-3">
<t t-foreach="sites" t-as="site">
<div class="card mx-2 mb-3" style="width:300px">
<img t-att-src="'data:image/png;base64,%s' % to_text(site.photo)" class="card-img-top w-100" />
<div class="card-body">
<h5 class="card-title">
<t t-esc="site.nom" />
</h5>
<p class="card-text">
<t t-esc="site.localisation" />
</p>
<a t-att-href="'/cinemas/%s' % to_text(site.id)" class="btn btn-primary">Voir plus</a>
</div>
</div>
</t>
</div>
</t>
</template>
</odoo>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<template id="cineprex-films" name="Films">
<t t-call="website.layout">
<div style="width:80%" class="d-flex mx-auto mt-3">
<t t-foreach="films" t-as="film">
<div class="card mx-2 mb-3" style="width:300px">
<img t-att-src="'data:image/png;base64,%s' % to_text(film.affiche)" class="card-img-top w-100"/>
<div class="card-body">
<h5 class="card-title"><t t-esc="film.nom"/></h5>
<p class="card-text"><t t-esc="film.realisateur"/> - <t t-esc="film.annee"/> - <t t-esc="film.duree"/></p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
</t>
</div>
</t>
</template>
</odoo>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment