Automated Action to Update Records with Python in ODOO for Beginners

Поделиться
HTML-код
  • Опубликовано: 2 ноя 2024

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

  • @jet6767
    @jet6767 8 месяцев назад +7

    Hi Andrew, it would be nice if you feature the 3rd method as well. Thanks.

  • @timd6324
    @timd6324 8 месяцев назад +1

    Another great video and another vote to see some black magic.

  • @olivierwambacq
    @olivierwambacq 7 дней назад +1

    Hello, realy loving your great work. helped me out a lot allready!
    could you show us how to use this to update a record in a related table? like for example, on creation of a rental order, I made an automation to create an all day calendar event "pickup +rental order" based on pickup time, and a second calendar event "return + rental order" based on return time (for rentals).
    Now, when the rental order gets switched to "picked up", I would like to update the "pickup + rental order" calendar event, to "Picked up + rental order". and change the start and end time of that event to something like datetime.now()-15min and end time datetime.now()+15min

    • @odoo-it-yourself
      @odoo-it-yourself  7 дней назад

      Glad it’s helping. You’d want to use record.relatedfieldname[fieldonrelatedtablename]=newvalue

  • @CB-yl9fm
    @CB-yl9fm 6 месяцев назад +1

    I really enjoy your videos. They are very understandable and help you to get into this odoo world. Is there a way to monitor the shopping cart with automated actions? It works with sales quotation, but it should also work if there are two specific products in the shopping cart. Any idea which model and which trigger is best to use?
    In the sales app I use save what would be the equivalent in ecommerce?

    • @odoo-it-yourself
      @odoo-it-yourself  6 месяцев назад

      I'm glad you're enjoying it. That's an excellent question. Let me look into it and get back to you.

  • @ap8868
    @ap8868 5 месяцев назад +1

    Hi Andrew, Thanks for the explantation, really helpful to me since I'm a PLC programmer starting with python..
    I'd like to know how to change a many2one field while saving the record. Imagine I have a form with several fileds and one of those fields is the buyer (partner_id) and another one is the final customer (x_studio_finalcustomer). When creating a new project and leaving the fielde final customer empty, I'd like to update this field with the buyer (which is mandatory). Can you give me an idea if this could happen and if so, how?
    BTW: How black is the mentioned magic? Not able to see it even setting the brightness of my screen to max...

    • @odoo-it-yourself
      @odoo-it-yourself  5 месяцев назад

      You could definitely do this! Just set the field equal to the .id in your code if the field is empty. And you’re probably too pure of heart for the black magic…

    • @ap8868
      @ap8868 5 месяцев назад +1

      @@odoo-it-yourself Hi, Thanks for prompt response. I have tried several attemps, no success. Im not sure how I can write an many2one field. For me it should work with:
      if not record.x_studio_finalcustomer:
      varName = record.partner_id
      record.write({'x_studio_finalcustomer' : varName })
      But it doesn't work. Both fields are many2one. Code will be exectuted while saving.

    • @odoo-it-yourself
      @odoo-it-yourself  5 месяцев назад

      Add .id after your partner_id. You're trying to push a record into what is essentially an integer field. That should fix it for you!

  • @HamzaAslam-f9o
    @HamzaAslam-f9o 6 месяцев назад +1

    your videos are great. I'm having trouble as a beginner where should I start?

    • @odoo-it-yourself
      @odoo-it-yourself  6 месяцев назад

      Thank you! What are you hoping to be able to do?

    • @HamzaAslam-f9o
      @HamzaAslam-f9o 6 месяцев назад

      @@odoo-it-yourself I want to be a functional developer. But I'm unable to figure out where to start.

  • @MysterFiend-eo4ys
    @MysterFiend-eo4ys 8 месяцев назад +1

    Hello, I really appreciate your videos because I am new to Odoo development. I would like to ask a favor: is it possible to dynamically modify a domain filter of a field using automated actions? Thanks in advance!

    • @odoo-it-yourself
      @odoo-it-yourself  8 месяцев назад +1

      Hmmm...there's certainly a way, but I haven't done it before. What's your use case? There may be an easier way to get to your solution. Maybe this will help: ruclips.net/video/jfNC0bKDPnE/видео.html

    • @MysterFiend-eo4ys
      @MysterFiend-eo4ys 8 месяцев назад +1

      @@odoo-it-yourself I wanted to filter the destination location in transfer operation inside the inventory module, base on the name of the Contact. So basically the destination location name has the name of the Contact in it, so I wanted to limit it to only show destination locations that have the selected Contact name in it.
      Thank you!

    • @odoo-it-yourself
      @odoo-it-yourself  8 месяцев назад +1

      @@MysterFiend-eo4ys Sweet! That video I shared with you should do the trick. Please let me know if you need anything else there.

  • @davidhovsepian-id1cv
    @davidhovsepian-id1cv 4 месяца назад +1

    I want to hear about the "Black Magic"

  • @noorealamsiddique8185
    @noorealamsiddique8185 8 месяцев назад

    How can I automate sale order on odoo 15? Suppose when I confirm quotation or sale order it will automatically generate invoice and confirm invoice and also validate the delivery if quantity is available. please make a video.

    • @odoo-it-yourself
      @odoo-it-yourself  8 месяцев назад

      Hmmm...that seems like a fairly limited use case, but you could definitely use a few automated actions to push that forward. There's an auto invoice function on delivery. Really the only thing you'd have to add is the auto-delivery. I'm curious, what's the reason you're wanting to automatically deliver goods?

  • @wvfmSuTM
    @wvfmSuTM 8 месяцев назад +3

    Of course we want to see the black magic! 🪄