• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python tools.email_send函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tools.email_send函数的典型用法代码示例。如果您正苦于以下问题:Python email_send函数的具体用法?Python email_send怎么用?Python email_send使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了email_send函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _send_reminder

    def _send_reminder(self, cr, uid, data, context):

        partner = data['form']['partner_id'][0][2]
        if partner:
            res = pooler.get_pool(cr.dbname).get('ecommerce.partner').browse(cr, uid, partner)
            for partner in res:
                if partner.address_ids and not partner.address_ids[0].email:
                    not_sent.append(partner.name)
                for adr in partner.address_ids:
                    if adr.email:
                        sent_dict[partner.name] = adr.email
                        name = adr.username or partner.name
                        to = '%s <%s>' % (name, adr.email)
                        mail_from = '[email protected]'
                       
                        attach_ids = pooler.get_pool(cr.dbname).get('ir.attachment').search(cr, uid, 
                                                                                            [('res_model', '=', 'ecommerce.shop'),
                                                                                            ('res_id', '=', data['ids'][0])])
                        res_atc = pooler.get_pool(cr.dbname).get('ir.attachment').read(cr, uid,
                                                                                       attach_ids, ['datas_fname', 'datas'])
                        res_atc = map(lambda x: (x['datas_fname'],
                                                 base64.decodestring(x['datas'])), res_atc)
                        tools.email_send(mail_from, [to], data['form']['subject'], data['form']['message'], attach=res_atc)

        return 'finished'
开发者ID:3dfxmadscientist,项目名称:odoo-extra-1,代码行数:25,代码来源:wizard_mailsend.py


示例2: check_not_sync

    def check_not_sync(self, cr, uid, context=None):
        entity_obj = self.pool.get('sync.server.entity')
        entity_activity_obj = self.pool.get('sync.server.entity.activity')
        date_tools = self.pool.get('date.tools')

        ids = self.search(cr, uid, [('name', '!=', False)])
        if not ids:
            return False
        template = self.browse(cr, uid, ids[0])
        thresold_date = (datetime.now() + timedelta(days=-template.nb_days)).strftime('%Y-%m-%d %H:%M:%S')
        entity_to_check_ids = entity_obj.search(cr, uid, [('state', 'in', ['validated', 'updated'])])
        if not entity_to_check_ids:
            return False
        activity_ids = entity_activity_obj.search(cr, uid, [('entity_id', 'in', entity_to_check_ids), ('datetime', '<=', thresold_date)])
        if not activity_ids:
            return False
        warn_ids = []
        for act in entity_activity_obj.read(cr, uid, activity_ids, ['entity_id']):
            warn_ids.append(act['entity_id'])

        emails = template.name.split(',')
        subject = _('SYNC_SERVER: instances did not perform any sync')
        body = _('''Hello,
The sync server detected that the following instances did not perform any sync since %d days:
''') % template.nb_days

        for entity in entity_obj.browse(cr, uid, warn_ids):
            body += _("  - %s last sync: %s\n") % (entity.name, entity.last_dateactivity and date_tools.get_date_formatted(cr, uid, 'datetime', entity.last_dateactivity) or _('never'))

        body += _("\n\nThis is an automatically generated email, please do not reply.\n")

        tools.email_send(False, emails, subject, body)
        return True
开发者ID:hectord,项目名称:unifield,代码行数:33,代码来源:sync_server.py


示例3: request_send

	def request_send(self, cr, uid, ids, context={}):
		res = super( res_request, self ).request_send( cr, uid, ids, context )

		eagle_param = self.__get_eagle_parameters( cr, uid, context=context )
		if not eagle_param or not eagle_param.send_mail_with_request:
			netsvc.Logger().notifyChannel( 'addons.'+self._name, netsvc.LOG_DEBUG, "The request won't send any email because it's parameterized as is." )
			return res

		if not tools.config.get('smtp_server'):
			netsvc.Logger().notifyChannel( 'addons.'+self._name, netsvc.LOG_DEBUG, "The request can't send any email because there's no stmp server defined..." )
			return res

		for request in self.browse( cr, uid, ids ):
			if not request.send_mail: continue
			if not request.act_from.user_email: 
				netsvc.Logger().notifyChannel( 'addons.'+self._name, netsvc.LOG_DEBUG, "The request '%s' can't send any email because there's no email defined for the sender..." % request.name )
				continue
			if not request.act_to.user_email: 
				netsvc.Logger().notifyChannel( 'addons.'+self._name, netsvc.LOG_DEBUG, "The request '%s' can't send any email because there's no email defined for the recipient..." % request.name )
				continue
			netsvc.Logger().notifyChannel( 'addons.'+self._name, netsvc.LOG_DEBUG, "About to send an email to %s from %s with the following subject: %s" % (request.act_to.user_email,request.act_from.user_email,request.name) )
			level = {'0': _('Low'),'1': _('Normal'),'2': _('High')}[request.priority]
			tools.email_send(
				email_from=request.act_from.user_email,
				email_to=[request.act_to.user_email],
				subject='['+level+'] '+request.name,
				body=request.body
				)
		return res
开发者ID:3dfxmadscientist,项目名称:odoo-extra-1,代码行数:29,代码来源:requests.py


示例4: cron_account_analytic_account

    def cron_account_analytic_account(self, cr, uid, context=None):
        domain = [
            ('name', 'not ilike', 'maintenance'),
            ('partner_id', '!=', False),
            ('user_id', '!=', False),
            ('user_id.user_email', '!=', False),
            ('state', 'in', ('draft', 'open')),
            '|', ('date',  '<', time.strftime('%Y-%m-%d')), ('date', '=', False),
        ]

        account_ids = self.search(cr, uid, domain, context=context, order='name asc')
        accounts = self.browse(cr, uid, account_ids, context=context)

        users = dict()
        for account in accounts:
            users.setdefault(account.user_id, dict()).setdefault(account.partner_id, []).append(account)

            account.write({'state' : 'pending'}, context=context)

        for user, data in users.iteritems():
            subject = '[OPENERP] Reporting: Analytic Accounts'
            body = Template(MAKO_TEMPLATE).render_unicode(user=user, partners=data)
            tools.email_send('[email protected]', [user.user_email, ], subject, body)

        return True
开发者ID:CloudWareChile,项目名称:OpenChile,代码行数:25,代码来源:cron_account_analytic_account.py


示例5: mail_user

    def mail_user(self, cr, uid, ids, confirm=False, context=None):
        """
        Send email to user
        """

        for regestration in self.browse(cr, uid, ids, context=context):
            src = regestration.event_id.reply_to or False
            email_to = []
            email_cc = []
            if regestration.email_from:
                email_to = regestration.email_from
            if regestration.email_cc:
                email_cc += [regestration.email_cc]
            if not (email_to or email_cc):
                continue
            subject = ""
            body = ""
            if confirm:
                subject = _('Auto Confirmation: [%s] %s') %(regestration.id, regestration.name)
                body = regestration.event_id.mail_confirm
            elif regestration.event_id.mail_auto_confirm or regestration.event_id.mail_auto_registr:
                if regestration.event_id.state in ['draft', 'fixed', 'open', 'confirm', 'running'] and regestration.event_id.mail_auto_registr:
                    subject = _('Auto Registration: [%s] %s') %(regestration.id, regestration.name)
                    body = regestration.event_id.mail_registr
                if (regestration.event_id.state in ['confirm', 'running']) and regestration.event_id.mail_auto_confirm:
                    subject = _('Auto Confirmation: [%s] %s') %(regestration.id, regestration.name)
                    body = regestration.event_id.mail_confirm
            if subject or body:
                tools.email_send(src, email_to, subject, body, email_cc=email_cc, openobject_id=regestration.id)
                self.history(cr, uid, [regestration], subject, history = True, \
                        email=email_to, details=body, \
                        subject=subject, email_from=src, \
                        email_cc=', '.join(email_cc))

        return True
开发者ID:fofowisworkingattelenais,项目名称:modulmodul,代码行数:35,代码来源:event.py


示例6: _mass_mail_send

def _mass_mail_send(self, cr, uid, data, context):
    nbr = 0
    partners = []
    contacts = pooler.get_pool(cr.dbname).get('res.partner.contact').browse(cr, uid, data['ids'], context)
    for contact in contacts:
#        for adr in partner.address:
        if contact.email:
            name = contact.name or contact.partner_id.name
            to = '%s <%s>' % (name, contact.email)
#TODO: add some tests to check for invalid email addresses
#CHECKME: maybe we should use res.partner/email_send
            res = tools.email_send(data['form']['from'], [to], data['form']['subject'], data['form']['text'], subtype='html')
            nbr += 1
        else:
            for adr in contact.partner_id.address:
                if adr.email:
                    name = adr.name or partner.name
                    to = '%s <%s>' % (name, adr.email)
    #TODO: add some tests to check for invalid email addresses
    #CHECKME: maybe we should use res.partner/email_send
                    res = tools.email_send(data['form']['from'], [to], data['form']['subject'], data['form']['text'], subtype='html')
                    nbr += 1
        pooler.get_pool(cr.dbname).get('res.partner.event').create(cr, uid,
                {'name': 'Email sent through mass mailing From Contact',
                 'partner_id': contact.partner_id.id,
                 'description': data['form']['text'], })
        partners.append(contact.partner_id.id)
    data['form']['partners'] = partners
    data['form']['nbr'] = nbr
    if data['form']['event']:
        return 'open'
    return 'ok'
开发者ID:3dfxmadscientist,项目名称:odoo-extra-1,代码行数:32,代码来源:cci_wizard_spam_contact.py


示例7: _mass_mail_send

def _mass_mail_send(self, cr, uid, data, context):
    nbr = 0
    partners = []
    jobs = pooler.get_pool(cr.dbname).get('res.partner.job').browse(cr, uid, data['ids'], context)
    for job in jobs:
        if job.email:
            name = job.address_id.name or job.name.name
            to = '%s <%s>' % (name, job.email)
#TODO: add some tests to check for invalid email addresses
#CHECKME: maybe we should use res.partner/email_send
            res = tools.email_send(data['form']['from'], [to], data['form']['subject'], data['form']['text'], subtype='html')
            nbr += 1
        elif job.address_id.email:
            name = job.address_id.name or job.name.name
            to = '%s <%s>' % (name, job.address_id.email)
            res = tools.email_send(data['form']['from'], [to], data['form']['subject'], data['form']['text'], subtype='html')
            nbr += 1
        pooler.get_pool(cr.dbname).get('res.partner.event').create(cr, uid,
                {'name': 'Email sent through mass mailing from Job',
                 'partner_id': job.name and job.name.id or job.address_id.partner_id.id,
                 'description': data['form']['text'], })
        partners.append(job.name and job.name.id or job.address_id.partner_id.id)
    data['form']['nbr'] = nbr
    data['form']['partners'] = partners
    if data['form']['event']:
        return 'open'
    return 'ok'
开发者ID:3dfxmadscientist,项目名称:odoo-extra-1,代码行数:27,代码来源:cci_wizard_spam_job.py


示例8: _send_email

 def _send_email(self, cr, uid, sender, recipient, subject, body):
     self._log('Tentative d\'envoi du mail')
     self._log('Envoi d\'un e-mail a ' + recipient + '. Sujet: ' + subject)
     tools.email_send(email_from=sender, email_to=[recipient] , \
                      subject=subject, body=body, cr=cr)
     self._debug("Sending email to " + recipient + ". " + \
         "Subject: \"" + subject + "\"")
开发者ID:Prisme-Solutions-Informatique-SA,项目名称:PRISME-ODOO,代码行数:7,代码来源:data_prisme_warranty_warranty.py


示例9: run_auto_import

    def run_auto_import(self, cr, uid, automatic=False, use_new_cursor=False, context=None):
      pool = pooler.get_pool(cr.dbname)  
      #import pdb;pdb.set_trace()
      testo_log = """Inizio procedura di aggiornamento/inserimento articoli """+time.ctime()+'\n'
      percorso='/home/openerp/filecsv'
      partner_obj = pool.get('res.partner')
      if use_new_cursor:
        cr = pooler.get_db(use_new_cursor).cursor()
      elenco_csv = os.listdir(percorso)
      for filecsv in elenco_csv:
        codfor=filecsv.split(".")
        testo_log = testo_log + " analizzo file "+codfor[0]+".csv \n"
        fornitore_ids = partner_obj.search(cr,uid,[('ref', '=',codfor[0])])
        if fornitore_ids:
          fornitore_id = fornitore_ids[0]
          lines = csv.reader(open(percorso+'/'+filecsv,'rb'),delimiter=";")
          #import pdb;pdb.set_trace() 
          res = self._import_product_func(cr, uid, lines, fornitore_id, context)
          testo_log = testo_log + " Inseriti "+str(res[0])+" Aggiornati "+str(res[1]) +" Articoli \n"
        else:
          testo_log = testo_log + " fornitore "+codfor[0]+" non trovato  \n"
        os.remove(percorso+'/'+filecsv)
      testo_log = testo_log + " Operazione Teminata  alle "+time.ctime()+"\n"
      #invia e-mail
      type_ = 'plain'
      tools.email_send('[email protected]',
                       ['[email protected]'],
                       'Import Automatico Articoli',
                       testo_log,
                       subtype=type_,
                       )

        
      return
开发者ID:cgsoftware,项目名称:ImportParArticoli,代码行数:34,代码来源:partner.py


示例10: _check

	def _check(self, cr, uid, context={}):
		req = cr.execute("SELECT DISTINCT email_alert FROM hr_employee WHERE email_alert is not null")	
		mails = cr.dictfetchall(req)
		emails=[]		
		for mail in mails:	
			req = cr.execute("SELECT name, medic_exam, last_medic_exam, medic_exam_alert FROM hr_employee WHERE medic_exam_alert < NOW() and email_alert=%s",(mail['email_alert'],))
			res = cr.dictfetchall(req)
			email=[]		
			if res :		
				email.append(mail['email_alert'])
				body="liste des visites médicales à passer\n"
				body+="-----------------------------------------------------------\n"
				body+="| date alerte | date visite   | Nom\n"					
				for line in res:				
					body+="| "+line['medic_exam_alert']+"  | "+line['medic_exam']+"    | "+line['name']+"\n"
				body+="-----------------------------------------------------------\n"
				body+="Cette email a été envoyé par tinyerp sur :"+mail['email_alert']+"\n"
				email_from = "[email protected]"
				subject = "Alerte Visite Médicale"			
				#print body
				email_cc= False
				email_bcc=False
				on_error=False
				reply_to=False
				attach=None 
				tinycrm=False
				"""Send an email."""
				#print "Run medical exam Cron"			
				tools.email_send(email_from, email, subject, body, email_cc=None, email_bcc=None, on_error=False, reply_to=False, tinycrm=False)

		return True
开发者ID:sgeerish,项目名称:sirr_production,代码行数:31,代码来源:hr_medical.py


示例11: remind_user

    def remind_user(self, cr, uid, ids, context=None, attach=False, destination=True):
        """
        @param self: The object pointer
        @param cr: the current row, from the database cursor,
        @param uid: the current user’s ID for security checks,
        @param ids: List of case's IDs to remind
        @param context: A standard dictionary for contextual values
        """
        for case in self.browse(cr, uid, ids, context=context):
            if not destination and not case.email_from:
                return False
            if not case.user_id.user_email:
                return False

            if destination and case.section_id.user_id:
                case_email = case.section_id.user_id.user_email
            else:
                case_email = case.user_id.user_email

            src = case_email
            dest = case.user_id
            body = case.description or ""
            if case.message_ids:
                body = case.message_ids[0].description or ""
            if not destination:
                src, dest = dest, case.email_from
                if body and case.user_id.signature:
                    if body:
                        body += "\n\n%s" % (case.user_id.signature)
                    else:
                        body = "\n\n%s" % (case.user_id.signature)

            body = self.format_body(body)

            attach_to_send = None

            if attach:
                attach_ids = self.pool.get("ir.attachment").search(
                    cr, uid, [("res_model", "=", self._name), ("res_id", "=", case.id)]
                )
                attach_to_send = self.pool.get("ir.attachment").read(cr, uid, attach_ids, ["datas_fname", "datas"])
                attach_to_send = map(lambda x: (x["datas_fname"], base64.decodestring(x["datas"])), attach_to_send)

                # Send an email
            subject = "Reminder: [%s] %s" % (str(case.id), case.name)
            tools.email_send(
                src,
                [dest],
                subject,
                body,
                reply_to=case.section_id.reply_to or "",
                openobject_id=str(case.id),
                attach=attach_to_send,
            )
            self._history(
                cr, uid, [case], _("Send"), history=True, subject=subject, email=dest, details=body, email_from=src
            )

        return True
开发者ID:goldenboy,项目名称:razvoj,代码行数:59,代码来源:crm.py


示例12: _action

    def _action(self, cr, uid, cases, state_to, scrit=None, context={}):
        super(crm_case, self)._action(cr, uid, cases, state_to, scrit=None, context={})
        if not scrit:
            scrit = []
        action_obj = self.pool.get('crm.case.rule')
        action_ids= action_obj.search(cr, uid, scrit)
        actions = self.pool.get('crm.case.rule').browse(cr, uid, action_ids, context)
        
        category={}
        cat_obj = self.pool.get('crm.bayes.categories')
        cat_rec = cat_obj.read(cr, uid, cat_obj.search(cr, uid, []),['name'])
        for cat in cat_rec:
            category[cat['name']] = cat['id']
            
        for case in cases:
            for action in actions:
                if action.category_id == case.category_id:
                    if action.action == "don't perform statistic test":
                        break
                    result_perform = self.guess_message(cr, uid, case.id, context)
                    if action.action == "perform action only":
                        if result_perform:
                            res = max(result_perform, key=lambda k: k[1])
                            if res[1] >= action.main_category_rate:
                                self.write(cr, uid, case.id, {'category_id':category[res[0]]})
                            elif action.sec_category_rate :
                                sec_result = copy.deepcopy(result_perform)
                                sec_result.pop(sec_result.index (max (result_perform, key=lambda k: k[1])))
                                if sec_result:
                                    re = max(sec_result, key=lambda k: k[1])
                                    if re[1] <= action.main_category_rate and re[1] >= action.sec_category_rate:
                                        self.write(cr, uid, case.id, {'category_id':category[re[0]]})

                    elif action.action == "perform action and assign category" :
                        if result_perform :
                            max_list = max(result_perform, key=lambda k: k[1])
                            self.write(cr, uid, case.id, {'category_id':category[max_list[0]]})

                    cate = self.read(cr, uid, case.id, ['category_id'])
                    if cate['category_id'] :
                        a_ids = action_obj.search(cr, uid,[('category_id','=',cate['category_id'][0])])
                        action_rec = action_obj.browse(cr,uid,a_ids[0])
                        if action_rec:
                            if action_rec.category_id.name == cate['category_id'][1] and case.email_from :
                                emails = []
                                emails.append(case.email_from)
                                if len(emails) and action_rec.act_mail_body:
                                    body = action_rec.act_mail_body
                                    if case.user_id and case.user_id.address_id and case.user_id.address_id.email:
                                        emailfrom = case.user_id.address_id.email
                                    else:
                                        emailfrom = case.section_id.reply_to
                                    name = '[%d] %s' % (case.id, case.name.encode('utf8'))
                                    reply_to = case.section_id.reply_to or False
                                    if reply_to: reply_to = reply_to.encode('utf8')
                                    if emailfrom:
                                        tools.email_send(emailfrom, emails, name, body, reply_to=reply_to, tinycrm=str(case.id))
                    break
        return True
开发者ID:3dfxmadscientist,项目名称:odoo-extra-1,代码行数:59,代码来源:crm_bayes.py


示例13: _create_user

def _create_user(self, cr, uid, data, context):
    pool = pooler.get_pool(cr.dbname)
    portal = pool.get("portal.portal").browse(cr, uid, data["form"]["portal_id"])
    user_ref = pool.get("res.users")
    out = "login,password\n"
    skipped = 0
    existing = ""
    created = ""
    for partner in pool.get("res.partner").browse(cr, uid, data["ids"]):
        for addr in partner.address:
            if not addr.email:
                skipped += 1
                continue
            user = user_ref.search(cr, uid, [("login", "=", addr.email)])

            if user:
                user = user_ref.browse(cr, uid, user[0])
                existing += "- %s (Login: %s,  Password: %s)\n" % (user.name, addr.email, user.password)
                mail = data["form"]["mail"] % {"login": addr.email, "passwd": user.password}
                if data["form"]["send_mail_existing"]:
                    if not data["form"]["mail_from"]:
                        raise wizard.except_wizard("Error !", 'Please provide a "from" email address.')
                    tools.email_send(
                        data["form"]["mail_from"], [addr.email], data["form"]["mail_subject_existing"], mail
                    )
                continue

            passwd = genpasswd()
            out += addr.email + "," + passwd + "\n"
            user_ref.create(
                cr,
                uid,
                {
                    "name": addr.name or "Unknown",
                    "login": addr.email,
                    "password": passwd,
                    "address_id": addr.id,
                    "action_id": portal.home_action_id and portal.home_action_id.id or portal.menu_action_id.id,
                    "menu_id": portal.menu_action_id.id,
                    "groups_id": [(4, portal.group_id.id)],
                    "company_id": portal.company_id.id,
                },
            )
            mail = data["form"]["mail"] % {"login": addr.email, "passwd": passwd}
            if data["form"]["send_mail"]:
                if not data["form"]["mail_from"]:
                    raise wizard.except_wizard("Error !", 'Please provide a "from" email address.')
                tools.email_send(data["form"]["mail_from"], [addr.email], data["form"]["mail_subject"], mail)
            created += "- %s (Login: %s,  Password: %s)\n" % (addr.name or "Unknown", addr.email, passwd)

    note = ""
    if created:
        note += "Created users:\n%s\n" % (created)
    if existing:
        note += "Already existing users:\n%s\n" % (existing)
    if skipped:
        note += "%d contacts where ignored (an email address is missing).\n" % (skipped)
    return {"note": note}
开发者ID:dxyuniesky,项目名称:openerp-extra-6.1,代码行数:58,代码来源:create_user.py


示例14: button_done

    def button_done(self, cr, uid, ids, context):
        evaluation_obj = self.pool.get('hr.evaluation')
        setting_obj = self.pool.get('hr.evaluation.setting')
        answ_obj = pooler.get_pool(cr.dbname).get('hr.evaluation.values')
        eval_form_obj = self.pool.get('hr.evaluation.form')
        users_obj = self.pool.get('res.users')
        criteria_obj = self.pool.get('hr.evaluation.criteria')
        curr_employee = evaluation_obj.browse(cr, uid, ids)[0].employee_id
        setting_id = []
        employee_obj = self.pool.get('hr.employee')
        employee_ids = employee_obj.search(cr, uid, [('parent_id', '=', curr_employee.id)])
        mail_send = users_obj.browse(cr, uid, uid).address_id
        email_from = mail_send and mail_send.email or None
        subject = 'Notification for Evaluation'
        body = 'Please fill forms of evaluation!'
        employee_ids.append(curr_employee.id)
        if curr_employee.parent_id:
            employee_ids.append(curr_employee.parent_id.id)
        for evaluation in evaluation_obj.browse(cr, uid, ids):
            for employee in employee_obj.browse(cr, uid, employee_ids):
                ## ADdd criteria basing on products
                new_criteria_ids = []
                prdct_id = employee.product_id.id
                if prdct_id:
                    setting_id = setting_obj.search(cr, uid, [('product_id', '=', prdct_id)])
                    if setting_id:
                        setting_ids = setting_obj.browse(cr, uid, setting_id)
                        for set_id in setting_ids:
                            for crit in set_id.criteria_ids:
                               # new_criteria_ids.append(criteria_obj.copy(cr, uid, crit.id,{}))
                                new_criteria_ids.append(crit.id)
               # for crit in  curr_employee.grid_id.criteria_ids:
               #     new_criteria_ids.append(criteria_obj.copy(cr, uid, crit.id,{'grid_id':False}))
                if not setting_id:
                    raise osv.except_osv(_('Error'), _('Please set a job that defines setting to your employee "%s"!') % (employee.name or ''))

                mail_emp = self.browse(cr, uid, employee).user_id
                email_to = mail_emp and mail_emp.address_id and mail_emp.address_id.email or None
                if email_to:
                    tools.email_send(email_from, email_to, subject, body, None)
                eval_id = eval_form_obj.create(cr, uid, {
                                    'name': evaluation.name + ((evaluation.next_eval and'/' + evaluation.next_eval) or ''),
                                    'employee_id': evaluation.employee_id.id,
                                    'employee_id2': employee.id,
                                    'eval_id': evaluation.id,
                                    'state': 'draft',
                                    'setting_id': setting_id and setting_id[0] or None,
           #                         'criteria_ids':[(6,0, new_criteria_ids)]
                                    }, context)
                item = eval_form_obj.browse(cr, uid, eval_id)
                for crit in new_criteria_ids:
                    answ_obj.create(cr, uid, {'employee_id': item.employee_id.id,
                                            'criteria_id': crit,
                                            'form_id': eval_id,
                                    })
        self.write(cr, uid, ids, {'state': 'pending'})

        return True
开发者ID:3dfxmadscientist,项目名称:odoo-extra-1,代码行数:58,代码来源:evaluation.py


示例15: send_mail

 def send_mail(self, cr, uid, ids, context=None):
     hr_evaluation_interview_obj = self.pool.get('hr.evaluation.interview')
     evaluation_data = self.read(cr, uid, ids, context=context)[0]
     current_interview = hr_evaluation_interview_obj.browse(cr, uid, evaluation_data.get('evaluation_id'))
     if current_interview.state == "waiting_answer" and current_interview.user_to_review_id.work_email :
         msg = " Hello %s, \n\n Kindly post your response for '%s' survey interview. \n\n Thanks,"  %(current_interview.user_to_review_id.name, current_interview.survey_id.title)
         tools.email_send(tools.config['email_from'], [current_interview.user_to_review_id.work_email],\
                                       'Reminder to fill up Survey', msg)
     return {'type': 'ir.actions.act_window_close'}
开发者ID:fofowisworkingattelenais,项目名称:modulmodul,代码行数:9,代码来源:hr_evaluation_mail.py


示例16: _send_notification_email

 def _send_notification_email(self, result):
     if not self.email:
         return 		 
     tools.email_send(
             '[email protected]',
             self.email,
             self.get_email_subject(result),
             self.get_email_body(result),
         )
     logger = logging.getLogger('import_sugarcam')
     logger.info("Import finished, notification email sended")
开发者ID:goldenboy,项目名称:razvoj,代码行数:11,代码来源:import_framework.py


示例17: _send_mail

    def _send_mail(self, cr, uid, data, context):

        # Check of the first email address given by the user
        ptrn = re.compile('(\[email protected]\w+(?:\.\w+)+)')
        result=ptrn.search(data['form']['email_to'])
        if result==None:
            raise wizard.except_wizard('Error !', 'Enter Valid Destination E-Mail Address.')

        # Check of the first second email address given by the user
        ptrn = re.compile('(\[email protected]\w+(?:\.\w+)+)')
        result=ptrn.search(data['form']['email_rcp'])
        if result==None:
            raise wizard.except_wizard('Error !', 'Enter Valid Reception E-Mail Address.')

        # Determine the first and last date to select
        month=data['form']['month']
        year=int(data['form']['year'])
        self.first_day=datetime.date(year,int(month),1)
        self.last_day=datetime.date(year,int(month),lengthmonth(year, int(month)))
        period="to_date('" + self.first_day.strftime('%Y-%m-%d') + "','yyyy-mm-dd') and to_date('" + self.last_day.strftime('%Y-%m-%d') +"','yyyy-mm-dd')"

        #determine the type of certificates to send
        certificate_type = data['form']['cert_type']
        cancel_clause = not(data['form']['canceled']) and " and b.state not in ('cancel_customer','cancel_cci')" or ''
        query = 'select a.id from cci_missions_certificate as a, cci_missions_dossier as b where ( a.dossier_id = b.id ) and ( a.sending_spf is null ) and ( b.type_id = %s ) and ( b.date between %s )' + cancel_clause
        #Extraction of corresponding certificates
        cr.execute(query % (certificate_type,period))
        res_file1=cr.fetchall()

        #If no records, cancel of the flow
        if res_file1==[]:
            raise wizard.except_wizard('Notification !', 'No Records Found to be sended. Check your criteria.')

        lines=[]
        root_path=tools.config.options['root_path']
        if res_file1:
            lines=self.make_lines(cr, uid, res_file1, data )
            self.write_txt(root_path+'/certificates.txt',lines)

        # Sending of the file as attachment
        files_attached=[]
        file1=tools.file_open(root_path+'/certificates.txt','rb',subdir=None)
        files_attached=[('certificates.txt',file1.read())]

        src = tools.config.options['smtp_user']  # parametre quand on lance le server ou dans bin\tools\config.py
        dest = [data['form']['email_to']]
        body = "Hello,\nHere are the certificates files for Federation.\nThink Big Use Tiny."
        tools.email_send(src,dest,"Federation Sending Files From TinyERP",body,attach=files_attached)
        pool = pooler.get_pool(cr.dbname)
        certificates_ids = [x[0] for x in res_file1]
        obj_certificate = pool.get('cci_missions.certificate')
        obj_certificate.write(cr, uid, certificates_ids,{'sending_spf':time.strftime('%Y-%m-%d')})
        return {}
开发者ID:3dfxmadscientist,项目名称:odoo-extra-1,代码行数:53,代码来源:wizard_federation_certificates_sending.py


示例18: button_plan_in_progress

    def button_plan_in_progress(self, cr, uid, ids, context=None):
        hr_eval_inter_obj = self.pool.get("hr.evaluation.interview")
        if context is None:
            context = {}
        for evaluation in self.browse(cr, uid, ids, context=context):
            wait = False
            for phase in evaluation.plan_id.phase_ids:
                children = []
                if phase.action == "bottom-up":
                    children = evaluation.employee_id.child_ids
                elif phase.action in ("top-down", "final"):
                    if evaluation.employee_id.parent_id:
                        children = [evaluation.employee_id.parent_id]
                elif phase.action == "self":
                    children = [evaluation.employee_id]
                for child in children:
                    #                    if not child.user_id:
                    #                        continue

                    int_id = hr_eval_inter_obj.create(
                        cr,
                        uid,
                        {
                            "evaluation_id": evaluation.id,
                            "survey_id": phase.survey_id.id,
                            "date_deadline": (
                                parser.parse(datetime.now().strftime("%Y-%m-%d")) + relativedelta(months=+1)
                            ).strftime("%Y-%m-%d"),
                            "user_id": child.user_id.id,
                            "user_to_review_id": evaluation.employee_id.id,
                        },
                        context=context,
                    )
                    if phase.wait:
                        wait = True
                    if not wait:
                        hr_eval_inter_obj.survey_req_waiting_answer(cr, uid, [int_id], context=context)

                    if (not wait) and phase.mail_feature:
                        body = phase.mail_body % {
                            "employee_name": child.name,
                            "user_signature": child.user_id.signature,
                            "eval_name": phase.survey_id.title,
                            "date": time.strftime("%Y-%m-%d"),
                            "time": time,
                        }
                        sub = phase.email_subject
                        dest = [child.work_email]
                        if dest:
                            tools.email_send(evaluation.employee_id.work_email, dest, sub, body)

        self.write(cr, uid, ids, {"state": "wait"}, context=context)
        return True
开发者ID:proxly,项目名称:ntm_project,代码行数:53,代码来源:hr_evaluation.py


示例19: send_mail_to_salesman

 def send_mail_to_salesman(self, lead):
     email_to = lead.user_id and lead.user_id.user_email
     if not email_to:
         return
     email_from = lead.section_id and lead.section_id.user_id and lead.section_id.user_id.user_email or email_to
     partner = lead.partner_id and lead.partner_id.name or lead.partner_name 
     subject = "lead %s converted into opportunity" % lead.name
     body = "Info \n Id : %s \n Subject: %s \n Partner: %s \n Description : %s " % (lead.id, lead.name, lead.partner_id.name, lead.description)  
     try :
         tools.email_send(email_from, [email_to], subject, body)
     except:
         pass
开发者ID:goldenboy,项目名称:razvoj,代码行数:12,代码来源:crm_lead_to_opportunity.py


示例20: run_auto_import_temp_buste

    def run_auto_import_temp_buste(self, cr, uid, automatic=False, use_new_cursor=False, context=None):
        pool = pooler.get_pool(cr.dbname)
        # import pdb;pdb.set_trace()
        testo_log = (
            """Inizio procedura di Aggiornamento/Inserimento Varianti e Materie Prime su Template Buste """
            + time.ctime()
            + "\n"
        )
        percorso = "/home/openerp/filecsv"
        partner_obj = pool.get("buste.template.head")
        if use_new_cursor:
            cr = pooler.get_db(use_new_cursor).cursor()
        elenco_csv = os.listdir(percorso)
        for filecsv in elenco_csv:
            codfor = filecsv.split(".")
            testo_log = testo_log + " analizzo file " + codfor[0] + ".csv \n"
            lines = csv.reader(open(percorso + "/" + filecsv, "rb"), delimiter=";")
            if codfor[0].lower() == "varianti_buste_pz":
                # carica le varianti con i prezzi
                

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tools.ensure_dev_path函数代码示例发布时间:2022-05-27
下一篇:
Python tools.drop_view_if_exists函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap