Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
Daniel Santibáñez Polanco
l10n_cl_dte_exportacion
Commits
5349ee1f
Commit
5349ee1f
authored
Feb 03, 2018
by
Daniel Santibáñez Polanco
Browse files
Agrego bultos como one2many
parent
566e34ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
22 deletions
+58
-22
models/invoice_exportacion.py
models/invoice_exportacion.py
+41
-18
views/invoice_exportacion.xml
views/invoice_exportacion.xml
+17
-4
No files found.
models/invoice_exportacion.py
View file @
5349ee1f
...
...
@@ -4,6 +4,15 @@ from openerp import fields, models, api, _
class
Exportacion
(
models
.
Model
):
_name
=
"account.invoice.exportacion"
@
api
.
depends
(
'bultos'
)
@
api
.
onchange
(
'bultos'
)
def
total_bultos
(
self
):
for
r
in
self
:
tot_bultos
=
0
for
b
in
r
.
bultos
:
tot_bultos
+=
b
.
cantidad_bultos
r
.
total_bultos
=
tot_bultos
pais_destino
=
fields
.
Many2one
(
'aduanas.paises'
,
string
=
'País de Destino'
,
...
...
@@ -12,23 +21,23 @@ class Exportacion(models.Model):
'aduanas.puertos'
,
string
=
'Puerto Embarque'
,
)
puerto_des
tino
=
fields
.
Many2one
(
puerto_des
embarque
=
fields
.
Many2one
(
'aduanas.puertos'
,
string
=
'Puerto de Destino'
,
)
total_bultos
=
fields
.
Float
(
string
=
"Total Bultos"
,
)
tipo_bulto
=
fields
.
Many2one
(
'aduanas.tipos_bulto'
,
string
=
'Tipo de Bulto'
,
string
=
'Puerto de Desembarque'
,
)
total_items
=
fields
.
Float
(
total_items
=
fields
.
Integer
(
string
=
"Total Items"
,
)
cantidad_bultos
=
fields
.
Float
(
string
=
"Cantidad de Bultos"
,
)
total_bultos
=
fields
.
Integer
(
string
=
"Total Bultos"
,
compute
=
'total_bultos'
,
store
=
True
,
)
bultos
=
fields
.
One2many
(
string
=
"Bultos"
,
comodel_name
=
"account.invoice.exportacion.bultos"
,
inverse_name
=
"exportacion_id"
,
)
via
=
fields
.
Many2one
(
'aduanas.tipos_transporte'
,
string
=
'Vía'
,
...
...
@@ -37,25 +46,25 @@ class Exportacion(models.Model):
'delivery.carrier'
,
string
=
"Transporte"
,
)
tara
=
fields
.
Float
(
tara
=
fields
.
Integer
(
string
=
"Tara"
,
)
uom_tara
=
fields
.
Many2one
(
'
aduanas.unidades_medida
'
,
'
product.uom
'
,
string
=
'Unidad Medida Tara'
,
)
peso_bruto
=
fields
.
Float
(
string
=
"Peso Bruto"
,
)
uom_peso_bruto
=
fields
.
Many2one
(
'
aduanas.unidades_medida
'
,
'
product.uom
'
,
string
=
'Unidad Medida Peso Bruto'
,
)
peso_neto
=
fields
.
Float
(
string
=
"Peso Neto"
,
)
uom_peso_neto
=
fields
.
Many2one
(
'
aduanas.unidades_medida
'
,
'
product.uom
'
,
string
=
'Unidad Medida Peso Neto'
,
)
monto_flete
=
fields
.
Monetary
(
...
...
@@ -79,7 +88,7 @@ class Exportacion(models.Model):
)
currency_id
=
fields
.
Many2one
(
'res.currency'
,
related
=
'invoice_id'
,
related
=
'invoice_id
.currency_id
'
,
string
=
'Moneda'
)
...
...
@@ -92,3 +101,17 @@ class Exportacion(models.Model):
def
set_recepcion
(
self
):
if
not
self
.
pais_recepcion
:
self
.
pais_recepcion
=
self
.
pais_destino
class
Bultos
(
models
.
Model
):
_name
=
'account.invoice.exportacion.bultos'
tipo_bulto
=
fields
.
Many2one
(
'aduanas.tipos_bulto'
,
string
=
'Tipo de Bulto'
,
)
cantidad_bultos
=
fields
.
Integer
(
string
=
"Cantidad de Bultos"
,
)
exportacion_id
=
fields
.
Many2one
(
'account.invoice.exportacion'
,
)
views/invoice_exportacion.xml
View file @
5349ee1f
...
...
@@ -9,7 +9,7 @@
<group>
<field
name=
"pais_destino"
/>
<field
name=
"puerto_embarque"
/>
<field
name=
"puerto_des
tino
"
/>
<field
name=
"puerto_des
embarque
"
/>
<field
name=
"via"
/>
<field
name=
"carrier_id"
/>
<field
name=
"tara"
/>
...
...
@@ -19,9 +19,7 @@
<field
name=
"peso_neto"
/>
<field
name=
"uom_peso_neto"
/>
<field
name=
"total_items"
/>
<field
name=
"total_bultos"
/>
<field
name=
"tipo_bulto"
/>
<field
name=
"cantidad_bultos"
/>
<field
name=
"total_bultos"
invisible=
"1"
/>
<field
name=
"monto_flete"
/>
<field
name=
"monto_seguro"
/>
<field
name=
"pais_recepcion"
/>
...
...
@@ -31,4 +29,19 @@
</form>
</field>
</record>
<record
id=
"bultos_view_form"
model=
"ir.ui.view"
>
<field
name=
"name"
>
bultos.form
</field>
<field
name=
"model"
>
account.invoice.exportacion.bultos
</field>
<field
name=
"arch"
type=
"xml"
>
<form
string=
"Bultos"
>
<sheet>
<group>
<field
name=
"tipo_bulto"
/>
<field
name=
"cantidad_bultos"
/>
</group>
</sheet>
</form>
</field>
</record>
</odoo>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment