Commit 97f70a68 by Maria Agustina

avance logica

1 parent e53e0a2e
......@@ -8,13 +8,15 @@ class vnt_cobros(models.Model):
co_cliente = fields.Many2one(
string='Cliente',
comodel_name='hgt.instituciones',
comodel_name='asw.cliente',
)
co_lin_deuda = fields.One2many(
string=u"Línea Deuda",
comodel_name='vnt.linea_deuda',
inverse_name='ld_cobros',
compute='_onchange_ld',
inverse='_inverse_onchange_ld',
)
co_resumen = fields.Text(
......@@ -53,6 +55,22 @@ class vnt_cobros(models.Model):
for record in self:
record.co_total = record.co_total_deuda + record.co_total_interes
@api.onchange('co_cliente')
def _onchange_ld(self):
lista = []
#recupero comprobantes de venta, adeudados, con el cliente seleccionado
comp_venta_adeud = self.env['asw.comprobante'].search([('comp_talonario.tal_menu','=','fac'),('comp_tipo_comp','=','e'), ('comp_estado', '=', 'a'), ('comp_cliente', '=', self.co_cliente.id)])
for comp in comp_venta_adeud:
nva_linea = self.env['vnt.linea_deuda'].create({
'ld_factura': comp.id,
})
lista.append(nva_linea.id)
self.co_lin_deuda = lista
def _inverse_onchange_ld(self):
return True
......@@ -8,7 +8,7 @@ class vnt_interes(models.Model):
int_cliente = fields.Many2many(
string=u"Clientes",
comodel_name='hgt.instituciones',
comodel_name='asw.cliente',
relation="interes_clientes",
)
......
......@@ -57,7 +57,6 @@ class vnt_linea_deuda(models.Model):
string='Nota Débito',
comodel_name='asw.comprobante',
ondelete='restrict',
required=True,
)
ld_cobros = fields.Many2one(
......@@ -72,13 +71,13 @@ class vnt_linea_deuda(models.Model):
for record in self:
record.ld_total = record.ld_factura.comp_total
#dominio p elegir solo facturas de venta
@api.onchange('ld_factura')
def onchange_ld_factura(self):
result = {}
result['domain'] = []
comp_venta_em = self.env['asw.comprobante'].search([('comp_talonario.tal_menu','=','fac'),('comp_tipo_comp','=','e')])
result['domain'] = {'ld_factura' : [('id', 'in', comp_venta_em.ids)]}
return result
# #dominio p elegir solo facturas de venta, queda obsoleto pq las lineas se generaran en otra fx
# @api.onchange('ld_factura')
# def onchange_ld_factura(self):
# result = {}
# result['domain'] = []
# comp_venta_em = self.env['asw.comprobante'].search([('comp_talonario.tal_menu','=','fac'),('comp_tipo_comp','=','e')])
# result['domain'] = {'ld_factura' : [('id', 'in', comp_venta_em.ids)]}
# return result
......@@ -46,11 +46,11 @@
<notebook colspan="4">
<page string="Deudas">
<field nolabel="1" name="co_lin_deuda">
<tree create="1" edit="1" editable="1">
<field name="ld_factura" />
<field name="ld_fecha_vto"/>
<field name="ld_estado"/>
<field name="ld_total"/>
<tree create="0" edit="1" editable="1">
<field name="ld_factura" readonly="1" />
<field name="ld_fecha_vto" readonly="1" />
<field name="ld_estado" readonly="1" />
<field name="ld_total" readonly="1"/>
<!-- <field name="ld_fecha_vto" editable="0" readonly="1" />
<field name="ld_estado" editable="0" readonly="1" />
<field name="ld_total" readonly="1" /> -->
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!