콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
2857 화면

Hi, 

When I try to search multiple orders in the order list, if the order does not exist, odoo doesn't show any message like: order XXX not found. So I may think the order is there.

So How to raise a message to notice me? 

Thanks.


아바타
취소
베스트 답변

Hi,

For this you can raise a warning message in your custom code if the searched record doesn't exist.

For example:

If you are searching for sale order with name 'order_ref',  you can add as below

from odoo.exceptions import UserError

class SaleOrder(models.Model):
_inherit = 'sale.order'

def search_sale_order(self):
order_id = self.env['sale.order'].search([('name', '=', 'order_ref')])
if not order_id:
raise UserError(_("Order Not Found !"))


Thank you


아바타
취소
작성자

Hi Mehjabin.
But how to apply this "search_sale_order" function to the search function?

작성자

I have tried to make an add-on with your code, but it doesn't work.
I think 'order_ref' may be wrong. Can you give more hints please?

관련 게시물 답글 화면 활동
1
11월 20
2525
4
7월 24
15676
1
6월 22
6753
1
4월 22
3471
1
3월 21
7807