当前位置: 首页>>代码示例>>Python>>正文


Python User.finances方法代码示例

本文整理汇总了Python中models.user.User.finances方法的典型用法代码示例。如果您正苦于以下问题:Python User.finances方法的具体用法?Python User.finances怎么用?Python User.finances使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.user.User的用法示例。


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

示例1: apply_pay

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import finances [as 别名]
def apply_pay(invoice_id):
    agent_invoice = searchAdAgentInvoice.get(invoice_id)
    if not agent_invoice:
        abort(404)
    invoice_pay_ids = request.values.getlist('invoices')
    invoice_pays = searchAdAgentInvoicePay.gets(invoice_pay_ids)
    if not invoice_pays:
        abort(403)
    emails = request.values.getlist('email')
    msg = request.values.get('msg', '')
    action = int(request.values.get('action', 0))
    to_users = agent_invoice.client_order.direct_sales + agent_invoice.client_order.agent_sales + \
        [agent_invoice.client_order.creator, g.user] + \
        agent_invoice.client_order.leaders
    to_emails = list(set(emails + [x.email for x in to_users]))
    if action == 2:
        action_msg = u'代理打款申请'
        for invoice in invoice_pays:
            invoice.pay_status = AGENT_INVOICE_STATUS_APPLY
            invoice.save()
            flash(u'[%s代理申请打款,打款金额: %s, 发票号: %s]  %s ' %
                  (invoice.agent_invoice.company, invoice.money,
                   invoice.agent_invoice.invoice_num, invoice.detail), 'success')

            invoice.agent_invoice.client_order.add_comment(g.user, u"%s,%s" % (
                action_msg, u'[%s代理申请打款,打款金额: %s, 发票号: %s]  %s ' %
                (invoice.agent_invoice.company, invoice.money,
                    invoice.agent_invoice.invoice_num, invoice.detail)), msg_channel=5)
        send_type = "saler"
    elif action == 3:
        action_msg = u'同意代理订单打款申请,请财务打款'
        to_emails += [k.email for k in User.finances()]
        for invoice in invoice_pays:
            invoice.pay_status = AGENT_INVOICE_STATUS_AGREE
            invoice.save()
            flash(u'[同意%s代理订单打款申请,打款金额: %s, 发票号: %s]  %s ' %
                  (invoice.agent_invoice.company, invoice.money,
                   invoice.agent_invoice.invoice_num, invoice.detail), 'success')

            invoice.agent_invoice.client_order.add_comment(g.user, u"%s,%s" % (
                action_msg, u'[%s代理同意打款,打款金额: %s, 发票号: %s]  %s ' %
                (invoice.agent_invoice.company, invoice.money,
                    invoice.agent_invoice.invoice_num, invoice.detail)), msg_channel=5)
        send_type = "finance"
    else:
        action_msg = u'消息提醒'

    apply_context = {"to_other": emails,
                     "title": action_msg,
                     "to": to_emails,
                     "action_msg": action_msg,
                     "msg": msg,
                     "invoice": agent_invoice,
                     "send_type": send_type,
                     "invoice_pays": invoice_pays}
    agent_invoice_apply_signal.send(
        current_app._get_current_object(), apply_context=apply_context)
    flash(u'[%s 打款发票开具申请] 已发送邮件给 %s ' %
          (agent_invoice.client_order, ', '.join(to_emails)), 'info')
    return redirect(url_for('searchAd_saler_client_order_agent_invoice.invoice', invoice_id=invoice_id))
开发者ID:giveme168,项目名称:braavos,代码行数:62,代码来源:agent_invoice.py

示例2: apply_invoice

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import finances [as 别名]
def apply_invoice(invoice_id):
    invoice = ClientMediumInvoice.get(invoice_id)
    if not invoice:
        abort(404)
    invoices_ids = request.values.getlist('invoices')
    invoices = ClientMediumInvoice.gets(invoices_ids)
    if not invoices:
        abort(403)
    emails = request.values.getlist('email')
    msg = request.values.get('msg', '')
    action = int(request.values.get('action', 0))
    to_users = invoice.client_medium_order.direct_sales + invoice.client_medium_order.agent_sales + \
        [invoice.client_medium_order.creator, g.user] + \
        invoice.client_medium_order.leaders
    send_type = "saler"
    if action == 2:
        invoice_status = INVOICE_STATUS_APPLY
        action_msg = u'客户发票开具申请'
    elif action == 3:
        to_users = User.finances()
        invoice_status = INVOICE_STATUS_APPLYPASS
        action_msg = u'同意客户发票开具申请'
        send_type = "finance"
    elif action == 4:
        invoice_status = INVOICE_STATUS_FAIL
        action_msg = u'客户发票开具申请未通过'
    if action != 10:
        for invoice in invoices:
            invoice.invoice_status = invoice_status
            invoice.create_time = datetime.date.today()
            invoice.save()
            flash(u'[%s 发票开具申请,发票金额%s]  %s ' %
                  (invoice.company, invoice.money, action_msg), 'success')
            invoice.client_medium_order.add_comment(g.user, u"%s,%s" % (
                action_msg, u'发票内容: %s; 发票金额: %s元' % (invoice.detail, str(invoice.money))), msg_channel=1)
    else:
        action_msg = u'消息提醒'

    context = {"to_users": to_users,
               "action_msg": action_msg,
               "info": msg,
               "order": invoice.client_medium_order,
               "send_type": send_type,
               "action": action,
               "invoices": invoices,
               "to_other": emails
               }
    invoice_apply_signal.send(
        current_app._get_current_object(), context=context)
    return redirect(url_for("saler_client_medium_order_invoice.index", order_id=invoice.client_medium_order.id))
开发者ID:giveme168,项目名称:braavos,代码行数:52,代码来源:invoice.py

示例3: agent_invoice_apply

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import finances [as 别名]
def agent_invoice_apply(sender, apply_context):
    invoice = apply_context['invoice']
    order = invoice.client_order
    invoice_pays = apply_context['invoice_pays']
    invoice_info = u"发票信息: " + invoice.detail + u'; 发票金额: ' + \
        str(invoice.money) + u'; 发票号: ' + invoice.invoice_num + \
        u'; 未打款金额: ' + str(invoice.get_unpay_money)
    invoice_pay_info = "\n".join(
        [u'打款金额: ' + str(o.money) + u'; 打款时间: ' + o.pay_time_cn + u'; 留言信息: ' + o.detail for o in invoice_pays])
    if apply_context['send_type'] == "saler":
        if order.__tablename__ == 'searchAd_bra_client_order':
            url = mail.app.config[
                'DOMAIN'] + '/saler/searchAd_order/agent_invoice/%s/invoice' % (invoice.id)
            name = u'盖新'
        else:
            url = mail.app.config[
                'DOMAIN'] + '/saler/client_order/agent_invoice/%s/invoice' % (invoice.id)
            name = u'黄亮'
    else:
        if order.__tablename__ == 'searchAd_bra_client_order':
            url = mail.app.config[
                'DOMAIN'] + '/finance/searchAd_order/agent_pay/%s/info' % (invoice.client_order_id)
        else:
            url = mail.app.config[
                'DOMAIN'] + '/finance/client_order/agent_pay/%s/info' % (invoice.client_order_id)
        name = ', '.join([k.name for k in User.finances()])
    text = u"""%s

Dear %s:

订单: %s
链接地址: %s
发票信息:
%s

打款信息:
%s

留言如下:
    %s
\n
by %s
""" % (apply_context['action_msg'], name, order.name, url, invoice_info, invoice_pay_info, apply_context['msg'], g.user.name)
    send_simple_mail(
        apply_context['title'], recipients=apply_context['to'], body=text)
开发者ID:giveme168,项目名称:braavos,代码行数:47,代码来源:signals.py

示例4: apply_pay

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import finances [as 别名]
def apply_pay(invoice_id):
    agent_invoice = AgentInvoice.get(invoice_id)
    if not agent_invoice:
        abort(404)
    invoice_pay_ids = request.values.getlist('invoices')
    invoice_pays = AgentInvoicePay.gets(invoice_pay_ids)
    if not invoice_pays:
        abort(403)
    emails = request.values.getlist('email')
    msg = request.values.get('msg', '')
    action = int(request.values.get('action', 0))
    to_users = agent_invoice.client_order.direct_sales + agent_invoice.client_order.agent_sales + \
        [agent_invoice.client_order.creator, g.user] + \
        agent_invoice.client_order.leaders
    if action == 2:
        action_msg = u'代理返点打款申请'
        for invoice in invoice_pays:
            invoice.pay_status = AGENT_INVOICE_STATUS_APPLY
            invoice.save()
            flash(u'[%s代理申请打款,打款金额: %s, 发票号: %s]  %s ' %
                  (invoice.agent_invoice.company, invoice.money,
                   invoice.agent_invoice.invoice_num, invoice.detail), 'success')

            invoice.agent_invoice.client_order.add_comment(g.user, u"%s,%s" % (
                action_msg, u'[%s代理申请打款,打款金额: %s, 发票号: %s]  %s ' %
                (invoice.agent_invoice.company, invoice.money,
                    invoice.agent_invoice.invoice_num, invoice.detail)), msg_channel=5)
        send_type = "saler"
    elif action == 3:
        action_msg = u'代理返点打款申请'
        for invoice in invoice_pays:
            invoice.pay_status = AGENT_INVOICE_STATUS_F_AGREE
            invoice.save()
            flash(u'[副总裁同意%s代理订单打款申请,打款金额: %s, 发票号: %s]  %s ' %
                  (invoice.agent_invoice.company, invoice.money,
                   invoice.agent_invoice.invoice_num, invoice.detail), 'success')

            invoice.agent_invoice.client_order.add_comment(g.user, u"%s,%s" % (
                action_msg, u'[副总裁同意%s代理订单打款申请,打款金额: %s, 发票号: %s]  %s ' %
                (invoice.agent_invoice.company, invoice.money,
                    invoice.agent_invoice.invoice_num, invoice.detail)), msg_channel=5)
        send_type = "saler"
    elif action == 4:
        action_msg = u'黄亮已批准代理返点打款'
        to_users += User.finances()
        for invoice in invoice_pays:
            invoice.pay_status = AGENT_INVOICE_STATUS_AGREE
            invoice.save()
            flash(u'[同意%s代理订单打款申请,打款金额: %s, 发票号: %s]  %s ' %
                  (invoice.agent_invoice.company, invoice.money,
                   invoice.agent_invoice.invoice_num, invoice.detail), 'success')

            invoice.agent_invoice.client_order.add_comment(g.user, u"%s,%s" % (
                action_msg, u'[同意%s代理订单打款申请,打款金额: %s, 发票号: %s]  %s ' %
                (invoice.agent_invoice.company, invoice.money,
                    invoice.agent_invoice.invoice_num, invoice.detail)), msg_channel=5)
        send_type = "finance"
    else:
        action_msg = u'消息提醒'

    context = {"to_users": to_users,
               "action": action,
               "to_other": emails,
               "action_msg": action_msg,
               "info": msg,
               "invoice": agent_invoice,
               "order": agent_invoice.client_order,
               "send_type": send_type,
               "invoice_pays": invoice_pays}
    agent_invoice_apply_signal.send(
        current_app._get_current_object(), context=context)
    return redirect(url_for('saler_client_order_agent_invoice.invoice', invoice_id=invoice_id))
开发者ID:giveme168,项目名称:braavos,代码行数:74,代码来源:agent_invoice.py

示例5: outsource

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import finances [as 别名]
def outsource(outsource_id):
    type = request.values.get('type', '')
    if type == 'douban':
        outsource = DoubanOutSource.get(outsource_id)
    else:
        outsource = OutSource.get(outsource_id)
    if not outsource:
        abort(404)
    if type == 'douban':
        form = DoubanOutsourceForm(request.form)
    else:
        form = OutsourceForm(request.form)

    outsource.target = OutSourceTarget.get(form.target.data)
    if type == 'douban':
        outsource.douban_order = DoubanOrder.get(form.douban_order.data)
    else:
        outsource.medium_order = Order.get(form.medium_order.data)
    try:
        int(form.num.data)
    except:
        flash(u'保存失败,金额必须为数字!', 'danger')
        return redirect(outsource.info_path())
    outsource.num = form.num.data
    outsource.type = form.type.data
    outsource.subtype = form.subtype.data
    outsource.remark = form.remark.data
    outsource.invoice = True
    outsource.pay_num = form.num.data
    outsource.save()
    flash(u'保存成功!', 'success')
    if type == "douban":
        outsource.douban_order.add_comment(g.user,
                                           u"更新了外包:\n\r%s" % outsource.name,
                                           msg_channel=2)
    else:
        outsource.client_order.add_comment(g.user,
                                           u"更新了外包:\n\r%s" % outsource.name,
                                           msg_channel=2)
    if type == 'douban':
        order = outsource.douban_order
    else:
        order = outsource.medium_order.client_order

    if outsource.status not in [0, 4]:
        to_users = order.direct_sales + order.agent_sales + \
            [order.creator, g.user] + order.operater_users
        try:
            outsource_apply_user = User.outsource_leaders_email(
                order.agent_sales[0])
        except:
            outsource_apply_user = []

        if outsource.status in [1, 2, 5]:
            to_users_name = ','.join(
                [k.name for k in order.operater_users] + [k.name for k in order.agent_sales])
        elif outsource.status == 3:
            to_users += User.finances()
            to_users_name = ','.join(
                [k.name for k in User.finances()] + [k.name for k in order.operater_users])

        to_emails = list(
            set([x.email for x in to_users] + [k.email for k in outsource_apply_user]))
        title = u'【费用报备】%s-%s-%s' % (order.contract or u'无合同号', order.jiafang_name, u'修改外包信息')
        apply_context = {"sender": g.user,
                         "to": to_emails,
                         "action_msg": u'修改外包信息',
                         "msg": '',
                         "order": order,
                         "title": title,
                         "to_users": to_users_name,
                         "outsources": [outsource]}

        outsource_apply_signal.send(
            current_app._get_current_object(), context=apply_context)
    return redirect(outsource.info_path())
开发者ID:giveme168,项目名称:braavos,代码行数:78,代码来源:outsource.py

示例6: merger_outsource_apply

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import finances [as 别名]
def merger_outsource_apply(sender, apply_context):
    merger_outsource = apply_context['merger_outsource']
    outsources = merger_outsource.outsources
    outsources_info = "\n".join([o.outsource_info for o in outsources])
    pay_nums = merger_outsource.pay_num
    action = apply_context['action']
    if apply_context.has_key('url'):
        url = apply_context['url']
    else:
        url = mail.app.config['DOMAIN'] + outsources[0].finance_pay_path()
    if merger_outsource.invoice:
        invoice_type = u'有'
    else:
        invoice_type = u'无'
    to_user = apply_context['to']
    to_user_name = ''

    if action == 1:
        to_user_name = ','.join(
            [k.name for k in User.all() if k.email.find('huangliang') >= 0])
        to_user += [k.email for k in User.all() if k.email.find('huangliang')
                    >= 0 or k.email.find('fenghaiyan') >= 0] + [k.email for k in User.finances()]
        if merger_outsource.__tablename__ == 'merger_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_client_target_info', target_id=merger_outsource.target.id)
        elif merger_outsource.__tablename__ == 'merger_personal_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_client_target_personal_info')
        elif merger_outsource.__tablename__ == 'merger_douban_personal_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_douban_target_personal_info')
        else:
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_douban_target_info', target_id=merger_outsource.target.id)
        flash(u'已发送邮件给 %s ' % (', '.join(to_user)), 'info')
    elif action == -1:
        to_user_name = ','.join(
            [k.name for k in User.all() if k.email.find('fenghaiyan') >= 0])
        to_user += [k.email for k in User.all() if k.email.find('huangliang')
                    >= 0 or k.email.find('fenghaiyan') >= 0] + [k.email for k in User.finances()]
        if merger_outsource.__tablename__ == 'merger_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_client_target_info', target_id=merger_outsource.target.id)
        elif merger_outsource.__tablename__ == 'merger_personal_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_client_target_personal_info')
        elif merger_outsource.__tablename__ == 'merger_douban_personal_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_douban_target_personal_info')
        else:
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_douban_target_info', target_id=merger_outsource.target.id)
        flash(u'已发送邮件给 %s ' % (', '.join(to_user)), 'info')
    elif action == 2:
        to_user_name = ','.join([k.name for k in User.finances()])
        to_user += [k.email for k in User.all() if k.email.find('huangliang')
                    >= 0 or k.email.find('fenghaiyan') >= 0] + [k.email for k in User.finances()]
        if merger_outsource.__tablename__ == 'merger_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('finance_outsource_pay.info', target_id=merger_outsource.target.id)
        elif merger_outsource.__tablename__ == 'merger_personal_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('finance_outsource_pay.info', target_id=0)
        elif merger_outsource.__tablename__ == 'merger_douban_personal_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('finance_outsource_pay.douban_info', target_id=0)
        else:
            url = mail.app.config[
                'DOMAIN'] + url_for('finance_outsource_pay.douban_info', target_id=merger_outsource.target.id)
        flash(u'已发送邮件给 %s ' % (', '.join(to_user)), 'info')
    elif action == 0:
        to_user_name = ','.join(
            [k.name for k in User.all() if k.email.find('fenghaiyan') >= 0])
        to_user += [k.email for k in User.all() if k.email.find('huangliang')
                    >= 0 or k.email.find('fenghaiyan') >= 0] + [k.email for k in User.finances()]
        if merger_outsource.__tablename__ == 'merger_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_client_target_info', target_id=merger_outsource.target.id)
        elif merger_outsource.__tablename__ == 'merger_personal_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_client_target_personal_info')
        elif merger_outsource.__tablename__ == 'merger_douban_personal_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_douban_target_personal_info')
        else:
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_douban_target_info', target_id=merger_outsource.target.id)
        flash(u'已发送邮件给 %s ' % (', '.join(to_user)), 'info')

    body = u"""
Dear %s:

%s

【外包组成】
%s

申请付款总金额: %s
是否有发票:%s
发票信息:%s
#.........这里部分代码省略.........
开发者ID:giveme168,项目名称:braavos,代码行数:103,代码来源:signals.py

示例7: merger_outsource_apply

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import finances [as 别名]
def merger_outsource_apply(sender, apply_context):
    merger_outsource = apply_context['merger_outsource']
    outsources = merger_outsource.outsources
    outsources_info = "\n".join([o.outsource_info for o in outsources])
    pay_nums = merger_outsource.pay_num
    action = apply_context['action']
    if apply_context.has_key('url'):
        url = apply_context['url']
    else:
        url = mail.app.config['DOMAIN'] + outsources[0].finance_pay_path()
    if merger_outsource.invoice:
        invoice_type = u'有'
    else:
        invoice_type = u'无'
    to_user = apply_context['to']
    to_user_name = ''

    if action == 1:
        to_user_name = u'黄亮请审批外包合并付款信息'
        to_user += [k for k in User.all() if k.email.find('huangliang')
                    >= 0 or k.email.find('fenghaiyan') >= 0] + [k for k in User.finances()]
        if merger_outsource.__tablename__ == 'merger_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_client_target_info', target_id=merger_outsource.target.id)
        elif merger_outsource.__tablename__ == 'merger_personal_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_client_target_personal_info')
        elif merger_outsource.__tablename__ == 'merger_douban_personal_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_douban_target_personal_info')
        else:
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_douban_target_info', target_id=merger_outsource.target.id)
    elif action == -1:
        to_user_name = u'丰海艳您的外包合并付款信息被拒绝,请核查后重新申请'
        to_user += [k for k in User.all() if k.email.find('huangliang')
                    >= 0 or k.email.find('fenghaiyan') >= 0] + [k for k in User.finances()]
        if merger_outsource.__tablename__ == 'merger_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_client_target_info', target_id=merger_outsource.target.id)
        elif merger_outsource.__tablename__ == 'merger_personal_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_client_target_personal_info')
        elif merger_outsource.__tablename__ == 'merger_douban_personal_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_douban_target_personal_info')
        else:
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_douban_target_info', target_id=merger_outsource.target.id)
    elif action == 2:
        to_user_name = u'外包合并付款信息已同意付款,请' + \
                       ','.join([k.name for k in User.finances()]) + u'付款'
        to_user += [k for k in User.all() if k.email.find('huangliang')
                    >= 0 or k.email.find('fenghaiyan') >= 0] + [k for k in User.finances()]
        if merger_outsource.__tablename__ == 'merger_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('finance_outsource_pay.info', target_id=merger_outsource.target.id)
        elif merger_outsource.__tablename__ == 'merger_personal_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('finance_outsource_pay.info', target_id=0)
        elif merger_outsource.__tablename__ == 'merger_douban_personal_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('finance_outsource_pay.douban_info', target_id=0)
        else:
            url = mail.app.config[
                'DOMAIN'] + url_for('finance_outsource_pay.douban_info', target_id=merger_outsource.target.id)
    elif action == 0:
        to_user_name = u'丰海艳您的外包合并付款信息已打款'
        to_user += [k for k in User.all() if k.email.find('huangliang')
                    >= 0 or k.email.find('fenghaiyan') >= 0] + [k for k in User.finances()]
        if merger_outsource.__tablename__ == 'merger_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_client_target_info', target_id=merger_outsource.target.id)
        elif merger_outsource.__tablename__ == 'merger_personal_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_client_target_personal_info')
        elif merger_outsource.__tablename__ == 'merger_douban_personal_out_source':
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_douban_target_personal_info')
        else:
            url = mail.app.config[
                'DOMAIN'] + url_for('outsource.merget_douban_target_info', target_id=merger_outsource.target.id)
    body = u"""<h3 style="color:red;">
%s

%s
外包链接地址:%s</h3>
【外包组成】
%s
申请付款总金额: %s
是否有发票:%s
发票信息:%s
留言:
%s
by %s\n
""" % (apply_context['title'], to_user_name, url, outsources_info, pay_nums, invoice_type, merger_outsource.remark,
       apply_context['msg'], g.user.name)
    _insert_person_notcie(to_user, apply_context['title'], body)
    flash(u'已发送邮件给%s' % (','.join(_get_active_user_name(to_user))), 'info')
    send_html_mail(apply_context['title'], recipients=_get_active_user_email(to_user),
#.........这里部分代码省略.........
开发者ID:giveme168,项目名称:braavos,代码行数:103,代码来源:email_signals.py

示例8: apply_pay

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import finances [as 别名]
def apply_pay(invoice_id):
    medium_invoice = MediumInvoice.get(invoice_id)
    if not medium_invoice:
        abort(404)
    invoice_pay_ids = request.values.getlist('invoices')
    invoice_pays = MediumInvoicePay.gets(invoice_pay_ids)
    if not invoice_pays:
        abort(403)
    emails = request.values.getlist('email')
    msg = request.values.get('msg', '')
    action = int(request.values.get('action', 0))
    to_users = [g.user] + User.medias() + User.media_leaders() + \
        User.super_leaders()
    if action == 2:
        action_msg = u'媒体打款申请'
        for invoice in invoice_pays:
            invoice.pay_status = MEDIUM_INVOICE_STATUS_APPLY
            invoice.save()
            flash(u'[%s媒体申请打款,打款金额: %s, 发票号: %s]  %s ' %
                  (invoice.medium_invoice.company, invoice.money,
                   invoice.medium_invoice.invoice_num, invoice.detail), 'success')

            invoice.medium_invoice.client_order.add_comment(g.user, u"%s,%s" % (
                action_msg, u' %s媒体申请打款,打款金额: %s, 发票号: %s  %s ' %
                (invoice.medium_invoice.company, invoice.money,
                    invoice.medium_invoice.invoice_num, invoice.detail)), msg_channel=3)
        send_type = "saler"
    elif action == 3:
        action_msg = u'媒体打款申请'
        for invoice in invoice_pays:
            invoice.pay_status = MEDIUM_INVOICE_STATUS_F_AGREE
            invoice.save()
            flash(u'[副总裁同意%s媒体打款,打款金额: %s, 发票号: %s]  %s ' %
                  (invoice.medium_invoice.company, invoice.money,
                   invoice.medium_invoice.invoice_num, invoice.detail), 'success')

            invoice.medium_invoice.client_order.add_comment(g.user, u"%s,%s" % (
                action_msg, u' 副总裁同意%s媒体打款,打款金额: %s, 发票号: %s  %s ' %
                (invoice.medium_invoice.company, invoice.money,
                    invoice.medium_invoice.invoice_num, invoice.detail)), msg_channel=3)
        send_type = "saler"
    elif action == 4:
        action_msg = u'黄亮已批准媒体打款'
        to_users += User.finances()
        for invoice in invoice_pays:
            invoice.pay_status = MEDIUM_INVOICE_STATUS_AGREE
            invoice.save()
            flash(u' 同意%s媒体订单打款申请,打款金额: %s, 发票号: %s  %s ' %
                  (invoice.medium_invoice.company, invoice.money,
                   invoice.medium_invoice.invoice_num, invoice.detail), 'success')

            invoice.medium_invoice.client_order.add_comment(g.user, u"%s,%s" % (
                action_msg, u' %s媒体同意打款,打款金额: %s, 发票号: %s  %s ' %
                (invoice.medium_invoice.company, invoice.money,
                    invoice.medium_invoice.invoice_num, invoice.detail)), msg_channel=3)
        send_type = "finance"
    else:
        action_msg = u'消息提醒'

    context = {"to_users": to_users,
               "action": action,
               "to_other": emails,
               "action_msg": action_msg,
               "info": msg,
               "invoice": medium_invoice,
               "order": medium_invoice.client_order,
               "send_type": send_type,
               "invoice_pays": invoice_pays}
    medium_invoice_apply_signal.send(
        current_app._get_current_object(), context=context)
    return redirect(url_for('saler_client_order_medium_invoice.invoice', invoice_id=invoice_id))
开发者ID:giveme168,项目名称:braavos,代码行数:73,代码来源:medium_invoice.py


注:本文中的models.user.User.finances方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。