Commit 90556b63 by Maria Agustina

ABM tipo de transporte

1 parent f2b5aee5
......@@ -29,6 +29,7 @@
'data': [
'security/ir.model.access.csv',
'views/transportista_vista.xml',
'views/tipo_transporte_vista.xml',
'views/menu_vista.xml',
],
# only loaded in demonstration mode
......
# -*- coding: utf-8 -*-
from . import transportista
from . import tipo_transporte
\ No newline at end of file
# -*- coding: utf-8 -*-
from odoo import models, fields, api, exceptions
class trans_tipo_transporte(models.Model):
_name = 'trans.tipo_transporte'
_description = 'Tipo de transporte'
_rec_name = 'tt_tipo'
_order = 'tt_tipo'
tt_tipo = fields.Char(
string=u'Tipo de transporte',
required=True,
)
tt_capacidad = fields.Float(
string=u'Capacidad de carga',
required=True,
help=u'Ingrese capacidad de carga en toneladas'
)
@api.onchange('tt_tipo')
def hacer_mayuscula(self):
val = str(self.tt_tipo)
self.tt_tipo = val.upper()
@api.one
@api.constrains('tt_capacidad')
def _requerir_capacidad(self):
if self.tt_capacidad == 0.0:
raise exceptions.ValidationError('Por favor ingrese la Capacidad de carga')
......@@ -64,13 +64,13 @@ class trans_transportista(models.Model):
help='Aclarar aqui que elementos no transporta si los hubiera',
)
# trans_tipo = fields.Many2many(
# string=u'Tipo de Transporte',
# comodel_name='trans.tipo_transporte',
# relation='tipo_transporte_transportista_rel',
# column1='trans_tipo_transporte_id',
# column2='trans_transportista_id',
# )
trans_tipo = fields.Many2many(
string=u'Tipo de Transporte',
comodel_name='trans.tipo_transporte',
relation='tipo_transporte_transportista_rel',
column1='trans_tipo_transporte_id',
column2='trans_transportista_id',
)
# trans_pto_retiro = fields.Many2many(
# string=u'Punto de Retiro',
......
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
trans_transportista,access_trans_transportista,model_trans_transportista,,1,0,0,0
\ No newline at end of file
trans_transportista,access_trans_transportista,model_trans_transportista,,1,1,1,0
trans_tipo_transporte,access_trans_tipo_transporte,model_trans_tipo_transporte,,1,1,1,0
\ No newline at end of file
......@@ -12,6 +12,9 @@
<menuitem name="Transportistas" id="hgt_transportar_transportistas_transportistas" parent="hgt_transportar_transportistas"
action="hgt_transportar.trans_transportista_action_window"/>
<menuitem name="Tipos de transporte" id="hgt_transportar_transportistas_tipo_transporte" parent="hgt_transportar_transportistas"
action="hgt_transportar.trans_tipo_transporte_action_window"/>
</data>
</odoo>
......
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data noupdate="0">
<!-- explicit list view definition -->
<record model="ir.ui.view" id="hgt_transportar.trans_tipo_transporte_list">
<field name="name">Tipo de Transporte</field>
<field name="model">trans.tipo_transporte</field>
<field name="arch" type="xml">
<tree>
<field name="tt_tipo"/>
<field name="tt_capacidad"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="hgt_transportar.trans_tipo_transporte_form">
<field name="name">Tipo de Transporte</field>
<field name="model">trans.tipo_transporte</field>
<field name="arch" type="xml">
<form>
<header>
</header>
<sheet>
<group col="2" string="Datos del transporte">
<field name="tt_tipo"/>
<field name="tt_capacidad"/>
</group>
</sheet>
</form>
</field>
</record>
<record model="ir.ui.view" id="hgt_transportar.trans_tipo_transporte_search">
<field name="name">Tipo de Transporte</field>
<field name="model">trans.tipo_transporte</field>
<field name="arch" type="xml">
<search string="Busqueda de transportista">
<field name="tt_tipo"/>
<field name="tt_capacidad"/>
</search>
</field>
</record>
<!-- actions opening views on models -->
<record model="ir.actions.act_window" id="hgt_transportar.trans_tipo_transporte_action_window">
<field name="name">Tipo de Transporte</field>
<field name="res_model">trans.tipo_transporte</field>
<field name="view_mode">tree,form</field>
</record>
</data>
</odoo>
\ No newline at end of file
......@@ -12,7 +12,7 @@
<field name="trans_razon_social"/>
<field name="trans_tipo_ent"/>
<field name="trans_telefono"/>
<!-- <field name="trans_tipo"/> -->
<field name="trans_tipo"/>
</tree>
</field>
</record>
......@@ -38,7 +38,7 @@
</group>
<group col="2">
<field name="trans_tipo_ent" colspan="2" required="1"/>
<!-- <field name="trans_tipo" colspan="2" /> -->
<field name="trans_tipo" colspan="2" />
<field name="trans_restriccion_elem" colspan="2"/>
<!-- <field name="trans_pto_retiro" colspan="2" /> -->
<field name="trans_posee_ayu" colspan="2"/>
......@@ -60,13 +60,11 @@
<field name="trans_nombre"/>
<field name="trans_razon_social"/>
<field name="trans_tipo_ent"/>
<!-- <field name="trans_tipo"/> -->
<field name="trans_tipo"/>
</search>
</field>
</record>
<!-- actions opening views on models -->
<record model="ir.actions.act_window" id="hgt_transportar.trans_transportista_action_window">
<field name="name">Transportista</field>
......@@ -74,7 +72,6 @@
<field name="view_mode">tree,form</field>
</record>
</data>
</odoo>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!