I'm using field.Integer() and I think my question is very easy for an Odoo experts
How to get xml from website to field.integer() in Python ?
I tried this code below but when I change the value in the form, the compute result is not changing. I don't understand where is my mistake.
Regards,
model.py:
name = fields.Char()
biography = fields.Html()
nbr1 = fields.Integer()
result = fields.Integer(compute="_compute_total")
@api.onchange('nbr1')
def _compute_total(self):
for record in self:
record.result = 2*self.nbr1
template.xml:
<h3 t-field="person.name"/>
<p>Last modified: <i t-field="person.write_date"/></p>
<div t-field="person.biography"/>
<p>
<label>nbr1</label> : <input type="number" t-attf-href="person.nbr1" name="nbr1"/>
<a t-attf-href="perso">
<t t-esc="person.nbr1"/></a>
</p>
<h3 t-field="person.nbr1"/>
<h3 t-field="person.result"/>
Aucun commentaire:
Enregistrer un commentaire