from odoo import models, fields , api
class product_template(models.Model):
_inherit = 'product.template'
remise = fields.float('remise du fournisseur', size=10, required=True)
marge = fields.float('marge', size=10, required=True)
@api.multi
@api.onchange('standard_price','x_marge1')
def onchange_calculer(self):
for s in self:
s.list_price = s.standard_price * (s.x_marge1/100) + s.standard_price
< my xml view file code
<!-- inherit the product form view -->
<record id="view_product_form" model="ir.ui.view">
<field name="name">product.template.common.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='list_price']" position="after">
<field name="x_remise1"/>
<field name="x_marge1"/>
<field name="list_price"
on_change="onchange_calculer(standard_price, x_marge1)" readonly="True" />
</xpath>
</field>
</record>