本文整理汇总了Python中wizard.except_wizard函数的典型用法代码示例。如果您正苦于以下问题:Python except_wizard函数的具体用法?Python except_wizard怎么用?Python except_wizard使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了except_wizard函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _do_export
def _do_export(self, cr, uid, data, context):
self.pool = pooler.get_pool(cr.dbname)
esale_category_obj = self.pool.get('esale.oscom.category')
product_obj = self.pool.get('product.product')
product_ids = data['ids']
category_ids_dict = {}
products = product_obj.browse(cr, uid, product_ids)
if len(product_ids) > 1:
for product in products:
product_by_category_list = category_ids_dict.get(product.categ_id.id, False)
if product_by_category_list and len(product_by_category_list):
product_by_category_list.append(product.id)
else:
category_ids_dict[product.categ_id.id] = [product.id]
for category_id in category_ids_dict:
web_categ_id = esale_category_obj.search(cr, uid, [('category_id','=',category_id)])
if not len (web_categ_id):
raise wizard.except_wizard(_('User Error'), _('Select only products which belong to a web category!'))
else:
oerp_category_id = products[0].categ_id.id
web_categ_id = esale_category_obj.search(cr, uid, [('category_id','=',oerp_category_id)])
if not len(web_categ_id):
raise wizard.except_wizard(_('User Error'), _('This product must belong to a web category!'))
return product_obj.oscom_export(cr, uid, product_ids=product_ids, context=context)
开发者ID:3dfxmadscientist,项目名称:odoo-extra-1,代码行数:26,代码来源:wizard_esale_oscom_export_select_products.py
示例2: _check
def _check(self, cursor, uid, data, context):
"""Check if the invoice is ready to be printed"""
pool = pooler.get_pool(cursor.dbname)
invoice_obj = pool.get("account.invoice")
for invoice in invoice_obj.browse(cursor, uid, data["ids"], context):
if not invoice.partner_bank:
raise wizard.except_wizard(
"UserError",
"No bank specified on invoice:\n"
+ invoice_obj.name_get(cursor, uid, [invoice.id], context=context)[0][1],
)
if not re.compile("[0-9][0-9]-[0-9]{3,6}-[0-9]").match(invoice.partner_bank.bvr_number or ""):
raise wizard.except_wizard(
"UserError",
"Your bank BVR number should be of the form 0X-XXX-X! "
+ "Please check your company "
+ "information for the invoice:\n"
+ invoice_obj.name_get(cursor, uid, [invoice.id], context=context)[0][1],
)
if invoice.partner_bank.bvr_adherent_num and not re.compile("[0-9]*$").match(
invoice.partner_bank.bvr_adherent_num
):
raise wizard.except_wizard(
"UserError",
"Your bank BVR adherent number must contain exactly seven"
+ "digits!\nPlease check your company "
+ "information for the invoice:\n"
+ +invoice_obj.name_get(cursor, uid, [invoice.id], context=context)[0][1],
)
return {}
开发者ID:MarkNorgate,项目名称:addons-EAD,代码行数:30,代码来源:wizard_bvr.py
示例3: _confirm
def _confirm(self,cr,uid,data,context):
print "_confirm"
pool=pooler.get_pool(cr.dbname)
all_pv_ids=data["ids"]
pv_groups={}
for pv in pool.get("account.voucher").browse(cr,uid,all_pv_ids):
if pv.type!="payment":
raise wizard.except_wizard("Error","Wrong voucher type: %s"%pv.name)
if pv.state in ("paid","posted"):
raise wizard.except_wizard("Error","Payment voucher is already paid: %s"%pv.name)
if pv.state!="checked":
raise wizard.except_wizard("Error","Payment voucher is not approved: %s"%pv.name)
pv_groups.setdefault(pv.pay_mode_id.id,[]).append(pv)
bp_ids=[]
for pay_mode_id,pvs in pv_groups.items():
vals={
"pay_mode_id": pay_mode_id,
}
bp_id=pool.get("batch.payment").create(cr,uid,vals)
bp_ids.append(bp_id)
for pv in pvs:
pv.write({"batch_pay_id":bp_id})
return {
"type": "ir.actions.act_window",
"res_model": "batch.payment",
"domain": [("id","in",bp_ids)],
"view_type": "form",
"view_mode": "tree,form",
"name": "Batch Payment",
}
开发者ID:kittiu,项目名称:ecosoft_addons,代码行数:30,代码来源:batch_pay.py
示例4: _send_fax
def _send_fax(self, cr, uid, datas, context):
# Number of sent FAX
nbOk = 0
nbError = 0
logger = netsvc.Logger()
pool = pooler.get_pool(cr.dbname)
# Get file attachement and prepare for sending
if datas['form']['attachment']:
fFax = "/tmp/hfx_attach" + str(random.randint(0,100))
try:
fc = open(fFax, "w")
fc.write(base64.decodestring(datas['form']['attachment']))
fc.close()
except IOError:
raise wizard.except_wizard('[HeoFAX - Error]', 'Unable to open temporary file for file attachement: %s !!!' % fFax)
cmd['listFile'].append(fFax)
if debug: logger.notifyChannel("[HeoFAX - Debug]", netsvc.LOG_INFO, " File attached: %s" % " ".join(cmd['listFile']))
partners = pool.get('res.partner').browse(cr, uid, datas['ids'], context)
for partner in partners:
for adr in partner.address:
if adr.name:
name = adr.name + ' (' + partner.name + ')'
else:
name = partner.name
if adr.fax:
cmd['to_number'] = adr.fax
cmd['to_company'] = partner.name
cmd['to_name'] = name
# Build FAX command line
cmdFax = hnm_heofax_lib.build_fax_cmd(self, cr, uid, datas, cmd)
cmdFax = cmdFax.encode('utf8')
if debug:
# For trace only
logger.notifyChannel("[HeoFAX - Debug]", netsvc.LOG_INFO, " Fax for: %s with fax nb: %s" % (name,cmd['to_number']))
logger.notifyChannel("[HeoFAX - Debug]",netsvc.LOG_INFO, " Command used: %s" % cmdFax)
pipe = subprocess.Popen(cmdFax, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, shell=True)
sts = pipe.wait()
out = pipe.stdout.read() + pipe.stderr.read()
if debug:
logger.notifyChannel("[HeoFAX - Debug]",netsvc.LOG_INFO, " ID: %d:%s" % (sts,out))
# increment number of fax
nbOk += 1
# Record event if selected
if datas['form']['recordEvent']:
ret = pool.get('res.partner.event').create(cr, uid, {'name':'Sent to FAX server: '+ datas['form']['subject'], 'partner_id':partner.id,'user_id':cmd['user'].id})
# Test if sending to first contact only
if datas['form']['firstonly']: break
else:
nbError += 1
logger.notifyChannel("[HeoFAX - Info]",netsvc.LOG_INFO, " No fax number for name: %s" % name)
if len(partners) < 1:
raise wizard.except_wizard('[HeoFAX - Error]', ' No fax number for name: %s' % name)
# Remove working files
for f in cmd['listFile']:
os.remove(f)
if debug: logger.notifyChannel("[HeoFAX - Debug]",netsvc.LOG_INFO, " Removed file: %s" % f)
cmd['listFile'] = []
return {'fax_sent': nbOk, 'fax_error': nbError}
开发者ID:kevin-garnett,项目名称:openerp-from-oneyoung,代码行数:60,代码来源:wizard_partner_send_fax.py
示例5: _numerotate_alpha
def _numerotate_alpha(self,cr,uid,data,context={}):
list_alpha=['A01','B01','C01','D01','E01','F01','G01','H01',
'A02','B02','C02','D02','E02','F02','G02','H02',
'A03','B03','C03','D03','E03','F03','G03','H03',
'A04','B04','C04','D04','E04','F04','G04','H04',
'A05','B05','C05','D05','E05','F05','G05','H05',
'A06','B06','C06','D06','E06','F06','G06','H06',
'A07','B07','C07','D07','E07','F07','G07','H07',
'A08','B08','C08','D08','E08','F08','G08','H08',
'A09','B09','C09','D09','E09','F09','G09','H09',
'A10','B10','C10','D10','E10','F10','G10','H10',
'A11','B11','C11','D11','E11','F11','G11','H11',
'A12','B12','C12','D12','E12','F12','G12','H12'
]
st_a=data['form']['start_alpha'].upper()
la_a=data['form']['last_alpha'].upper()
if st_a not in list_alpha:
raise wizard.except_wizard('Error!', 'Please, Set the right number to the first number')
if la_a not in list_alpha:
raise wizard.except_wizard('Error!', 'Please, Set the right number to the last number ')
obj_ls = pooler.get_pool(cr.dbname).get('labo.sample')
refs_ls=obj_ls.browse(cr,uid,data['ids'])
start_at=list_alpha.index(st_a)
stop_at=list_alpha.index(la_a)
if stop_at<start_at:
raise wizard.except_wizard('Error!', 'Please check your numerotation "%s" comes after "%s"'%(st_a,la_a))
for r in refs_ls:
if start_at<=stop_at:
k=obj_ls.write(cr,uid,[r.id],{'num_alpha':list_alpha[start_at]})
start_at+=1
return{}
开发者ID:Arsalan88,项目名称:openerp-extra-6.1,代码行数:35,代码来源:wizard_numerotate_setup.py
示例6: _lang_install
def _lang_install(self, cr, uid, data, context):
password =data['form']['password']
lang =data['form']['lang']
user = pooler.get_pool(cr.dbname).get('res.users').read(cr,uid,uid,['login'])['login']
if not s.verify_user(user,password,lang):
raise wizard.except_wizard('Error !!', 'Bad User name or Passsword or you are not authorised for this language')
version = data['form']['version']
profile = data['form']['profile']
ir_translation_contrib = pooler.get_pool(cr.dbname).get('ir.translation.contribution')
ids = ir_translation_contrib.search(cr,uid,[('lang','=',lang),('state','=','accept')])
if not ids:
raise wizard.except_wizard('Error !!', 'No contributions are find to upload in main revision')
contrib = ir_translation_contrib.read(cr,uid,ids,['type','name','res_id','src','value'])
new_contrib =map(lambda x:{'type':x['type'],'name':x['name'],'res_id':x['res_id'],'src':x['src'],'value':x['value']},contrib)
try :
result = s.publish_release(user,password,lang,version,profile,new_contrib)
#still working to show correct error message when server is not responding properly
except Exception,e:
if e.__dict__.has_key('name'):
raise wizard.except_wizard('Error !',e.value)
else:
raise wizard.except_wizard('Error !',"server is not properly configuraed")
ir_translation_contrib.write(cr,uid,ids,{'state':'done'})
开发者ID:3dfxmadscientist,项目名称:odoo-extra-1,代码行数:25,代码来源:wizard_publish_new_version.py
示例7: _lang_install
def _lang_install(self, cr, uid, data, context):
fname = data['form']['contrib']
ir_translation_contrib = pooler.get_pool(cr.dbname).get('ir.translation.contribution')
try :
contrib = s.get_contrib(self.user,self.password,self.lang,self.version,self.profile,fname)
if not contrib :
raise wizard.except_wizard('Error !!', 'Bad User name or Passsword or you are not authorised for this language')
#It is assumed that res_id is properly set and we dnt need to apply any further calculation for it
for c in contrib :
vals = {}
ids = ir_translation_contrib.search(cr,uid,[('type','=',c['type']),('name','=',c['name']),('src','=',c['src']),('lang','=',self.lang)])
if ids:
ir_translation_contrib.write(cr,uid,ids,{'value':c['value'],'src':c['src']})
if not ids:
vals['type']=c['type']
vals['name']=c['name']
vals['src']=c['src']
vals['value']=c['value']
vals['res_id']=c['res_id']
vals['lang'] = self.lang
id = ir_translation_contrib.create(cr,uid,vals)
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'ir.translation.contribution', id, 'button_propose', cr)
#still working to show correct error message when server is not responding properly
except Exception,e:
if e.__dict__.has_key('name'):
raise wizard.except_wizard('Error !',e.value)
else:
raise wizard.except_wizard('Error !',"server is not properly configuraed")
开发者ID:3dfxmadscientist,项目名称:odoo-extra-1,代码行数:33,代码来源:wizard_download_file_for_publish.py
示例8: _get_accounts
def _get_accounts(self, cr, uid, data, context):
"""give the default aa that are recursively linked to timesheet line
it will retviev the upper level parent account"""
if not len(data['ids']):
return {}
ids = ','.join(map(str,data['ids']))
try :
cr.execute (
"SELECT distinct(a.parent_id) \
from account_analytic_account \
a join account_analytic_line l \
on (l.account_id=a.id) where l.id IN (%s) ;" %(ids,)
)
projects_ids = cr.fetchall()
cr.execute(
"SELECT l.id from account_analytic_account \
a join account_analytic_line l \
on (l.account_id=a.id) \
where l.id IN (%s) \
and invoice_id is not null;"%(ids,)
)
test=cr.fetchall()
if len (test)>0:
raise wizard.except_wizard(
'Error !',
'Please select only line wich \
are not already invoiced !!!'
)
except Exception, e :
cr.rollback()
raise wizard.except_wizard(
'Error !',
str(e)
)
开发者ID:3dfxmadscientist,项目名称:odoo-extra-1,代码行数:34,代码来源:invoice_create.py
示例9: email_send
def email_send(cr, uid, ids, to_adr, description, context={}):
for task in pooler.get_pool(cr.dbname).get('project.task').browse(cr, uid, ids, context):
project = task.project_id
subject = "Task '%s' closed" % task.name
if task.user_id and task.user_id.address_id and task.user_id.address_id.email:
from_adr = task.user_id.address_id.email
signature = task.user_id.signature
else:
raise wizard.except_wizard(_('Error'), _("Couldn't send mail because your email address is not configured!"))
if to_adr:
val = {
'name': task.name,
'user_id': task.user_id.name,
'task_id': "%d/%d" % (project.id, task.id),
'date_start': task.date_start,
'date_close': task.date_close,
'state': task.state
}
header = (project.warn_header or '') % val
footer = (project.warn_footer or '') % val
body = u'%s\n%s\n%s\n\n-- \n%s' % (header, description, footer, signature)
email(from_adr, [to_adr], subject, body.encode('utf-8'), email_bcc=[from_adr])
else:
raise wizard.except_wizard(_('Error'), _("Couldn't send mail because the contact for this task (%s) has no email address!") % contact.name)
开发者ID:MarkNorgate,项目名称:addons-EAD,代码行数:25,代码来源:close_task.py
示例10: _pay_and_reconcile
def _pay_and_reconcile(self, cr, uid, data, context):
if not abs(data['form']['total'] - (data['form']['amount']+data['form']['amount2']+data['form']['amount3']))<0.01:
rest=data['form']['total']-(data['form']['amount']+data['form']['amount2']+data['form']['amount3'])
raise wizard.except_wizard('Payment aborted !', 'You should pay all the total: "%.2f" are missing to accomplish the payment.' %(round(rest,2)))
pool = pooler.get_pool(cr.dbname)
lots = pool.get('auction.lots').browse(cr,uid,data['ids'],context)
ref_bk_s=pooler.get_pool(cr.dbname).get('account.bank.statement.line')
for lot in lots:
if data['form']['buyer_id']:
pool.get('auction.lots').write(cr,uid,[lot.id],{'ach_uid':data['form']['buyer_id']})
if not lot.auction_id:
raise wizard.except_wizard('Error !', 'No auction date for "%s": Please set one.'%(lot.name))
pool.get('auction.lots').write(cr,uid,[lot.id],{'is_ok':True})
for st,stamount in [('statement_id1','amount'),('statement_id2','amount2'),('statement_id3','amount3')]:
if data['form'][st]:
new_id=ref_bk_s.create(cr,uid,{
'name':'Buyer:'+str(lot.ach_login or '')+', auction:'+ lots[0].auction_id.name,
'date': time.strftime('%Y-%m-%d'),
'partner_id':data['form']['buyer_id'] or False,
'type':'customer',
'statement_id':data['form'][st],
'account_id':lot.auction_id.acc_income.id,
'amount':data['form'][stamount]
})
for lot in lots:
pool.get('auction.lots').write(cr,uid,[lot.id],{'statement_id':[(4,new_id)]})
return {}
开发者ID:MarkNorgate,项目名称:addons-EAD,代码行数:30,代码来源:wizard_pay.py
示例11: _associate
def _associate(self, cr, uid, data, context):
""" function that will fill the field invoice_id of analytic lines"""
if len (data['ids'])<1:
raise wizard.except_wizard(
'Error !',
'You must select at leat one line !'
)
try :
pool = pooler.get_pool(cr.dbname)
line_ids = data['ids']
line_obj=pool.get('account.analytic.line')
vals = {'invoice_id': data['form']['invoice']}
for line_id in line_ids:
line_obj.write(
cr,
uid,
line_id,
vals
)
return {
'domain': "[('id','=', "+str(data['form']['invoice'])+")]",
'name': 'Invoices',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.invoice',
'view_id': False,
'type': 'ir.actions.act_window'
}
except Exception, e:
raise wizard.except_wizard(
'Error !',
str(e.name)+' '+str(e.value)
)
开发者ID:3dfxmadscientist,项目名称:odoo-extra-1,代码行数:33,代码来源:associate_analytic_line_from.py
示例12: _construct_bvr_in_chf
def _construct_bvr_in_chf(self,bvr_string):
if len(bvr_string) <> 53:
raise wizard.except_wizard('AccountError',
'BVR CheckSum Error Première partie')
elif self._check_number(bvr_string[0:12]) <> int(bvr_string[12]):
raise wizard.except_wizard('AccountError',
'BVR CheckSum Error Deuxième partie')
elif self._check_number(bvr_string[14:40]) <> int(bvr_string[40]):
raise wizard.except_wizard('AccountError',
'BVR CheckSum Error troisème partie')
elif self._check_number(bvr_string[43:51]) <> int(bvr_string[51]):
raise wizard.except_wizard('AccountError',
'BVR CheckSum Error 4 partie')
else:
bvr_struct = {
'type' : bvr_string[0:2],
'amount' : float(bvr_string[2:12])/100,
'reference' : bvr_string[14:41],
'bvrnumber' : bvr_string[14:20],
'beneficiaire' : self._create_bvr_account(
bvr_string[43:52]
),
'domain' : '',
'currency' : ''
}
return bvr_struct
开发者ID:lcrdcastro,项目名称:viaweb,代码行数:26,代码来源:scan_bvr.py
示例13: _construct_bvrplus_in_chf
def _construct_bvrplus_in_chf(self,bvr_string):
##
if len(bvr_string) <> 43:
raise wizard.except_wizard('AccountError',
'BVR CheckSum Error Première partie')
elif self._check_number(bvr_string[0:2]) <> int(bvr_string[2]):
raise wizard.except_wizard('AccountError',
'BVR CheckSum Error Deuxième partie')
elif self._check_number(bvr_string[4:30]) <> int(bvr_string[30]):
raise wizard.except_wizard('AccountError',
'BVR CheckSum Error troisème partie')
elif self._check_number(bvr_string[33:41]) <> int(bvr_string[41]):
raise wizard.except_wizard('AccountError',
'BVR CheckSum Error 4 partie')
else:
bvr_struct = {
'type' : bvr_string[0:2],
'amount' : 0.0,
'reference' : bvr_string[4:31],
'bvrnumber' : bvr_string[4:10],
'beneficiaire' : self._create_bvr_account(
bvr_string[33:42]
),
'domain' : '',
'currency' : ''
}
return bvr_struct
开发者ID:lcrdcastro,项目名称:viaweb,代码行数:27,代码来源:scan_bvr.py
示例14: _check
def _check(self, invoices):
"""Check if the invoice is ready to be printed"""
cursor = self.cr
pool = self.pool
invoice_obj = pool.get('account.invoice')
ids = [x.id for x in invoices]
for invoice in invoice_obj.browse(cursor, self.uid, ids):
if not invoice.partner_bank_id:
raise wizard.except_wizard(_('UserError'),
_('No bank specified on invoice:\n' + \
invoice_obj.name_get(cursor, self.uid, [invoice.id],
context={})[0][1]))
if not self._compile_check_bvr.match(
invoice.partner_bank_id.post_number or ''):
raise wizard.except_wizard(_('UserError'),
_("Your bank BVR number should be of the form 0X-XXX-X! " +
'Please check your company ' +
'information for the invoice:\n' +
invoice_obj.name_get(cursor, self.uid, [invoice.id],
context={})[0][1]))
if invoice.partner_bank_id.bvr_adherent_num \
and not self._compile_check_bvr_add_num.match(
invoice.partner_bank_id.bvr_adherent_num):
raise wizard.except_wizard('UserError',
'Your bank BVR adherent number must contain exactly seven' +
'digits!\nPlease check your company ' +
'information for the invoice:\n' +
invoice_obj.name_get(cursor, self.uid, [invoice.id],
context={})[0][1])
return ""
开发者ID:fofowisworkingattelenais,项目名称:modulmodul,代码行数:30,代码来源:report_webkit_html.py
示例15: _select_prices_prog
def _select_prices_prog(self, cr, uid, data, context):
if context.has_key('prices_prog_id'):
prices_prog_id = context['prices_prog_id']
else :
prices_prog_id = data['form']['prices_progression']
pool=pooler.get_pool(cr.dbname)
prop_obj=pool.get('dm.campaign.proposition').browse(cr, uid, data['ids'])[0]
offer_id=prop_obj.camp_id.offer_id.id
step_ids=pool.get('dm.offer.step').search(cr, uid, [('offer_id', '=', offer_id)])
step_obj=pool.get('dm.offer.step').browse(cr, uid, step_ids)
pprog_obj=pool.get('dm.campaign.proposition.prices_progression').browse(cr, uid, prices_prog_id)
if prop_obj.item_ids:
for p in prop_obj.item_ids:
pool.get('dm.campaign.proposition.item').unlink(cr, uid, p.id)
stp=0
"""Creates proposition items"""
if not prop_obj.camp_id.state == 'draft':
raise wizard.except_wizard(_('UserError'),_('Campaign should be in draft state'))
for step in step_obj:
for item in step.item_ids:
if item:
if prop_obj.force_sm_price:
if prop_obj.price_prog_use:
if pprog_obj.type == 'fixed':
price = prop_obj.sm_price + (stp * pprog_obj.value)
elif pprog_obj.type == 'percent':
price = prop_obj.sm_price + (prop_obj.sm_price * ((stp * pprog_obj.value) / 100))
else:
price = prop_obj.sm_price
else :
if not prop_obj.customer_pricelist_id:
raise wizard.except_wizard('Error !', 'Select a product pricelist !')
price = pool.get('product.pricelist').price_get(cr, uid,
[prop_obj.customer_pricelist_id.id], item.id, 1.0,
context=context)[prop_obj.customer_pricelist_id.id]
vals = {'product_id' : item.id,
'proposition_id' : data['ids'][0],
'offer_step_id' : step.id,
'qty_planned' : item.virtual_available,
'qty_real' : item.qty_available,
'price': price,
'notes': item.description,
'forecasted_yield' : step.forecasted_yield,
'qty_default' : item.qty_default,
'forwarding_charge' : prop_obj.forwarding_charge
}
new_id=pool.get('dm.campaign.proposition.item').create(cr, uid, vals)
stp=stp+1
"""
pool=pooler.get_pool(cr.dbname)
prop_obj = pool.get('dm.campaign.proposition')
for r in prop_obj.browse(cr, uid, data['ids']):
if not r.campaign_group_id:
camp_obj.write(cr, uid, r.id, {'campaign_group_id': group_id})
"""
return {}
开发者ID:3dfxmadscientist,项目名称:odoo-extra-1,代码行数:60,代码来源:dm_proposition_products.py
示例16: _create_control_sector
def _create_control_sector(self):
vals = self.compo
opae_control_string =[]
## chapter 4.2 secteur de controle -> identificateur de fichier
opae_control_string.append(u'036')
if not vals.get('line_date', False) :
raise wizard.except_wizard(
_('Error'),
_('Missing date planned \n' \
'for the payment order line: %s\n')
)
## chapter 4.2 secteur de controle -> date decheance
opae_control_string.append(vals['line_date'])
## chapter 4.2 secteur de controle -> reserve + element de commande fix val
opae_control_string.append('0'* 5 + '1')
## chapter 4.2 secteur de controle -> No de compte de debit
opae_control_string.append(vals['debit_account_number'].rjust(6,u'0'))
## chapter 4.2 secteur de controle -> N0 de compte de debit de tax
opae_control_string.append(vals['debit_account_number'].rjust(6,u'0'))
opae_control_string.append(vals['order_number'])
try:
print vals['transaction_type'], CODEEQUIV
opae_control_string.append(CODEEQUIV[vals['transaction_type']])
except Exception, e:
raise wizard.except_wizard(_('Error'), _("Type doesn 't exists or isn 't supported yet."))
开发者ID:MarkNorgate,项目名称:addons-EAD,代码行数:30,代码来源:opae_wizard.py
示例17: _scheduling
def _scheduling(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
hr_int_obj = pool.get("hr.interview")
if time.strptime(str(data['form']['start_interview']),"%Y-%m-%d %H:%M:%S") < time.strptime(data['form']['end_interview'],"%Y-%m-%d %H:%M:%S") and time.strptime(str(data['form']['start_interview']),"%Y-%m-%d %H:%M:%S")[:3] ==time.strptime(str(data['form']['end_interview']),"%Y-%m-%d %H:%M:%S")[:3] :
if datetime.datetime(*time.strptime(str(data['form']['end_interview']),"%Y-%m-%d %H:%M:%S")[:6]) >= datetime.datetime(*time.strptime(str(data['form']['start_interview']),"%Y-%m-%d %H:%M:%S")[:6]) + datetime.timedelta(minutes=int(data['form']['interval_time'])):
cur_time = data['form']['start_interview']
re_id = deepcopy(data['ids'])
list_all="Interview ID \t Name "
for rec in data['ids']:
wf_service = netsvc.LocalService('workflow')
wf_service.trg_validate(uid, 'hr.interview', rec, 'state_scheduled', cr)
record = hr_int_obj.read(cr,uid,rec,['hr_id','name'])
list_all +="\n" + record['hr_id']+"\t\t" + record['name']
id = hr_int_obj.write(cr,uid,rec,{'date':cur_time,'state':'scheduled'})
cur_time = datetime.datetime(*time.strptime(str(cur_time),"%Y-%m-%d %H:%M:%S")[:6]) + datetime.timedelta(minutes=int(data['form']['interval_time']))
re_id.remove(rec)
end_time = datetime.datetime(*time.strptime(str(cur_time),"%Y-%m-%d %H:%M:%S")[:6]) + datetime.timedelta(minutes=int(data['form']['interval_time']))
if len(re_id) > 0 and time.strptime(str(end_time),"%Y-%m-%d %H:%M:%S") > time.strptime(data['form']['end_interview'],"%Y-%m-%d %H:%M:%S") :
remain="Interview ID \t Name "
for record in hr_int_obj.read(cr,uid,re_id,['hr_id','name']):
remain +="\n" + record['hr_id']+"\t\t" + record['name']
data['form']['list']=remain
data['form']['list_all']=list_all
return data['form']
else :
raise wizard.except_wizard(_('UserError'),_('Insert appropriate interval time!!!'))
return {}
else :
raise wizard.except_wizard(_('UserError'),_('The Scheduling is not Appropriate. Enter appropriate date and time '))
return {}
data['form']['list_all']= list_all
data['form']['list']= "None"
return data['form']
开发者ID:3dfxmadscientist,项目名称:odoo-extra-1,代码行数:35,代码来源:wiz_schedule.py
示例18: _upload
def _upload(self, cr, uid, datas, context):
pool = pooler.get_pool(cr.dbname)
mod = pool.get('ir.module.module').browse(cr, uid, datas['id'])
download = datas['form']['url_download'] or ''
if not download:
res = module_zip.createzip(cr, uid, datas['id'], context,
b64enc=False, src=datas['form']['include_src'])
download = 'http://www.openerp.com/download/modules/'+res['module_filename']
result = post_multipart('www.openerp.com', '/mtree_upload.php',
[
('login', datas['form']['login']),
('password', datas['form']['password']),
('module_name', str(mod.name))
], [
('module', res['module_filename'], res['module_file'])
])
if result and result[0] == "1":
raise wizard.except_wizard(_('Error'), _('Login failed!'))
elif result and result[0] == "2":
raise wizard.except_wizard(_('Error'),
_('This version of the module is already exist on the server'))
elif result and result[0] != "0":
raise wizard.except_wizard(_('Error'), _('Failed to upload the file'))
updata = {
'link_name': mod.shortdesc or '',
'new_cat_id': datas['form']['category'],
'link_desc': (mod.description or '').replace('\n','<br/>\n'),
'website': mod.website or '',
'price': '0.0',
'email': datas['form']['email'] or '',
'cust_1': download,
'cust_2': datas['form']['demourl'] or '', # Put here the download url
'cust_3': mod.url or '/',
'cust_4': datas['form']['docurl'] or '',
'cust_5': datas['form']['license'] or '',
'cust_6': mod.installed_version or '0',
'cust_7': mod.name,
'option': 'com_mtree',
'task': 'savelisting',
'Itemid': '99999999',
'cat_id': '0',
'adminForm': '',
'auto_login': datas['form']['login'],
'auto_password': datas['form']['password']
}
name = mod.name
a = urllib.urlopen('http://www.openerp.com/mtree_interface.php?module=%s' % (name,))
aa = a.read()
if aa[0]<>'0':
updata['link_id']=aa.split('\n')[0]
updata['option'] = 'mtree'
files = []
if datas['form']['image']:
files.append(('link_image', 'link_image.png',
base64.decodestring(datas['form']['image'])))
result = post_multipart('www.openerp.com', '/index.php', updata.items(), files)
return {'result': result}
开发者ID:MarkNorgate,项目名称:addons-EAD,代码行数:59,代码来源:base_module_publish.py
示例19: _get_defaults
def _get_defaults(self, cr, uid, data, context):
inv_obj = pooler.get_pool(cr.dbname).get('account.invoice')
for obj_inv in inv_obj.browse(cr,uid,data['ids']):
if obj_inv.type not in ('out_invoice','out_refund'):
raise wizard.except_wizard('User Error!','VCS is associated with Customer Invoices and Refund only.')
if not obj_inv.number:
raise wizard.except_wizard('Data Insufficient!','No Invoice Number Associated with the Invoice ID '+ str(obj_inv.id) +'!')
return data['form']
开发者ID:3dfxmadscientist,项目名称:odoo-extra-1,代码行数:8,代码来源:cci_wizard_vcs.py
示例20: _check_state
def _check_state(self, cr, uid, data, context):
job_obj = pooler.get_pool(cr.dbname).get('etl.job')
job = job_obj.browse(cr, uid, data['ids'])[0]
if not job.state in ('draft'):
raise wizard.except_wizard(_('Job not in draft state !'), _('You can not add transitions in job which is in "%s" state') % job.state.upper())
if len(job.component_ids) < 2:
raise wizard.except_wizard(_('No enough Components !'), _('You need at-least two component to add transition'))
return {}
开发者ID:3dfxmadscientist,项目名称:odoo-extra-1,代码行数:8,代码来源:wizard_add_transitions.py
注:本文中的wizard.except_wizard函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论