Odoo Hilfe

0

0
1 Answer
0
Avatar

Niyas Raphy

--Niyas Raphy--
24539
| 7 7 11
Wayanad, Indien
--Niyas Raphy--

Odoo Techno Functionalist

Feel free to connect :  niyasraphyk@gmail.com

Twitter:https://twitter.com/niyasraphy
LinkedIn: https://www.linkedin.com/in/niyasraphy/
FB:https://www.facebook.com/niyasraphy123

Happy to help :)

Niyas Raphy
09.05.19, 12:04

Hi,

Not sure with your logic, you can correct as per your use case, define the field as a compute field, then

    cost = fields.Float( string="Cost", compute='_get_cost')


Then define the compute function,

  def _get_cost(self):

        cost_rec = self.env[ 'course'].search([], limit=1)

        if cost_rec:

                self.cost = cost_rec.cost


the above code will search for the records in the model named course and return a single record. As per the logic you can add search condition in it.


Thanks

Fragen Sie
Writer
Keep Informed
1 Verfolger
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now