Commit e5922bc5 by Maria Agustina

227 no terminada

0 parents
# -*- coding: utf-8 -*-
from . import controllers
from . import models
\ No newline at end of file \ No newline at end of file
# -*- coding: utf-8 -*-
{
'name': "hgt_bares",
'summary': """
Modulo de Bares""",
'description': """
Modulo de Bares con estructuras de Salones, Mesas, Pedidos cliente
""",
'author': "HGT SA",
'website': "http://www.yourcompany.com",
# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/master/odoo/addons/base/module/module_data.xml
# for the full list
'category': 'Project Management',
'version': '0.20.12.01',
# any module necessary for this one to work correctly
'depends': ['base'],
# always loaded
'data': [
# 'security/ir.model.access.csv',
'views/salones.xml',
'views/mesas.xml',
'views/menu.xml',
],
# only loaded in demonstration mode
'demo': [
'demo/demo.xml',
],
'application': True,
'installable': True
}
\ No newline at end of file \ No newline at end of file
# -*- coding: utf-8 -*-
from . import controllers
\ No newline at end of file \ No newline at end of file
# -*- coding: utf-8 -*-
from odoo import http
# class MyModule(http.Controller):
# @http.route('/my_module/my_module/', auth='public')
# def index(self, **kw):
# return "Hello, world"
# @http.route('/my_module/my_module/objects/', auth='public')
# def list(self, **kw):
# return http.request.render('my_module.listing', {
# 'root': '/my_module/my_module',
# 'objects': http.request.env['my_module.my_module'].search([]),
# })
# @http.route('/my_module/my_module/objects/<model("my_module.my_module"):obj>/', auth='public')
# def object(self, obj, **kw):
# return http.request.render('my_module.object', {
# 'object': obj
# })
\ No newline at end of file \ No newline at end of file
<odoo>
<data>
<!-- -->
<!-- <record id="object0" model="my_module.my_module"> -->
<!-- <field name="name">Object 0</field> -->
<!-- <field name="value">0</field> -->
<!-- </record> -->
<!-- -->
<!-- <record id="object1" model="my_module.my_module"> -->
<!-- <field name="name">Object 1</field> -->
<!-- <field name="value">10</field> -->
<!-- </record> -->
<!-- -->
<!-- <record id="object2" model="my_module.my_module"> -->
<!-- <field name="name">Object 2</field> -->
<!-- <field name="value">20</field> -->
<!-- </record> -->
<!-- -->
<!-- <record id="object3" model="my_module.my_module"> -->
<!-- <field name="name">Object 3</field> -->
<!-- <field name="value">30</field> -->
<!-- </record> -->
<!-- -->
<!-- <record id="object4" model="my_module.my_module"> -->
<!-- <field name="name">Object 4</field> -->
<!-- <field name="value">40</field> -->
<!-- </record> -->
<!-- -->
</data>
</odoo>
\ No newline at end of file \ No newline at end of file
# -*- coding: utf-8 -*-
from . import salones
from . import mesas
\ No newline at end of file \ No newline at end of file
No preview for this file type
No preview for this file type
No preview for this file type
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class hgt_mesas(models.Model):
_name = 'hgt.mesas'
nombre = fields.Char(
string="Nombre",
compute="obtener_nombre_mesa",
)
numero = fields.Integer(
string=u'Número de Mesa',
compute = "obtener_numero_mesa"
)
salon = fields.Many2one(
string='Salón',
comodel_name='hgt.salones',
ondelete='restrict',
)
def obtener_nombre_mesa(self):
sal = self.salon.nombre
nom = """{} - {}""".format(sal, self.numero)
self.nombre = nom
def obtener_numero_mesa(self):
sal = self.salon
nro = len(sal.mesas)
self.numero = nro
# -*- coding: utf-8 -*-
from odoo import models, fields, api
# class my_module(models.Model):
# _name = 'my_module.my_module'
# name = fields.Char()
# value = fields.Integer()
# value2 = fields.Float(compute="_value_pc", store=True)
# description = fields.Text()
#
# @api.depends('value')
# def _value_pc(self):
# self.value2 = float(self.value) / 100
\ No newline at end of file \ No newline at end of file
# -*- coding: utf-8 -*-
from odoo import models, fields, api, exceptions
class hgt_salones(models.Model):
_name = 'hgt.salones'
_rec_name = 'nombre'
nombre = fields.Char(
string="Nombre",
)
#hacer metodo para chequear que sea de 5 lttas
codigo = fields.Char(
string=u"Código",
help=u"Inserte un código de 5 letras",
required=True,
)
mesas = fields.One2many(
string=u'Mesas del Salón',
comodel_name='hgt.mesas',
inverse_name='salon',
)
@api.model
def create(self,values):
if 'codigo' in values and len(values['codigo']) != 5 and values['codigo'].isalpha() == True:
raise exceptions.ValidationError("El código debe contar con 5 letras")
result=super(hgt_salones,self).create(values)
return result
@api.model
def write(self,values):
if 'codigo' in values and len(values['codigo']) != 5 and values['codigo'].isalpha() == True:
raise exceptions.ValidationError("El código debe contar con 5 letras")
result=super(hgt_salones,self).write(values)
return result
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_my_module_my_module,my_module.my_module,model_my_module_my_module,,1,0,0,0
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data noupdate="0">
<!-- Elemento Root -->
<menuitem name="Salones" id="hgt_bar_salones" sequence='10'/>
<menuitem name="Pedidos" id="hgt_bar_pedidos" sequence='20'/>
<!-- Elemento Grupos -->
<menuitem name="Salones" sequence='01' id="hgt_bar_salones_salones" parent="hgt_bar_salones"/>
<menuitem name="Mesas" sequence='02' id="hgt_bar_salones_mesas" parent="hgt_bar_salones"/>
<menuitem name="Pedidos" sequence='01' id="hgt_bar_pedidos_pedidos" parent="hgt_bar_pedidos"/>
<!-- Acciones finales-->
<menuitem name="Salones" sequence='10' id="hgt_salones" parent="hgt_bar_salones_salones" action='hgt_salones_action_window'/>
<menuitem name="Mesas" sequence='10' id="hgt_mesas" parent="hgt_bar_salones_mesas" action='hgt_mesas_action_window'/>
<menuitem name="Pedidos" sequence='10' id="hgt_pedidos" parent="hgt_bar_pedidos_pedidos" action=''/>
</data>
</odoo>
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data noupdate="0">
<!-- actions opening views on models -->
<record model="ir.actions.act_window" id="hgt_mesas_action_window">
<field name="name">Mesas</field>
<field name="res_model">hgt.mesas</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Cree la primera Mesa</p>
</field>
</record>
<record model="ir.ui.view" id="hgt_mesas_list">
<field name="name">mesas</field>
<field name="model">hgt.mesas</field>
<field name="arch" type="xml">
<tree>
<field name="nombre"/>
<field name="numero"/>
<field name="salon"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="hgt_mesas_form">
<field name="name">mesas</field>
<field name="model">hgt.mesas</field>
<field name="arch" type="xml">
<form>
<sheet>
<group col="4" string="Datos de la Mesa">
<field colspan="2" name="nombre"/>
<field colspan="2" name="numero"/>
<field colspan="2" name="salon"/>
</group>
</sheet>
</form>
</field>
</record>
</data>
</odoo>
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data noupdate="0">
<!-- actions opening views on models -->
<record model="ir.actions.act_window" id="hgt_salones_action_window">
<field name="name">Salones</field>
<field name="res_model">hgt.salones</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Cree el primer Salón</p>
</field>
</record>
<record model="ir.ui.view" id="hgt_salones_list">
<field name="name">Salones</field>
<field name="model">hgt.salones</field>
<field name="arch" type="xml">
<tree>
<field name="nombre"/>
<field name="codigo"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="hgt_salones_form">
<field name="name">Salones</field>
<field name="model">hgt.salones</field>
<field name="arch" type="xml">
<form>
<sheet>
<group col="4" string="Datos del Salón">
<field colspan="2" name="nombre"/>
<field colspan="2" name="codigo"/>
</group>
</sheet>
</form>
</field>
</record>
</data>
</odoo>
<odoo>
<data>
<!-- <template id="listing"> -->
<!-- <ul> -->
<!-- <li t-foreach="objects" t-as="object"> -->
<!-- <a t-attf-href="#{ root }/objects/#{ object.id }"> -->
<!-- <t t-esc="object.display_name"/> -->
<!-- </a> -->
<!-- </li> -->
<!-- </ul> -->
<!-- </template> -->
<!-- <template id="object"> -->
<!-- <h1><t t-esc="object.display_name"/></h1> -->
<!-- <dl> -->
<!-- <t t-foreach="object._fields" t-as="field"> -->
<!-- <dt><t t-esc="field"/></dt> -->
<!-- <dd><t t-esc="object[field]"/></dd> -->
<!-- </t> -->
<!-- </dl> -->
<!-- </template> -->
</data>
</odoo>
\ No newline at end of file \ No newline at end of file
<odoo>
<data>
<!-- explicit list view definition -->
<!--
<record model="ir.ui.view" id="my_module.list">
<field name="name">my_module list</field>
<field name="model">my_module.my_module</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="value"/>
<field name="value2"/>
</tree>
</field>
</record>
-->
<!-- actions opening views on models -->
<!--
<record model="ir.actions.act_window" id="my_module.action_window">
<field name="name">my_module window</field>
<field name="res_model">my_module.my_module</field>
<field name="view_mode">tree,form</field>
</record>
-->
<!-- server action to the one above -->
<!--
<record model="ir.actions.server" id="my_module.action_server">
<field name="name">my_module server</field>
<field name="model_id" ref="model_my_module_my_module"/>
<field name="state">code</field>
<field name="code">
action = {
"type": "ir.actions.act_window",
"view_mode": "tree,form",
"res_model": self._name,
}
</field>
</record>
-->
<!-- Top menu item -->
<!--
<menuitem name="my_module" id="my_module.menu_root"/>
-->
<!-- menu categories -->
<!--
<menuitem name="Menu 1" id="my_module.menu_1" parent="my_module.menu_root"/>
<menuitem name="Menu 2" id="my_module.menu_2" parent="my_module.menu_root"/>
-->
<!-- actions -->
<!--
<menuitem name="List" id="my_module.menu_1_list" parent="my_module.menu_1"
action="my_module.action_window"/>
<menuitem name="Server to list" id="my_module" parent="my_module.menu_2"
action="my_module.action_server"/>
-->
</data>
</odoo>
\ No newline at end of file \ No newline at end of file
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!