Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Maria Agustina
/
hgt_transportar
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 543a25f6
authored
2021-11-07 14:54:55 -0300
by
Juan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Genera pre membresia
1 parent
fe7781e0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
6 deletions
__manifest__.py
models/transportista.py
views/transportista_vista.xml
__manifest__.py
View file @
543a25f
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
'depends'
:
[
'depends'
:
[
'base'
,
'base'
,
'asw_geografia'
,
'asw_geografia'
,
'asw_tpv'
],
],
...
...
models/transportista.py
View file @
543a25f
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from
odoo
import
models
,
fields
,
api
,
exceptions
from
odoo
import
models
,
fields
,
api
,
exceptions
from
odoo.exceptions
import
ValidationError
,
Warning
from
datetime
import
datetime
from
datetime
import
datetime
import
base64
,
requests
import
base64
,
requests
vista_previa
=
"""<h2>Vista Previa</h2>
vista_previa
=
"""<h2>Vista Previa</h2>
...
@@ -117,6 +117,37 @@ class trans_transportista(models.Model):
...
@@ -117,6 +117,37 @@ class trans_transportista(models.Model):
muestra
=
fields
.
Html
(
string
=
'Previsualizador'
,
compute
=
"_compute_prev"
,
sanitize
=
False
)
muestra
=
fields
.
Html
(
string
=
'Previsualizador'
,
compute
=
"_compute_prev"
,
sanitize
=
False
)
fac_tipo
=
fields
.
Selection
(
string
=
'Tipo Factura'
,
selection
=
[(
'A'
,
'A'
),
(
'B'
,
'B'
),],
required
=
True
,
default
=
"B"
)
fac_doc
=
fields
.
Char
(
string
=
'Documento Facturacion'
,
default
=
"0"
,
required
=
True
)
fac_documento
=
fields
.
Float
(
string
=
'Documento'
,
size
=
15
,
digits
=
(
15
,
0
)
)
fac_doc_tipo
=
fields
.
Selection
(
string
=
'Tipo documento'
,
selection
=
[(
'cuit'
,
'CUIT'
),
(
'dni'
,
'DNI'
),],
required
=
True
,
default
=
"dni"
)
cli_doc_tipo
=
fields
.
Many2one
(
comodel_name
=
'asw.tipo_documento'
,
string
=
'Tipo Documnto'
)
cli_resp
=
fields
.
Many2one
(
comodel_name
=
'asw.responsabilidad'
,
string
=
'Responsabilidad fiscal'
)
comprobantes
=
fields
.
Many2many
(
comodel_name
=
'asw.comprobante'
,
string
=
'Comprobantes'
)
cliente
=
fields
.
Many2many
(
comodel_name
=
'asw.cliente'
,
string
=
'Cliente'
)
cliente_fac
=
fields
.
Many2one
(
comodel_name
=
'asw.cliente'
,
string
=
'Cliente'
)
cliente_nombre
=
fields
.
Char
(
string
=
'Razon social a facturar'
)
def
_compute_prev
(
self
):
def
_compute_prev
(
self
):
#print(dir(self.trans_logo), self.trans_logo, dir(self.imagen))
#print(dir(self.trans_logo), self.trans_logo, dir(self.imagen))
...
@@ -293,7 +324,42 @@ class trans_transportista(models.Model):
...
@@ -293,7 +324,42 @@ class trans_transportista(models.Model):
raise
exceptions
.
Warning
(
"No se ha cargado imagen para actualizar"
)
raise
exceptions
.
Warning
(
"No se ha cargado imagen para actualizar"
)
def
comprar
(
self
):
def
comprar
(
self
):
pass
self
.
ActualizarCliente
()
#Armar subscripcion
msubs
=
self
.
env
[
'elc.subcripciones'
]
.
sudo
()
.
browse
(
1
)
rta
=
msubs
.
CrearSubscripcionSDK
(
self
.
cliente_fac
.
id
)
return
(
rta
)
def
ActualizarCliente
(
self
):
try
:
from
email_validator
import
validate_email
,
EmailNotValidError
valid
=
validate_email
(
self
.
trans_email
)
except
EmailNotValidError
as
e
:
raise
Warning
(
f
"El mail es obligatorio para el abono, {self.trans_email} no es valido"
)
if
self
.
cliente_nombre
==
False
:
raise
Warning
(
"Defina razon social de facturacion"
)
if
len
(
self
.
cli_doc_tipo
)
==
0
:
raise
Warning
(
"Defina tipo de documento"
)
if
len
(
self
.
cli_resp
)
==
0
:
raise
Warning
(
"Defina responsabilidad"
)
if
self
.
fac_documento
==
"0"
:
raise
Warning
(
"Defina numero de documento o cuit"
)
cliente
=
self
.
env
[
"asw.cliente"
]
.
sudo
()
.
search
([[
"cli_nro_doc"
,
"="
,
int
(
self
.
fac_documento
)]])
vals
=
{}
vals
[
"cli_razon_social"
]
=
self
.
cliente_nombre
vals
[
"cli_celular"
]
=
self
.
trans_telefono
vals
[
"cli_mail"
]
=
self
.
trans_email
vals
[
"cli_tipo_documento"
]
=
self
.
cli_doc_tipo
.
id
vals
[
"cli_es_cliente"
]
=
True
vals
[
"cli_es_proveedor"
]
=
False
vals
[
"cli_responsabilidad"
]
=
self
.
cli_resp
.
id
if
len
(
cliente
)
==
0
:
vals
[
"cli_nro_doc"
]
=
str
(
int
(
self
.
fac_documento
))
cliente
=
self
.
env
[
"asw.cliente"
]
.
sudo
()
.
create
(
vals
)
if
len
(
cliente
)
==
1
:
cliente
.
write
(
vals
)
self
.
cliente_fac
=
cliente
.
id
def
publicar
(
self
):
def
publicar
(
self
):
if
self
.
trans_categoria
==
"np"
:
if
self
.
trans_categoria
==
"np"
:
...
...
views/transportista_vista.xml
View file @
543a25f
...
@@ -24,9 +24,11 @@
...
@@ -24,9 +24,11 @@
<form>
<form>
<header>
<header>
<button
name=
"deduplicar_pr"
class=
'btn btn-warning'
string=
"Quitar puntos de retiro duplicados"
type=
"object"
/>
<button
name=
"deduplicar_pr"
class=
'btn btn-warning'
string=
"Quitar puntos de retiro duplicados"
type=
"object"
/>
<button
name=
"comprar"
class=
'btn btn-info'
string=
"Comprar membresia"
type=
"object"
/>
<button
name=
"comprar"
class=
'btn btn-info'
string=
"Comprar membresia"
type=
"object"
confirm=
"Se le facturara con los datos indicados en la pestaña de facturacion"
attrs=
"{ 'invisible' : [('trans_categoria','!=','np')]}"
/>
</header>
</header>
<sheet>
<!--<sheet> -->
<group
col=
"2"
string=
"Datos generales"
>
<group
col=
"2"
string=
"Datos generales"
>
<field
name=
"trans_nombre"
colspan=
"2"
/>
<field
name=
"trans_nombre"
colspan=
"2"
/>
<field
name=
"trans_razon_social"
colspan=
"2"
required=
"1"
/>
<field
name=
"trans_razon_social"
colspan=
"2"
required=
"1"
/>
...
@@ -71,10 +73,24 @@
...
@@ -71,10 +73,24 @@
</tree>
</tree>
</field>
</field>
</group>
</group>
<group
col=
"2"
string=
"Datos de usuario"
>
<group
col=
"4"
string=
"Datos de cliente y facturacion"
>
<field
name=
"cli_resp"
/>
<field
name=
"fac_documento"
/>
<field
name=
"cli_doc_tipo"
/>
<field
name=
"trans_categoria"
readonly=
"0"
colspan=
"2"
/>
<field
name=
"trans_categoria"
readonly=
"0"
colspan=
"2"
/>
<field
name=
"cliente_fac"
readonly=
"1"
/>
<field
name=
"cliente_nombre"
/>
<field
name=
"trans_email"
widget=
"email"
colspan=
"2"
/>
<button
name=
"ActualizarCliente"
class=
'btn btn-info'
string=
"Actualizar informacion fiscal"
type=
"object"
confirm=
"¿Esta seguro que quiere modificar sus datos de facturacion?"
attrs=
"{ 'invisible' : [('cliente_fac','=',False)]}"
/>
</group>
</group>
</sheet>
<group
col=
"4"
string=
"Facturas"
>
<field
name=
"comprobantes"
readonly=
"1"
colspan=
"4"
nolabel=
"1"
/>
</group>
<!--</sheet> -->
</form>
</form>
</field>
</field>
</record>
</record>
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment