I have the list_price of the product.template model and the amount field of the account.tax.template model.
I want to use those two fields in one view: product.template.product.form
How could I do it?
Thats my code:
from odoo import fields, models, api, tools
class ProductTemplate(models.Model):
_name = 'product.template'
_inherit = 'product.template'
pventa_iva = fields.Float('PVP (IVA)')
pcompra_iva = fields.Float('COSTE (IVA)')
ratio = fields.Float('Ratio')
iva = fields.Integer('datos iva', compute='_venta_iva')
total = fields.Float(compute='_compute_total')
impuestos = fields.Float(compute='_compute_impuestos')
@api.depends('taxes_id')
def _venta_iva(self):
for record in self:
record.iva = record.taxes_id
@api.depends('list_price', 'iva')
def _compute_total(self):
for record in self:
record.total = record.list_price * record.iva\
@api.multi
def _compute_impuestos(self):
res = self.env['account.tax'].browse('amount')
return res