Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Maria Agustina
/
tpv_correcciones
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
1
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit ad0e7c7d
authored
2022-05-14 19:02:41 -0300
by
Juan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
base funcional
1 parent
26c1ccbb
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
132 additions
and
42 deletions
__manifest__.py
models/cobrotpv.py
views/cobrotpv.xml
wizard/__init__.py
wizard/bitacora.py
wizard/bitacora.xml
wizard/cobro_discriminado.py
__manifest__.py
View file @
ad0e7c7
...
...
@@ -50,6 +50,7 @@
'views/pago_discriminado.xml'
,
'wizard/vista_cobro_discriminado.xml'
,
'wizard/vista_pago_discriminado.xml'
,
'wizard/bitacora.xml'
,
'views/cobrotpv.xml'
,
'views/menu_compras.xml'
,
],
...
...
models/cobrotpv.py
View file @
ad0e7c7
...
...
@@ -12,6 +12,7 @@ class hgt_cobro_multiple(models.Model):
_name
=
'hgt.cobro_registro'
_description
=
'Cobro multiple avanzado'
_inherit
=
[
'asw.action.manager'
]
_order
=
"id desc"
# Informacion pago
pcw_cliente
=
fields
.
Many2one
(
...
...
@@ -29,7 +30,10 @@ class hgt_cobro_multiple(models.Model):
string
=
'Caja Cheques'
,
)
nota
=
fields
.
Text
(
string
=
'nota'
,
readonly
=
True
)
nota
=
fields
.
Text
(
string
=
'nota'
,
readonly
=
True
,
compute
=
"_compute_cliente"
,
store
=
True
)
pcw_referencia
=
fields
.
Char
(
string
=
u'Referencia'
,
...
...
@@ -159,31 +163,22 @@ class hgt_cobro_multiple(models.Model):
###########################################Validaciones y calculos ######################################
@api.depends
(
'pcw_total'
)
@api.depends
(
'pcw_total'
,
'pcw_cliente'
,
'pcw_comprobante'
)
def
_compute_cliente
(
self
):
if
not
len
(
self
.
pcw_cliente
)
==
0
:
return
(
None
)
context
=
self
.
env
.
context
active_ids
=
context
.
get
(
'active_ids'
)
facturas
=
self
.
env
[
'asw.comprobante'
]
.
search
([(
'id'
,
'in'
,
active_ids
)])
facturas
=
self
.
pcw_comprobante
idc
=
[]
Texto
=
"Facturas que se
abonara
n:"
Texto
=
"Facturas que se
seleccionaro
n:"
Total
=
0
for
factura
in
facturas
:
if
not
factura
.
comp_cliente
.
id
in
idc
:
idc
.
append
(
factura
.
comp_cliente
.
id
)
if
not
factura
.
comp_adeudado
>
0
:
raise
UserError
(
f
"Factura {factura.display_name} ya esta pagada o valor nulo"
)
if
factura
.
comp_estado
in
[
"b"
,
"c"
]:
raise
UserError
(
f
"Factura {factura.display_name} en estado invalido para cobrar"
)
#if (factura.comp_talonario.tal_tipo == "e"):
# raise UserError(f"El comprobante {factura.display_name} no es de venta")
Total
=
Total
+
factura
.
comp_adeudado
Texto
=
f
"{Texto}
\n
{factura.display_name} {factura.comp_adeudado}"
if
not
len
(
idc
)
==
1
:
raise
UserError
(
"Solo se puede cobrar a un cliente a la vez, cierre la ventana y seleccione de vuelta los comprobantes a operar"
)
#
if not len(idc) == 1:
#
raise UserError("Solo se puede cobrar a un cliente a la vez, cierre la ventana y seleccione de vuelta los comprobantes a operar")
Texto
=
f
"{Texto}
\n
Total {Total}"
.
replace
(
"."
,
self
.
PuntoDecimal
())
self
.
pcw_cliente
=
idc
[
0
]
Texto
=
f
"{Texto}
\n
Puede que se afecten mas facturas que las seleccionadas"
#self.pcw_cliente = idc[0]
self
.
nota
=
Texto
...
...
@@ -210,9 +205,7 @@ class hgt_cobro_multiple(models.Model):
@api.multi
def
pago_facturas_masivo
(
self
):
context
=
self
.
env
.
context
active_ids
=
context
.
get
(
'active_ids'
)
facturas
=
self
.
env
[
'asw.comprobante'
]
.
search
([(
'id'
,
'in'
,
active_ids
)],
order
=
"id asc"
)
facturas
=
self
.
pcw_comprobante
#self.env['asw.comprobante'].search([('id', 'in', active_ids)],order="id asc")
if
len
(
facturas
)
==
0
:
#no hay facturas seleccionadas
raise
Warning
(
"No se seleccionaron facturas"
)
resivo
=
self
.
CrearValidarResivoMultiple
()
...
...
@@ -245,8 +238,8 @@ class hgt_cobro_multiple(models.Model):
@api.multi
def
generar_recibo
(
self
):
print
(
self
.
_fields
)
raise
Warning
(
"Desarrollo"
)
#
print(self._fields)
#
raise Warning("Desarrollo")
resivo
=
self
.
pago_facturas_masivo
()
self
.
ValoresEnCajas
(
resivo
)
return
{
...
...
@@ -391,4 +384,25 @@ class hgt_cobro_multiple(models.Model):
'type'
:
'ir.actions.act_url'
,
'url'
:
f
"""https://hgt.hgt.com.ar/markdown_read?debug=1&id=10&tipo=publicado"""
,
'target'
:
'new'
,
}
\ No newline at end of file
}
def
Cancelar
(
self
):
self
.
estado
=
"c"
self
.
pcw_recibo
.
cancelar
()
#Aca ba el codigo de cancelacion del resivo
def
Bitacorear
(
self
):
instancia
=
self
.
env
[
'tpv.correccion_bitacora'
]
nwizard
=
instancia
.
create
({
'modelo_id'
:
self
.
id
,
'modelo'
:
"hgt.cobro_registro"
})
#self.agregar = True
#self.MarcarRedis()
return
{
'name'
:
"Agregar Linea a la bitacora"
,
'type'
:
'ir.actions.act_window'
,
'res_model'
:
'tpv.correccion_bitacora'
,
'view_mode'
:
'form'
,
'view_type'
:
'form'
,
'res_id'
:
nwizard
.
id
,
'target'
:
'new'
,
}
\ No newline at end of file
views/cobrotpv.xml
View file @
ad0e7c7
...
...
@@ -29,8 +29,11 @@
<field
name=
"arch"
type=
"xml"
>
<form>
<header>
<button
name=
"generar_recibo"
class=
"btn btn-success"
string=
"Generar Recivo"
type=
"object"
/>
<button
name=
"Cancelar"
class=
"btn btn-danger"
string=
"Cancelar"
type=
"object"
/>
<button
name=
"generar_recibo"
class=
"btn btn-success"
string=
"Generar Recivo"
type=
"object"
attrs=
"{ 'invisible':[('estado', 'in', ['a','c'])]}"
/>
<button
name=
"Cancelar"
class=
"btn btn-danger"
string=
"Cancelar"
type=
"object"
attrs=
"{ 'invisible':[('estado', '=', 'c')]}"
confirm=
"Se cancelara la operacion, tambien los recibos generados, estas segura"
/>
<button
name=
"Bitacorear"
class=
"btn btn-warning"
string=
"Agregar a Bitacora"
type=
"object"
/>
<field
name=
"estado"
widget=
"statusbar"
readonly=
"1"
/>
</header>
...
...
@@ -40,28 +43,30 @@
<field
name=
"pcw_cli_razon_social"
invisible=
'1'
/>
<group
col=
"2"
>
<group
col=
"2"
>
<field
name=
"pcw_cliente"
colspan=
'2'
domain=
"[('cli_es_cliente','=', True )]"
/>
<field
name=
"pcw_referencia"
/>
<field
name=
"pcw_recibo"
/>
</group>
<group
string=
"Detalles"
>
<field
name=
"nota"
nolabel=
"1"
/>
<field
name=
"bitacora"
nolabel=
"1"
/>
<field
name=
"pcw_cliente"
colspan=
'2'
domain=
"[('cli_es_cliente','=', True )]"
attrs=
"{'readonly':[('estado','!=','b')]}"
/>
<field
name=
"pcw_referencia"
attrs=
"{'readonly':[('estado','in',['a','c'])]}"
/>
<field
name=
"pcw_recibo"
attrs=
"{'readonly':[('estado','!=','b')]}"
/>
</group>
<group
string=
"Detalles"
col=
"2"
>
<field
name=
"nota"
nolabel=
"1"
colspan=
'2'
/>
<field
name=
"bitacora"
nolabel=
"1"
colspan=
'2'
/>
</group>
</group>
<group
col=
"4"
string=
"Detalles de valores"
>
<group
col=
"4"
string=
"Detalles de valores"
>
<!-- <field name="pcw_retencion_recibida" colspan="2"/>-->
<notebook
colspan=
"4"
>
<page
string=
"Efectivo"
>
<group
col=
"4"
>
<field
name=
"pcw_efectivo"
colspan=
'2'
/>
<field
name=
"caja_efectivo"
/>
<field
name=
"pcw_efectivo"
colspan=
'2'
attrs=
"{'readonly':[('estado','in',['a','c'])]}"
/>
<field
name=
"caja_efectivo"
attrs=
"{'readonly':[('estado','in',['a','c'])]}"
/>
</group>
</page>
<page
string=
"Cheques Recibidos"
>
<group
col=
"4"
>
<field
name=
"caja_cheque"
colspan=
'4'
/>
<field
name=
"pcw_chq_resiv2"
colspan=
'4'
nolabel=
'1'
widget=
'one2many'
context=
"{'default_val_razon_social' : pcw_cli_razon_social}"
>
<field
name=
"caja_cheque"
colspan=
'4'
attrs=
"{'readonly':[('estado','in',['a','c'])]}"
/>
<field
name=
"pcw_chq_resiv2"
colspan=
'4'
nolabel=
'1'
widget=
'one2many'
context=
"{'default_val_razon_social' : pcw_cli_razon_social}"
attrs=
"{'readonly':[('estado','in',['a','c'])]}"
>
<tree
create=
"1"
delete=
"1"
edit=
"1"
editable=
"bottom"
>
<field
name=
"che_banco"
/>
<field
name=
"che_nro_cheque"
/>
...
...
@@ -77,7 +82,7 @@
</page>
<page
string=
"Transferencias Recibidas"
>
<group
col=
"4"
>
<field
name=
"pcw_transferencias_recibidas"
colspan=
'4'
nolabel=
'1'
widget=
'one2many'
>
<field
name=
"pcw_transferencias_recibidas"
colspan=
'4'
nolabel=
'1'
widget=
'one2many'
attrs=
"{'readonly':[('estado','in',['a','c'])]}"
>
<tree
create=
"1"
delete=
"1"
edit=
"1"
editable=
"bottom"
>
<field
name=
"val_cuenta_bancaria"
/>
<field
name=
"val_fecha_emision"
/>
...
...
@@ -104,7 +109,7 @@
-->
<page
string=
"Retenciones"
>
<group
col=
"4"
>
<field
name=
"pcw_retenciones"
colspan=
'4'
nolabel=
'1'
widget=
'one2many'
>
<field
name=
"pcw_retenciones"
colspan=
'4'
nolabel=
'1'
widget=
'one2many'
attrs=
"{'readonly':[('estado','in',['a','c'])]}"
>
<tree
create=
"1"
delete=
"1"
edit=
"1"
editable=
"bottom"
>
<field
name=
"val_tipo"
domain=
"[('tv_tipo','=', 'rr' )]"
string=
'Retencion'
options=
"{'no_create': True, 'no_create_edit':True}"
/>
<field
name=
"val_nro_pago"
/>
...
...
@@ -120,11 +125,15 @@
</group>
<group
id=
'total'
col=
'6'
>
<field
name=
"pcw_total"
colspan=
'2'
/>
<field
name=
"pcw_total"
colspan=
'2'
attrs=
"{'readonly':[('estado','in',['a','c'])]}"
/>
</group>
<group
col=
"4"
string=
"Facturas asociadas"
>
<field
name=
"pcw_comprobante"
colspan=
'4'
nolabel=
'1'
/>
<button
name=
"TraerFacturas"
attrs=
"{ 'invisible':[('estado', 'in', ['a','c','r'])]}"
class=
"btn btn-info"
string=
"Traer Facturas adeudadas"
type=
"object"
/>
<group
col=
"4"
colspan=
"4"
>
<field
name=
"pcw_comprobante"
colspan=
'4'
nolabel=
'1'
attrs=
"{'readonly':[('estado','in',['a','c'])]}"
/>
</group>
</group>
<footer>
...
...
wizard/__init__.py
View file @
ad0e7c7
...
...
@@ -3,4 +3,5 @@ from . import corregir_nro_tal
from
.
import
generar_nota
from
.
import
cobro_discriminado
from
.
import
pago_discriminado
from
.
import
bitacora
wizard/bitacora.py
0 → 100644
View file @
ad0e7c7
from
odoo
import
models
,
fields
,
api
from
odoo.exceptions
import
UserError
,
ValidationError
,
Warning
,
RedirectWarning
from
datetime
import
datetime
,
timedelta
class
hgt_nuevo_correo
(
models
.
TransientModel
):
_name
=
'tpv.correccion_bitacora'
_description
=
'Carga de datos extras'
#################Campos del buscador#########################
texto
=
fields
.
Text
(
string
=
'Texto'
)
modelo
=
fields
.
Char
(
string
=
'Modelo'
,
required
=
True
)
modelo_id
=
fields
.
Integer
(
string
=
'Id'
)
#########################Botones#############################
def
Agregar
(
self
):
if
self
.
texto
==
False
or
self
.
texto
==
""
:
raise
Warning
(
"No se registro nada"
)
reg
=
self
.
env
[
self
.
modelo
]
.
browse
(
self
.
modelo_id
)
orig
=
reg
.
bitacora
Texto
=
"""{} - {}: {}
\n
{}"""
.
format
(
self
.
env
.
user
.
display_name
,
(
datetime
.
now
()
-
timedelta
(
hours
=
3
))
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M'
),
self
.
texto
,
orig
)
reg
.
bitacora
=
Texto
\ No newline at end of file
wizard/bitacora.xml
0 → 100644
View file @
ad0e7c7
<?xml version='1.0' encoding='utf-8'?>
<odoo>
<data
noupdate=
"0"
>
<record
id=
"nodo_bitacora_wizzard_view_form"
model=
"ir.ui.view"
>
<field
name=
"name"
>
Bitacora
</field>
<field
name=
"model"
>
tpv.correccion_bitacora
</field>
<field
name=
"arch"
type=
"xml"
>
<form>
<group
col=
"1"
>
<field
name=
"texto"
nolabel=
"1"
/>
</group>
<footer>
<button
name=
"Agregar"
class=
"btn btn-success"
string=
"Agregar Texto"
type=
"object"
/>
<button
special=
'cancel'
string=
"Cancelar"
/>
</footer>
</form>
</field>
</record>
<!-- asw.prod_pfinal action window -->
<record
id=
"nodo_bitacora_wizzard_action"
model=
"ir.actions.act_window"
>
<field
name=
"name"
>
Bitacora
</field>
<field
name=
"type"
>
ir.actions.act_window
</field>
<field
name=
"res_model"
>
tpv.correccion_bitacora
</field>
<field
name=
"src_model"
>
tpv.correccion_bitacora
</field>
<field
name=
"view_mode"
>
form
</field>
<field
name=
"target"
>
new
</field>
<field
name=
"multi"
>
True
</field>
</record>
</data>
</odoo>
\ No newline at end of file
wizard/cobro_discriminado.py
View file @
ad0e7c7
...
...
@@ -231,6 +231,7 @@ class hgt_cobro_multiple(models.TransientModel):
#print(vals)
#raise Warning("Pruebas desarrollo")
registro
=
self
.
env
[
"hgt.cobro_registro"
]
.
create
(
vals
)
#registro._compute_cliente()
return
{
'view_type'
:
'form'
,
'view_mode'
:
'form'
,
...
...
@@ -325,7 +326,7 @@ class hgt_cobro_multiple(models.TransientModel):
})
cta_cte
.
afectar
(
factura
.
id
)
resivo
.
generar_monto_adeudado
()
print
()
#
print()
def
CrearValidarResivoMultiple
(
self
,
tipo
=
"e"
):
...
...
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