• odoo返写数据


    #确认按钮  反写回合同页面,当前页面反写数据:

    def action_split_order_ht(self,cr,uid,ids,context=None):
    assert len(ids)==1
    sigining_contract_obj=self.browse(cr,uid,ids,context)
    sigining_contract_obj.state='confirm'
    name=sigining_contract_obj.contract_origin
    sql="select sum(total_pay) as paytotal,sum(total_jies) as jiestotal from settle_account where contract_origin='%s' GROUP BY contract_origin "%(str(name))
    cr.execute(sql)
    dict1=cr.dictfetchall()[0]
    sigining_contract_obj.accumulated_amount= dict1['jiestotal']
    sigining_contract_obj.accumulated_pay= dict1['paytotal']


    在其他页面反写数据,可用sql语句
    #确认按钮
    def action_split_order_js(self,cr,uid,ids,context=None):
    assert len(ids)==1
    settle_account_obj=self.browse(cr,uid,ids,context)
    settle_account_obj.state='confirm'
    name=settle_account_obj.contract_origin
    print name


    汇总合同号相同的数据,相当于每次做累加
    sql="select sum(total_pay) as paytotal,sum(total_jies) as jiestotal from settle_account where contract_origin='%s' GROUP BY contract_origin "%(str(name))
    cr.execute(sql)
    dict1=cr.dictfetchall()[0]
    反写数据
    if dict1:
    PT=dict1['paytotal']
    JT=dict1['jiestotal']
    sql2=" UPDATE sigining_contract SET accumulated_amount='%d',accumulated_pay='%d' where contract_origin='%s'"%(JT,PT,str(name))
    cr.execute(sql2)
    else:

    return True


    这里调用其他模块所用方法
    sigining_obj=self.pool.get('sigining.contract')
    sigining_obj_obj=sigining_obj.brows(cr,uid,[str('contract_origin'),'=','id'],context)
    sigining_obj.create(cr,uid,{'accumulated_amount':dict1['jiestotal'],'accumulated_pay':dict1['paytotal']},context=None)
    sigining_obj.accumulated_amount= dict1['jiestotal']








     
  • 相关阅读:
    Ubuntu下systemd服务的配置
    编译压缩代码 MFCompress-src-1.01 :对‘***’未定义的引用
    德尔福 基础
    德尔福 XE5 安卓权限设置
    德尔福 XE5 安卓调试
    复制任意文件或文件夹到剪贴板
    无法完成安装:'Cannot access storage file '/
    Centos7.4安装kvm虚拟机(使用virt-manager管理)
    MSYS2 使用
    线程
  • 原文地址:https://www.cnblogs.com/1314520xh/p/6941198.html
Copyright © 2020-2023  润新知