• odoo


    def action_partner_account_state(self,cr,uid,context=None):
    cr.execute(""" select id from res_partner where is_company='t' and customer='t' and active='t' order by id
    """)
    account_obj=self.pool.get('partner.account.state')
    account_obj_line=self.pool.get('partner.account.state')
    if cr.rowcount>0:
    dict1=cr.fetchall()
    for line in dict1:
    vals={}
    id=line[0]
    vals['partner_id']=id
    # 时间段会自动减少30
    vals['docdate_from']=(datetime.now()-timedelta(days=30))
    vals['docdate_to']=datetime.now()
    partner_id=vals['partner_id']
    docdate_from=vals['docdate_from']
    docdate_to= vals['docdate_to']
    record=[]
    seq=1

    # # 本月的所有订单数量
    if docdate_from and docdate_to:
    if docdate_from<docdate_to:
    语句sql



    cr.execute(sql)
    dict=cr.dictfetchall()
    if dict:
    # 这里只是带数据到订单里面去,所以append要加append((0,0,
    for line in dict:
    record.append((0,0,{'sequence':seq, 'picking_id':line['id'],'product_id':line['product_id'],'qty':line['product_qty'],
    'price':line['price'],'total':line['total'],'date_planned':line['date_done']
    }))
    seq+=1
    print record
    vals['order_line']=record

    # 上月结存金额
      语句sql                                                               





    cr.execute(sql)
    dict1=cr.dictfetchall()
    if dict1:
    vals['last_month_cj']=dict1[0]['syjcje']
    else:
    vals['last_month_cj']=0.0
    # 收承兑金额
    sql="select sum(type*pay_total) je from partner_for_payment where partner_id=%d and pay_date>='%s' and pay_date<='%s' and costtype=2 group by partner_id"%(partner_id,docdate_from,docdate_to)
    cr.execute(sql)
    dict2=cr.dictfetchall()
    if dict2:
    vals['scdje']=dict2[0]['je']
    else:
    vals['scdje']=0.0
    #到款金额
    sql="select sum(type*pay_total) je from partner_for_payment where partner_id=%d and pay_date>='%s' and pay_date<='%s' and costtype=1 group by partner_id"%(partner_id,docdate_from,docdate_to)
    cr.execute(sql)
    dict3=cr.dictfetchall()
    if dict3:
    vals['amount_to_money']=dict3[0]['je']
    else:
    vals['amount_to_money']=0.0

    new_id=account_obj.create(cr,uid,vals,context=context)

    return True
  • 相关阅读:
    iOS10权限声明国际化
    用"僵尸对象"调试内存管理问题
    windows系统下的两个批处理命令
    解决windows系统下打开应用弹出丢失libmysql.dll的问题
    简单的cocos2dx笔试题
    解决cocos2dx 3.x 导入cocostudio的ui界面出现错位问题
    mac 使用homebrew 安装mysql
    cocos2dx for lua 简单的翻牌动画
    cocos2dx for lua A*寻路算法实现2
    解决升级mac os X EI Capitan后遇到LibclangError: dlopen(libclang.dylib, 6): image not found.的问题
  • 原文地址:https://www.cnblogs.com/1314520xh/p/7056631.html
Copyright © 2020-2023  润新知