Odoo 10: call a method with the new api from server action
I have inherited pos.order model adding some extra fields and my definitions via custom module:
_inherit = "pos.order"
profit = fields.Float('Lucro', store=True, index=True, digits=(5,2))
costs = fields.Float('Custos', store=True, index=True, digits=(5,2))
### do stuff ###
Odoo has his personal way to interact with fields trough definition, and I'm seeing a lack of good docs to archive that. Perhaps is better stay with my daemon, but I'm curious to know how people are managing the conversion.
For now, all I got were a series of errors, the most common are
ValueError: <type 'exceptions.AttributeError'>: "'pos.order' object has no attribute 'cost_elab'"
if I call my def with env['pos.order'].cost_elab()
NameError: name 'self' is not defined
if I use self.env['pos.order'].cost_elab()