Commit fe2c0e9a by Maria Agustina

737 terminada

1 parent e59c1f70
# -*- coding: utf-8 -*-
from . import models
\ No newline at end of file
from . import models
from . import wizard
\ No newline at end of file
......@@ -26,6 +26,7 @@
# always loaded
'data': [
# 'security/ir.model.access.csv',
'wizard/vista_prod_pfinal.xml',
'views/referencias.xml',
'views/comprobante.xml',
],
......
......@@ -26,4 +26,17 @@ class asw_comprobante(models.Model):
if first_line and first_line.name:
self.name_ref = first_line.name
#metodo para llamar wizard producto por precio final
def abrir_wizard_ppf(self):
nwizard = self.env['asw.prod_pfinal'].create({'ppf_comprobante': self.id})
return {
'name': "Carga Producto Precio Final",
'type': 'ir.actions.act_window',
'res_model': 'asw.prod_pfinal',
'view_mode': 'form',
'view_type': 'form',
'res_id': nwizard.id,
'target': 'new',
}
......@@ -6,6 +6,9 @@
<field name="inherit_id" ref="asw_tpv.view_form_comprobante_recibido_ui"/>
<field name="arch" type="xml">
<data>
<xpath expr="//button[@name='validar']" position="before">
<button name="abrir_wizard_ppf" class='btn btn-primary' string="+ Producto por precio final" type="object" attrs="{'invisible':[('comp_estado','!=','b')]}"/>
</xpath>
<xpath expr="//group[1]" position="after">
<group string="Referencias" col="4">
<field name="referencia_corr" nolabel="1" widget="many2many_tags" />
......@@ -21,6 +24,9 @@
<field name="inherit_id" ref="asw_tpv.view_form_comprobante_ui"/>
<field name="arch" type="xml">
<data>
<xpath expr="//button[@name='imprimir']" position="before">
<button name="abrir_wizard_ppf" class='btn btn-primary' string="+ Producto por precio final" type="object" attrs="{'invisible':[('comp_estado','!=','b')]}"/>
</xpath>
<xpath expr="//group[1]" position="after">
<group string="Referencias" col="4">
<field name="referencia_corr" nolabel="1" widget="many2many_tags" />
......
from . import prod_pfinal
No preview for this file type
No preview for this file type
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class asw_prod_pfinal(models.TransientModel):
_name = 'asw.prod_pfinal'
_description = 'Producto Precio Final'
ppf_producto = fields.Many2one(
string=u'Producto',
comodel_name='asw.producto',
ondelete='set null',
)
ppf_descripcion_producto = fields.Text(
string='Descripcion',
)
ppf_comprobante = fields.Many2one(
string=u'Comprobante',
comodel_name='asw.comprobante',
ondelete='cascade',
)
ppf_cantidad = fields.Float(
string=u'Cantidad',
default=1,
)
ppf_precio= fields.Monetary(
string=u'Precio',
currency_field='ppf_moneda',
store=True
)
ppf_moneda = fields.Many2one(
string=u'Moneda del Producto',
comodel_name='res.currency',
ondelete='set null',
default=lambda self: self.env.user.company_id.currency_id,
)
#metodo para obtener el dominio de prods
def get_domain_producto(self):
domain = []
if(self.ppf_comprobante.comp_tipo_comp == 'e'):
return [('pro_puede_ser_vendido','=', True)]
if(self.ppf_comprobante.comp_tipo_comp == 'r'):
return [('pro_puede_ser_comprado','=', True)]
return domain
#metodo de creacion de linea de factura y su asociacion al comprobante en curso
def crear_linea(self):
vals = {
'lcp_producto' : self.ppf_producto.id,
'lcp_descripcion_producto' : self.ppf_descripcion_producto,
'lcp_comprobante': self.ppf_comprobante.id,
'lcp_cantidad': self.ppf_cantidad,
'lcp_precio': self.ppf_precio,
'lcp_moneda': self.ppf_moneda.id,
}
nva_lineaf = self.env['asw.linea_comprobante'].create(vals)
\ No newline at end of file
<?xml version='1.0' encoding='utf-8'?>
<odoo>
<data noupdate="0">
<record id="asw_prod_pfinal_wizzard_view_form" model="ir.ui.view">
<field name="name">asw.prod_pfinal.view.form</field>
<field name="model">asw.prod_pfinal</field>
<field name="arch" type="xml">
<form>
<group col='4'>
<field name="ppf_producto"/>
<field name="ppf_descripcion_producto"/>
<field name="ppf_cantidad"/>
<field name="ppf_precio"/>
</group>
<footer>
<button name="crear_linea" type="object" string="Agregar" class="oe_highlight"/>
<button special='cancel' string="Cancelar"/>
</footer>
</form>
</field>
</record>
<!-- asw.prod_pfinal action window -->
<record id="asw_prod_pfinal_wizzard_action" model="ir.actions.act_window">
<field name="name">Agregar Producto Precio final</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">asw.prod_pfinal</field>
<field name="src_model">asw.prod_pfinal</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
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!