Skip to Content
Menu
This question has been flagged
1 Reply
2491 Views

Hello,

This is my first attempt at repairing an issue with a module where I need to be able to search by the customers product ID. So far I've been successful in finding my product when typing in the customer product code but now I can ONLY search by the customer product ID. The default logic has been wiped out by what I've created.... Can some kind soul please give me the code I can copy/paste if it's not too much work... any insight would be greatly appreciated though.


I'm hoping to be able to use the default search logic in the sales order + be able to find/populate my product in the quick search area (not the "search more" window")


    @api.model
    def name_search(selfname=''args=Noneoperator='ilike'limit=100):
        args = args or []
        recs = self.browse()
        if not recs:
            recs = self.search([('product_customer_code_ids', operator, name)] + args, limit=limit)
        return recs.name_get()

        return res
Avatar
Discard
Best Answer

You may not need custom code at all.

This product:



... will be found on a Sales Order to Customer A by typing either Apple or Arctic:



For them it shows up like this:




... and will be found on a Sales Order to Customer B by typing either Bridge or Bean:



For them it shows up like this:


Avatar
Discard
Author

Hi Ray, I should've clarified that I'm doing this in the sales module. We have the same part # being sold to multiple customers under their own product name. We didn't want to use "Internal Reference" as a differentiator so we went with this custom module.

In products, under "purchase" we have our supplier information there so I can't put the customer there. The solution was customer part #. The problem is I can't search by the customer part # in the sales order when adding my lines.

Your response gave me that sinking feeling though that maybe I've been looking at this wrong the whole time. Thanks for responding and taking the time to make those screenshots nonetheless.

The screenshots I showed are from a Sales Order. If you put the Customers below your Vendors there should be no issue. The "prices" part of the lines on the Vendor tab would all be zero for the Customers. This solution is working bat several Customer implementations exactly as I explained.

Author

Ray - wow thank you so much. I truly appreciate it...

Related Posts Replies Views Activity
1
Jan 18
7353
1
Nov 24
209
1
Mar 23
1024
2
Feb 23
1547
1
Nov 22
3896