29.How To Add Compute Field In Odoo || Compute Field and Function

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ก.พ. 2025
  • How to create compute field in odoo. Steps to create a compute field and write its function in Odoo. Steps to write compute function in odoo. Compute value for a field from function in odoo. Odoo 14 development tutorials, working of a compute field in odoo. Odoo Compute function.
    Odoo 14 Playlist: • 2. How To Create Modul...
    Module: apps.odoo.com/...
    Website: www.odoomates....
    Github: github.com/odo...
    Email : odoomates@gmail.com
    Facebook: / odoomate
    Twitter: / odoomates
    Support Us in Ko Fi : ko-fi.com/odoo...

ความคิดเห็น • 24

  • @1hockieCh
    @1hockieCh ปีที่แล้ว

    Hi, I like your video, it helps me a lot. By the way, I can't make the compute field working without the dependencies field. Im trying it in the User Interface.

  • @huseyinOzdogan83
    @huseyinOzdogan83 3 ปีที่แล้ว +3

    Hello, if we add this appoinment_count on tree view, it give us singleton error, so it seems that we need to specify field i think. How can we resolve singleton error in tree view?

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว

      Hope you get the answer from here: th-cam.com/video/Rv44nFVn_5U/w-d-xo.html

    • @pablocamberoscarvajal1608
      @pablocamberoscarvajal1608 3 ปีที่แล้ว +1

      I'm so glad that this was already asked, and a lot more cause it's actually a video about this already. Thanks so much

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว +1

      @@pablocamberoscarvajal1608 welcome brother

  • @zurabegadze7123
    @zurabegadze7123 3 ปีที่แล้ว +1

    hello, I have one question and i will greately appreciate if you answer me, Does compute field stred in base ??

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว +2

      Compute field is stored in db only if store=True attribute is added along with field definition.

  • @NMNaufaldo
    @NMNaufaldo 3 ปีที่แล้ว +1

    10:36 I try to add `appointment_count` on tree view `view_patient_tree`, but it give me an error
    XML:
    ...
    ...


    Error message:
    ValueError: Expected singleton: hospital.patient(1, 2, 3, 4, 5)

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว

      video no 30 will solve the problem: th-cam.com/video/Rv44nFVn_5U/w-d-xo.html

    • @NMNaufaldo
      @NMNaufaldo 3 ปีที่แล้ว +1

      @@OdooMates Oh yeah thank. After follow your tutorial to iterate the record, the `appointment_count` is shown on tree view, but the output number for `appointment_count` is same. Any help?

    • @NMNaufaldo
      @NMNaufaldo 3 ปีที่แล้ว +1

      I already solve the problem, just need to change `self.appointment_count = appointment_count` to `rec.appointment_count = appointment_count`

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว +1

      @@NMNaufaldo glad that you able to resolve it instantly (y)

  • @NMNaufaldo
    @NMNaufaldo 3 ปีที่แล้ว +1

    I'm curious, is that `appointment_count` field is stored in database?

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว +1

      If store =True is not specified for a computed field, it will.not be saving or creating a field in db

    • @NMNaufaldo
      @NMNaufaldo 3 ปีที่แล้ว

      @@OdooMates Yes you right, I just made a change in computer method, and the old field data also change. This mean the data not stored in database. Do you know if there is a cheatsheet for Odoo? If not, I'm willing to help to make that cheatsheet

  • @SamirSELLAMI
    @SamirSELLAMI 3 ปีที่แล้ว +1

    Thanks Bro for this great video.
    Is it possible to pass filter parameters to the search ORM function from fields values entered in the from view?

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว +1

      Yes possible, sample suppose if we have a field named partner_id in out model and if we need to search sales orders of this partner, we can do as follows: self.env['sale.order'].search([('partner_id",'=', self.partner_id.id)])

    • @SamirSELLAMI
      @SamirSELLAMI 3 ปีที่แล้ว +1

      @@OdooMates this is great. In my case I want to pick up a single field value from another model depending on multiple values entred in a form view of the first model. In this cas, should I decorate the compute function with api.depands ?

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว +1

      @@SamirSELLAMI compute field or onchange function

  • @A076
    @A076 3 ปีที่แล้ว +1

    Hello, I was wondering if ypu know how to use the base_external_dbsource module or if you know a way to use another database's table when accessing certain models. :)

    • @OdooMates
      @OdooMates  3 ปีที่แล้ว

      You can install this module and after configuring it right. Once configured, i think, in a scheduled interval it will bring the data from the other db

  • @malikkamil6596
    @malikkamil6596 2 ปีที่แล้ว

    help plz how i can repalce tax(amount_by_group) by custom mrp_tax in odoo 14 i tried a lot but not getting it

  • @sanjaibalajinallasivam3291
    @sanjaibalajinallasivam3291 2 ปีที่แล้ว

    how to create a computed field for subtotal in invoicing, like calculating quantity, tax, price and show in the subtotal field

    • @OdooMates
      @OdooMates  2 ปีที่แล้ว

      Using the above method in video, you can achieve this, did you tried it ?