Skip to Content
Menu
This question has been flagged
1386 Views

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
Avatar
Discard
Related Posts Replies Views Activity
2
Oct 23
4750
2
Nov 22
5163
0
Sep 21
1777
4
Aug 20
6580
2
Mar 20
9692