Odoo ORM Methods - Part1

Поделиться
HTML-код
  • Опубликовано: 31 июл 2024
  • #odooorm #ormmethods #odootutorials
    Odoo ORM method. ORM method in Odoo. Odoo orm tutorials. ORM API
    . Odoo Object Relational Mapping. Odoo create, write, copy, name_get, odoo name search, odoo fields view get, odoo search, odoo browse, odoo search count, odoo copy, odoo unlink etc.
    ▬ Contents of this video ▬▬▬▬▬▬▬▬▬▬
    0:00 - Introduction to Odoo ORM
    03:01 - Search
    15:59 - Search_count
    18:41 - ref
    23:10 - browse
    26:24 - exists
    31:56 - create
    38:09 - write
    40:55 - copy
    43:16 - unlink
    Part 2: • Odoo ORM Methods - Pa...
    Read: www.odoo.com/documentation/13...
    Sorted, Filtered, Mapped: • Odoo ORM: RecordSet Op...
    Support us at: ko-fi.com/odoomates
    Email : odoomates@gmail.com
  • НаукаНаука

Комментарии • 101

  • @rigeeshmohammed2977
    @rigeeshmohammed2977 3 года назад +10

    03:01 - search
    15:59 - search_count
    18:41 - ref
    23:10 - browse
    26:24 - exists
    31:56 - create
    38:09 - write
    40:55 - copy
    43:16 - unlink

  • @microbasedesigners7057
    @microbasedesigners7057 3 года назад +1

    100% perfect Explenation Sir. Thank you so much.

    • @OdooMates
      @OdooMates  3 года назад

      happy to hear it. Share with friends and support :)

  • @HiPh0Plover1
    @HiPh0Plover1 3 года назад +2

    Best explanation so far on RUclips

    • @OdooMates
      @OdooMates  3 года назад +1

      happy to know that :)

  • @mohamedboudekak8574
    @mohamedboudekak8574 3 года назад +2

    love u man, ur explanations are perfect, thank u very much

    • @OdooMates
      @OdooMates  3 года назад

      Thank for the kind words and the support

  • @MuhammadImranSarwar-dh4rv
    @MuhammadImranSarwar-dh4rv 4 года назад +1

    Keep it up brother, life saving video

  • @heatherpiverotto1425
    @heatherpiverotto1425 3 года назад +1

    Thank you! Great content.

  • @AdeshPaul
    @AdeshPaul 4 года назад +1

    Trillion Thanks to you sir.

  • @nadeemkazi2092
    @nadeemkazi2092 4 года назад +1

    You are awesome brother...Thanks

  • @hanishmangalasseri7294
    @hanishmangalasseri7294 4 года назад +1

    Good job 👏,useful tutorial

  • @nadeemkazi2092
    @nadeemkazi2092 4 года назад +1

    Great thanks champ...

  • @NMNaufaldo
    @NMNaufaldo 2 года назад

    Nice tutorial, it help people that don't like reading the docs except there are no tutorial

    • @OdooMates
      @OdooMates  2 года назад

      thanks from the heart for all your supports and feedbacks

  • @osamakhalid5237
    @osamakhalid5237 4 года назад +1

    Keep it up Brother,,
    great

    • @OdooMates
      @OdooMates  4 года назад

      Thank you so much 😀

  • @legend-facts
    @legend-facts 2 года назад +1

    This method os really help ful for me

  • @abdelhalimkaddourguettaoui4591
    @abdelhalimkaddourguettaoui4591 4 года назад +5

    this was really helpful, Brother I want to you to publish videos for the front-end in odoo and how to use javascript

    • @OdooMates
      @OdooMates  2 года назад

      JS: ruclips.net/video/VuUMvzycXQY/видео.html
      Website: ruclips.net/video/8uYxWRlxL_U/видео.html

    • @abdelhalimkaddourguettaoui4591
      @abdelhalimkaddourguettaoui4591 2 года назад +1

      @@OdooMates Thank you brother this is really very help full, and i think you are doinig greate work, I have met several people who are already learning odoo from your channel. so what i can to say " thank you mates"

    • @OdooMates
      @OdooMates  2 года назад

      @@abdelhalimkaddourguettaoui4591 welcome brother for the kind words

  • @supreetlaghate22
    @supreetlaghate22 4 года назад +1

    Thank you soo much

    • @OdooMates
      @OdooMates  4 года назад +2

      As per we agreed in the last comment (y). Full video about the Odoo orm

    • @supreetlaghate22
      @supreetlaghate22 4 года назад +1

      @@OdooMates thank you for your sincere guidance 🙏

  • @davideercole2860
    @davideercole2860 4 года назад +1

    Very great

  • @abhinavm.s1410
    @abhinavm.s1410 4 года назад +1

    Thank you very much mates

  • @sarathexelixir6801
    @sarathexelixir6801 3 года назад +1

    For relatively inexperienced OOPS starters ( which I think a major part of aspirant programmers are); there could be better mapping to OOPS concepts. Accordingly in the create record section, the directory declaration is an argument type variable declaration. And the argument value has to correspond to ANY ONE of the data attributes of the PATIENT class/model.

    • @OdooMates
      @OdooMates  2 года назад +1

      suggesting we need a better orm ?

    • @sarathexelixir6801
      @sarathexelixir6801 2 года назад +1

      @@OdooMates Only implied that 'OBJECTS' have to be explained better before you talk about Object Relationship and also underpin the OOPS concept as much as possible

    • @OdooMates
      @OdooMates  2 года назад

      @@sarathexelixir6801 thanks for suggestion

  • @amirkarim9932
    @amirkarim9932 2 года назад +1

    first of all thank you for your videos,
    i'm going to forward in odoo developing with your videos step by step.
    but in this section , i don't know why odoo orm methods doesn't work properly:
    instead of giving the same output just like this videos in search method
    it gives me this output:
    patients.... hospital.patient(1,)
    could you help me please how solve this problem????

    • @OdooMates
      @OdooMates  2 года назад

      the expected output of search orm method is as the same, you will get a recordset, now you can get the values from recordset by calling .field_name

  • @nassirrachid232
    @nassirrachid232 4 года назад +1

    Good job 👍👍

  • @adeniyio5582
    @adeniyio5582 3 года назад +1

    Great Job guys, Very interesting video. My question is if you need to pass another field value (value from a Many2one field as one of the search criteria)
    Code Sample
    field1 = fields.Many2one("model1.model1", string="field1", required=False, )
    def action_confirm:
    for rec in self
    patients = self.env['hospital.patient'].search([('gender', '=', 'field1' ])
    Thanks

    • @OdooMates
      @OdooMates  3 года назад

      try like this
      patients = self.env['hospital.patient'].search([('gender', '=', self.field1.gender ])

    • @adeniyio5582
      @adeniyio5582 3 года назад +1

      @@OdooMates Thanks

    • @OdooMates
      @OdooMates  3 года назад

      @@adeniyio5582 welcome :)

  • @otekinalp
    @otekinalp 3 года назад +2

    another very useful video. but i think for unlink id =18, you didnt press the confirm button, thats why it wasnt removed. But now im thinking you are making these small mistakes deliberately, so we can notice and learn better :)

  • @zeiriibtissem9063
    @zeiriibtissem9063 3 года назад +3

    thank you, can you please improve the audio quality ? that would help focus more

    • @OdooMates
      @OdooMates  3 года назад +1

      sorry for the issue in audio quality, we have improved it in the recent videos :)

  • @asmaamohammad6004
    @asmaamohammad6004 Год назад +1

    Thanks

  • @claudiatapia8453
    @claudiatapia8453 3 года назад +1

    I am watching your videos. I have a question. Why are you using FOR in your action_confirm function if self represents one record. I tried a similar function with FOR and with no FOR and they both worked. The other question is when self represents one record or more. Thanks

    • @OdooMates
      @OdooMates  3 года назад

      Hi, the case is to avoid the singleton error when you have multiple records, suppose if you need to call, the same action from the action button in the tree view, it will be helpfull.
      As a safe side it is always recommended to iterate self over a loop to avoid singleton error

    • @claudiatapia8453
      @claudiatapia8453 3 года назад +1

      @@OdooMates Hi, thank you for your help

  • @lenninlawliett
    @lenninlawliett 2 года назад +1

    A question!
    What method can I get the values of a select-option?
    For example in gender it has 3 values, 'Male', 'Female', 'Other'
    How can I print these values on the console?

    • @OdooMates
      @OdooMates  2 года назад

      Will this help brother ? env['model_name]._columns['field_name'].selection

    • @lenninlawliett
      @lenninlawliett 2 года назад +1

      @@OdooMates I try to use "request"
      request.env['my.model']._columns['field_anme'].selection
      But show me an error ):
      my.model object has no attribute '_columns'

    • @OdooMates
      @OdooMates  2 года назад

      @@lenninlawliett may i know your version

    • @lenninlawliett
      @lenninlawliett 2 года назад

      @@OdooMates I have Odoo 14

    • @lenninlawliett
      @lenninlawliett 2 года назад +1

      @@OdooMates
      I found the solution! :D (for Odoo 14)
      I have this field in my model:

  • @kashifmanzoor7949
    @kashifmanzoor7949 4 года назад +1

    thank you mates.....

  • @zenjoy5450
    @zenjoy5450 3 года назад +1

    Thanks for your video but i can't really listen clearly, appreciate if there is any subtitle !

    • @OdooMates
      @OdooMates  3 года назад

      unfortunately we haven't added subtitles yet

  • @jamshadkhan2671
    @jamshadkhan2671 Год назад

    Who can we use or condition between more then two statements inside a search method.
    please explain it.

    • @OdooMates
      @OdooMates  Год назад +1

      for OR add '|' as ['|', ('ttype','!=','many2many'), ('state','!=','manual')]

  • @ganbaatarburiad400
    @ganbaatarburiad400 4 года назад +1

    Thank you my teacher :).

  • @palanikumar8023
    @palanikumar8023 3 года назад +1

    what is meant by for rec in self and self.env sir?? is rec in self: mandatory??

    • @OdooMates
      @OdooMates  3 года назад +1

      this is iterating self for a for loop to avoid the singleton error

    • @palanikumar8023
      @palanikumar8023 3 года назад

      @@OdooMates Thank you

  • @lenninlawliett
    @lenninlawliett 2 года назад +1

    How can I validate if a record exists using "request"?
    Something like this:
    record_to_update = request.env ['my.model']. browse (id)
    if record_to_update.exist ():
    ... true
    else:
    ... false

    • @OdooMates
      @OdooMates  2 года назад

      instead of exist(), use exists()

    • @lenninlawliett
      @lenninlawliett 2 года назад +1

      @@OdooMates
      only "s"? 0.o
      I will try, thanks!

    • @OdooMates
      @OdooMates  2 года назад +1

      @@lenninlawliett yes

  • @sansoftinfotech-career9282
    @sansoftinfotech-career9282 2 года назад

    what are the columns in the odoo AccountType master , documentType master and how these are accessed in a code ?

    • @OdooMates
      @OdooMates  2 года назад

      if you activate developer mode and navigate go to Settings -> Technical -> Database Structure -> Models, search for the models and open it, then you can see all the fields/columns in the table/model

  • @abduljabbar8383
    @abduljabbar8383 3 года назад +1

    how we can group data to male and female patients and male patients in search count.

    • @OdooMates
      @OdooMates  3 года назад

      use read_group method

    • @OdooMates
      @OdooMates  3 года назад +1

      read_group(domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True)
      Get the list of records in list view grouped by the given groupby fields
      Parameters
      domain -- list specifying search criteria [['field_name', 'operator', 'value'], ...]
      fields (list) -- list of fields present in the list view specified on the object
      groupby (list) -- list of groupby descriptions by which the records will be grouped. A groupby description is either a field (then it will be grouped by that field) or a string 'field:groupby_function'. Right now, the only functions supported are 'day', 'week', 'month', 'quarter' or 'year', and they only make sense for date/datetime fields.
      offset (int) -- optional number of records to skip
      limit (int) -- optional max number of records to return
      orderby (list) -- optional order by specification, for overriding the natural sort ordering of the groups, see also search() (supported only for many2one fields currently)
      lazy (bool) -- if true, the results are only grouped by the first groupby and the remaining groupbys are put in the __context key. If false, all the groupbys are done in one call.
      Returns
      list of dictionaries(one dictionary for each record) containing:
      the values of fields grouped by the fields in groupby argument
      __domain: list of tuples specifying the search criteria
      __context: dictionary with argument like groupby
      Return type [{'field_name_1': value, ...]
      Raises AccessError --
      if user has no read rights on the requested object
      if user tries to bypass access rules for read on the requested object

  • @arturop8074
    @arturop8074 3 года назад

    Hi! where can I get the Hospital module? Can't find it anywhere. Thanks!

    • @OdooMates
      @OdooMates  3 года назад

      Odoo Apps: apps.odoo.com/apps/modules/12.0/om_hospital/
      Github: github.com/odoomates/odooapps/tree/12.0

    • @arturop8074
      @arturop8074 3 года назад

      @@OdooMates Thanks a lot for the answer. Great videos!

    • @OdooMates
      @OdooMates  3 года назад

      @@arturop8074 thanks brother

  • @abduljabbar8383
    @abduljabbar8383 3 года назад +1

    how i can group data in search_count

    • @OdooMates
      @OdooMates  2 года назад

      you may have to use read_group method

  • @santoshsalekar6739
    @santoshsalekar6739 3 года назад +1

    How to update Many2one field using write method?

  • @palanikumar8023
    @palanikumar8023 3 года назад +1

    Hi is there any possible for writing orm queries for joins??

    • @OdooMates
      @OdooMates  3 года назад

      Yes

    • @palanikumar8023
      @palanikumar8023 3 года назад +1

      @@OdooMates Plz provide an simple example in comments for left join please

    • @OdooMates
      @OdooMates  3 года назад

      @@palanikumar8023 there is a lot of such examples inside the odoo core itself.
      For PSQL Queries: www.postgresqltutorial.com/postgresql-joins/

    • @palanikumar8023
      @palanikumar8023 3 года назад +1

      @@OdooMates yes this is simple SQL query but I already written this...Now the requirement is I have to convert all the SQL queries to odoo orm format like self.env['crm.lead'].search[] like this one...is this possible??

  • @tizianadipierro3921
    @tizianadipierro3921 2 года назад +1

    bad audio quality

    • @OdooMates
      @OdooMates  2 года назад

      sorry brother, we are doing our best to improve it