Prevent Duplicate Contacts in Any Version of ODOO

Поділитися
Вставка
  • Опубліковано 13 січ 2025

КОМЕНТАРІ • 29

  • @odoo-dev
    @odoo-dev Місяць тому +1

    Nice tips and tricks, thanks for sharing :)

  • @Ventsi-Genchev
    @Ventsi-Genchev 5 місяців тому +1

    The best channel for tricks in odoo. I always look forward to the next video because I know I will learn something useful. Thank you for your time.
    I have a question about this video: How can the warning message be translated? Our team uses two languages.
    Also if you can make a video on how to translate the employees name please. We issue invoices in two languages ​​and it is not convenient to have the employee's name in Cyrillic on an English invoice.

    • @odoo-it-yourself
      @odoo-it-yourself  5 місяців тому +1

      I've never worked with creating the warning in different languages. That's a great idea for a video! Let me look into that.

  • @kyleyoung3463
    @kyleyoung3463 Місяць тому +1

    Great video! Would there be a way to slightly modify this to just pop up a warning but not stop you from saving? Something like the customer reference field on a sales order typically shouldn’t have duplicates, but there are scenarios that they do and it’s acceptable.

    • @odoo-it-yourself
      @odoo-it-yourself  Місяць тому +1

      So I'm looking into doing a video on a wizard you could get past. I've never done it before, but I think there's a way you could do it.

  • @tomogarat1
    @tomogarat1 17 днів тому +1

    Thanks for the video! Amazing Job ❤ quick question: does adding code like this prevent odoo from automatically updating its version?

    • @odoo-it-yourself
      @odoo-it-yourself  17 днів тому

      Thank you! It can complicate the process, yes. Depending on which fields they change or rename with version upgrades, it may or may not complicate the upgrade.

  • @donJfash
    @donJfash 5 місяців тому +1

    Thanks for your videos! I have a few questions, firstly, on odoo17, i am not able to restrict sale of out of stock item, how can i solve this issue?, secondly, i use a user login for multiple retail locations and sell on POS module with different employees, is it possible to create employee/sales person log in for Sales module?

    • @odoo-it-yourself
      @odoo-it-yourself  5 місяців тому

      Glad to help. You can restrict sales on e-commerce, but on the rest, I’d setup a check with an automation. For the separate user, I haven’t found a way to track a universal variable like the currently logged in user. Let me think on that.

    • @odoo-it-yourself
      @odoo-it-yourself  5 місяців тому

      The two solutions I can think of off the top of my head would be to either require the field as they input a sale or you could potentially do something with the ip address.

  • @mah-hag6361
    @mah-hag6361 5 місяців тому +1

    🎉The best

  • @lje
    @lje 4 дні тому +1

    Hi , thanks for the tutorial! The code works for preventing duplicate contacts, but I face an issue: the error also appears when selecting an existing contact in other modules like Inventory. How can I make the validation apply only during contact creation or editing? Appreciate your help!

    • @odoo-it-yourself
      @odoo-it-yourself  5 годин тому

      Hmmm...I'm trying to think how that's triggering it. It shouldn't be creating a contact.

  • @PeteNet
    @PeteNet 2 місяці тому +1

    I am trying to adapt this script to verify if certain fields are filled in on invoices, and then display a warning or even pre-fill certain fields.
    The odd thing is, when saving an invoice, account.move seems to do multiple operations (sale.order does the same thing).
    Logging env.context shows that one of the operations holds the old data, and this makes checking on invoices or sale orders not work as elegantly as shown here on the contacts model.
    i.e. when a field is empty, in my case fiscal_position_id, I display a warning, but then when the user correctly fills out the field, the warning still comes up, because the first background operation has the old data which was empty..
    Do you have any tips how I might capture the actual filled in data, and bypass the old data ?
    I'm also trying to understand what exactly is happening with the multiple operations when saving an invoice.. I have no other automated actions in place...

    • @odoo-it-yourself
      @odoo-it-yourself  2 місяці тому

      Hmmm...that's strange that you would have that kind of barrier. Are you specifically wanting a warning or are you just trying to stop people from moving forward if certain information isn't filled out? You can conditionally require fields and that will stop a user from moving forward till those fields are filled out.

    • @PeteNet
      @PeteNet 2 місяці тому

      @@odoo-it-yourself I should perhaps do some further testing on a fresh database, but in both cases (just a warning or preventing going further) the same thing happens, even when I type a value in a field that is being checked in python, upon save there is always this 'old data' in the payload which is the previous-unfilled field, and this always triggers the condition.. it's a bit frustrating. It works perfectly on products and contacts for example, but on sales orders or invoices not.
      If I ever find a workaround, I'll post it here.

  • @labtreeltd1473
    @labtreeltd1473 3 місяці тому +1

    How could you add a button on the warning screen that says 'Ignore warning' and save the record?

    • @odoo-it-yourself
      @odoo-it-yourself  3 місяці тому +1

      Good question! For that, you would want to pop up a wizard. ua-cam.com/video/hrQZ-O_tKRs/v-deo.html

    • @PeteNet
      @PeteNet 2 місяці тому +1

      you can also do something like this (the _sendone function may be different depending on which odoo version you are using) :
      sent_messages = set()
      for msg in messages:
      if msg and msg not in sent_messages:
      record.env['bus.bus']._sendone(
      (record._cr.dbname, 'res.partner', record.env.user.partner_id.id),
      'simple_notification',
      {
      'title': 'Message Title',
      'message': msg,
      'sticky': True,
      }
      )
      sent_messages.add(msg)

  • @NathanBettley
    @NathanBettley 3 місяці тому +1

    is there a way to set this warning to the customers who are buying a product and with that creating new account?

    • @odoo-it-yourself
      @odoo-it-yourself  3 місяці тому

      Hmmm...a warning to say they already have an account? Do you have open signup setup? If so, it shouldn't allow them to create another account.

  • @toriqulislamkhanbyron3156
    @toriqulislamkhanbyron3156 5 місяців тому +1

    GOAT!!!

  • @admt-i8n
    @admt-i8n 4 місяці тому +1

    How much the line of code will cost in odoo online

    • @odoo-it-yourself
      @odoo-it-yourself  4 місяці тому

      You don't have to buy that coverage, if you don't want to.

  • @dylanwaltzing4612
    @dylanwaltzing4612 5 місяців тому +1

    useful 👍