validar_nd.py 1.1 KB
# -*- coding: utf-8 -*-
from odoo import models, fields, api
from odoo.exceptions import UserError

class vnt_validar_nd(models.TransientModel):
    _name = 'vnt.validar_nd'
    _description = 'Validar Notas de Débito'

    vnd_notas = fields.Many2many(
        string=u"Nota Débito",
        comodel_name='asw.comprobante',
    )

    vnd_total = fields.Float(
        string="Total",
    )

    vnd_cliente = fields.Many2one(
        string='Cliente',
        comodel_name='asw.cliente',
    )

    vnd_cobro = fields.Many2one(
        string='Cobro',
        comodel_name='vnt.cobros',
    )

    #metodo para abrir wizard pago
    def cobrar_todo(self):
        datos = {'pcw_cliente': self.vnd_cliente.id,
        'pcw_totalcobrar': self.vnd_total,
        'pcw_cobro_deu': self.vnd_cobro.id}
        wizard = self.env['asw.pago_cliente_wizzard'].create(datos)
        
        return {
            'type': 'ir.actions.act_window',
            'res_model': 'asw.pago_cliente_wizzard',
            'view_mode': 'form',
            'view_type': 'form',
            'res_id': wizard.id,
            'target': 'new',
        }