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 8b63cdeb
authored
2021-12-24 12:27:54 -0300
by
Juan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
retomamos trabajo
1 parent
45fda01b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
5 deletions
wizard/cobro_discriminado.py
wizard/vista_cobro_discriminado.xml
wizard/cobro_discriminado.py
View file @
8b63cde
...
...
@@ -16,9 +16,13 @@ class hgt_cobro_multiple(models.TransientModel):
# Informacion pago
pcw_cliente
=
fields
.
Many2one
(
comodel_name
=
'asw.cliente'
,
string
=
'Cliente'
string
=
'Cliente'
,
readonly
=
True
,
compute
=
'_compute_cliente'
,
)
nota
=
fields
.
Text
(
string
=
'nota'
,
readonly
=
True
)
pcw_referencia
=
fields
.
Char
(
string
=
u'Referencia'
,
)
...
...
@@ -54,6 +58,7 @@ class hgt_cobro_multiple(models.TransientModel):
column2
=
'asw_cliente_id'
,
string
=
'Cheques Recibidos'
)
pcw_chq_emitidos
=
fields
.
Many2many
(
comodel_name
=
'asw.cheque'
,
relation
=
'pago_cliente_chq_emitido'
,
...
...
@@ -61,6 +66,7 @@ class hgt_cobro_multiple(models.TransientModel):
column2
=
'asw_cliente_id'
,
string
=
'Cheques Emitidos'
)
pcw_transferencias_recibidas
=
fields
.
Many2many
(
comodel_name
=
'asw.valores'
,
relation
=
'pago_cliente_transferencia_recibida'
,
...
...
@@ -68,6 +74,7 @@ class hgt_cobro_multiple(models.TransientModel):
column2
=
'asw_valores_id'
,
string
=
'Transferencias Recibidas'
)
pcw_transferencias_emitidas
=
fields
.
Many2many
(
comodel_name
=
'asw.valores'
,
relation
=
'pago_cliente_transferencia_emitida'
,
...
...
@@ -75,6 +82,7 @@ class hgt_cobro_multiple(models.TransientModel):
column2
=
'asw_valores_id'
,
string
=
'Transferencias Emitidas'
)
pcw_tarjetas
=
fields
.
Many2many
(
comodel_name
=
'asw.valores'
,
relation
=
'pago_cliente_tarjeta'
,
...
...
@@ -83,17 +91,52 @@ class hgt_cobro_multiple(models.TransientModel):
string
=
'Tarjetas'
)
pcw_retenciones
=
fields
.
Many2many
(
comodel_name
=
'asw.valores'
,
relation
=
'pago_cliente_retencion'
,
column1
=
'pago_cliente_id'
,
column2
=
'asw_valores_id'
,
string
=
'Retenciones'
)
# Total de pago
pcw_total
=
fields
.
Monetary
(
string
=
'Total Recibido'
,
compute
=
'_calcular_total'
,
currency_field
=
'cli_moneda_empresa'
)
pcw_recibo
=
fields
.
Many2one
(
string
=
'Recibo'
,
comodel_name
=
'asw.comprobante'
)
@api.depends
(
'pcw_total'
)
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
)])
idc
=
[]
Texto
=
"Facturas que se abonaran:"
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"
)
Texto
=
f
"{Texto}
\n
Total {Total}"
self
.
pcw_cliente
=
idc
[
0
]
self
.
nota
=
Texto
...
...
@@ -107,3 +150,20 @@ class hgt_cobro_multiple(models.TransientModel):
for
factura
in
facturas
:
if
factura
.
comp_adeudado
>
0
:
factura
.
pago_rapido
(
self
.
forma_pago
)
@api.depends
(
'pcw_efectivo'
,
'pcw_che_recibidos'
,
'pcw_transferencias_recibidas'
,
'pcw_tarjetas'
,
'pcw_chq_emitidos'
,
'pcw_transferencias_emitidas'
,
'pcw_retencion_recibida'
,
'pcw_retenciones'
)
def
_calcular_total
(
self
):
total
=
0
for
record
in
self
.
pcw_che_recibidos
:
total
=
total
+
record
.
che_monto
for
record
in
self
.
pcw_transferencias_recibidas
:
total
=
total
+
record
.
val_monto
for
record
in
self
.
pcw_chq_emitidos
:
total
=
total
+
record
.
che_monto
for
record
in
self
.
pcw_transferencias_emitidas
:
total
=
total
+
record
.
val_monto
for
record
in
self
.
pcw_tarjetas
:
total
=
total
+
record
.
val_monto
for
record
in
self
.
pcw_retenciones
:
total
=
total
+
record
.
val_monto
self
.
pcw_total
=
total
+
self
.
pcw_efectivo
+
self
.
pcw_retencion_recibida
\ No newline at end of file
wizard/vista_cobro_discriminado.xml
View file @
8b63cde
...
...
@@ -6,11 +6,18 @@
<field
name=
"arch"
type=
"xml"
>
<form>
<field
name=
"pcw_cli_razon_social"
invisible=
'1'
/>
<group
col=
"4"
>
<field
name=
"pcw_cliente"
colspan=
'4'
domain=
"[('cli_es_cliente','=', True )]"
/>
<field
name=
"pcw_efectivo"
colspan=
'2'
/>
<field
name=
"pcw_retencion_recibida"
colspan=
"2"
/>
<group
col=
"2"
>
<group
col=
"2"
>
<field
name=
"pcw_cliente"
colspan=
'2'
domain=
"[('cli_es_cliente','=', True )]"
/>
<field
name=
"pcw_referencia"
/>
<field
name=
"pcw_efectivo"
colspan=
'2'
/>
</group>
<group
string=
"Detalles"
>
<field
name=
"nota"
nolabel=
"1"
/>
</group>
</group>
<group
col=
"4"
>
<!-- <field name="pcw_retencion_recibida" colspan="2"/>-->
<notebook
colspan=
"4"
>
<page
string=
"Cheques Recibidos"
>
<group
col=
"4"
>
...
...
@@ -51,6 +58,18 @@
</field>
</group>
</page>
<page
string=
"Retenciones"
>
<group
col=
"4"
>
<field
name=
"pcw_retenciones"
colspan=
'4'
nolabel=
'1'
widget=
'one2many'
>
<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"
/>
<field
name=
"val_monto"
required=
'1'
/>
</tree>
</field>
</group>
</page>
</notebook>
<br/>
...
...
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