OpenERP pop-up window prompt Summary

Source: Internet
Author: User

OpenERPPop-up Prompt window SummaryOpenERP pop-up Prompt window has three ways, details can refer to: http://www.cnblogs.com/cnshen/p/3205405.htmlhttp://shine-it.net/index.php? Topic = 2383.0 note that the following method is discussed here:
  <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink">
   
Resume + resume/resume + cc3vc3ryb25npjxzdhjvbmc + Cjwvc3Ryb25nPjxzdHJvbmc + resume = "brush: java;"> from openerp. tools. translate import _ from osv. osv import Export t_osv
  

2Check for errors in business logic, terminate code execution, and Display error or warning information
Add the following code to the prompt in the class method:

Raiseosv. effect_osv (_ ('error! '), _ ('Error Message .'))

Note: The osv. effect_osv () method requires two parameters. If you put the parameter in _ (), the parameter can be internationalized without _ () Eg:   
def __assistant_depmanager_prove(self, cr, uid, ids, context=None):        for qjd in self.browse(cr, uid, ids, context=context):            if qjd.shenqr.user_id.id == uid:                raise osv.except_osv(_('Warning!'), _('you cannot prove yourself'))                return False            elif qjd.tians > 1:                raise osv.except_osv(_('Warning!'), _('There are not enough access '))                return False            else:                return True

Translation tips
#. module: qingjia
#: code:addons/qingjia/qingjia.py:0
#, Python-formatmsgid "Warning! "Msgstr" prompt! "
#. module: qingjia#: code:addons/qingjia/qingjia.py:0
#, python-formatmsgid "you cannot prove yourself"
Msgstr "You cannot approve your application form"
3)The prompt can contain variables and Chinese translation of the variables. 
 
Def assistant_depmanager_proved_new (self, cr, uid, ids, context = None): res = self. browse (cr, uid, ids, context = context) result = res [0] raise osv. effect_osv (_ ('error! '), _ ('Your uid is "% s", name is "% s", the state is "% s"') % (_ (uid ), _ ('wang Xiaobo '), _ (result. state) result = self. _ assistant_depmanager_prove (cr, uid, ids, context = context) if result: self. write (cr, uid, ids, {'state': 'provided '})

Note: The Status translation here is the corresponding English status name. If you need to translate it into Chinese, you must use _()
#. module: qingjia#: code:addons/qingjia/qingjia.py:0
#, python-format
msgid "Your uid is \"%s\" ,name is \"%s\",the state is \"%s\""
Msgstr "Your User ID is '% s' and the name is' % s'. The status of the ticket is '% S '"
Translate all the States defined, and the final State will also be in Chinese.
#. module: qingjia
#: code:addons/qingjia/qingjia.py:0
#, python-format
Msgid "wait_prove" msgstr "to be approved"
As follows:
      

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.