odoo自动更新表中数据
这是追踪信息用的查询语句,__init__方法初始化作用 _order ="hpartner_id desc"
def init(self,cr):
tools.sql.drop_view_if_exists(cr, 'cust_product_info_report')
cr.execute("""
create or replace view cust_product_info_report as (
select t0.id,t0.hpartner_id as hpartner_id, t0.khwl_code as khwl_code,t1.product_tmpl_id as productn, t3.cust_spec as cust_spec,t3.material as material ,
t4.id as name_uom, t0.custo_price as custo_price,t0.product_meno as product_meno ,t0.meno as meno
from product_custo_info t0
LEFT JOIN product_product t1 on t0.product_tmpl_id=t1.product_tmpl_id
LEFT JOIN product_template t3 on t3.id=t1.product_tmpl_id
LEFT JOIN res_partner t2 on t2.id=t0.hpartner_id
LEFT JOIN product_uom t4 on t3.uom_id=t4.id
)
""") 判断是否有重复数据复
def create(self, cr, uid, vals, context=None):
if context is None:
context = {}
code= vals.get('code','')
cr.execute("select id from res_partner where code='%s'" %(code))
if cr.rowcount>0:
raise osv.except_osv(u'提示',u"[客户/供应商]此简称已经存在!")
xh=1
requirement_ids=vals.get('requirement_ids')
if requirement_ids:
for rline in requirement_ids:
rline[2]['sequence']=xh
xh=xh+1
ctx = dict(context or {}, mail_create_nolog=True)
new_id = super(product_template, self).create(cr, uid, vals, context=ctx)
return new_id
# 新加地方,执行动作找到对应页面
def action_custorm_state(self, cr, uid, ids, context=None):
name=self.browse(cr,uid,ids[0],context=context).name
act_obj = self.pool.get('ir.actions.act_window')
mod_obj = self.pool.get('ir.model.data')
result = mod_obj.xmlid_to_res_id(cr, uid, 'ks_sale.action_view_cust_product_info_tree',raise_if_not_found=True)
result = act_obj.read(cr, uid, [result], context=context)[0]
result['domain'] = "[('hpartner_id','=',"+ str(ids[0]) +")]"
return result
odoo自动更新表中数据的更多相关文章
- 更新表中数据可以使用join
1.在修改数据库的时候,每写完一条SQL语句都要加上一个分号,这样每句之间是有依赖关系的,上面执行不成功不会执行下面的语句. 2.在更新数据库中数据时可以使用join. 例如: update res ...
- unittest(20)- 自动更新表格中数据(5)
# 1. get_data.py from tools import project_path import pandas as pd class GetData: Cookie = None Add ...
- 在论坛中出现的比较难的sql问题:9(触发器专题 插入数据自动更新表数据)
原文:在论坛中出现的比较难的sql问题:9(触发器专题 插入数据自动更新表数据) 最近,在论坛中,遇到了不少比较难的sql问题,虽然自己都能解决,但发现过几天后,就记不起来了,也忘记解决的方法了. 所 ...
- mysql 表中数据不存在则插入,否则更新数据
在很多时候我们会操作数据库表,但是在向表中插入数据时,会遇到表中已经存在该id的数据或者没有该id的数据的情况,没有该id的数据的情况时直接插入就OK,遇到已经存在该id的数据的情况则更新该id的数据 ...
- mysql--对行(表中数据)的增删改查
一.插入数据(增加)insert 1.插入数据(顺序插入) 语法一: INSERT INTO 表名(字段1,字段2,字段3…字段n) VALUES(值1,值2,值3…值n); #指定字段来插入数据,插 ...
- 自动更新开奖数据的excel文件,供大家下载
自动更新开奖数据的excel文件,供大家下载 2010-03-14 20:22 228492人阅读打印来源:乐彩网 作者:eren 很多人拥有自制excel电子表格,常要更新最基本的开奖信息.如有多期 ...
- treeview自动从表中添加标题和列值做目录的方法2
treeview自动从表中添加标题和列值做目录的方法2,该方法是借鉴万一老师的 http://www.cnblogs.com/del/archive/2008/05/15/1114450.html 首 ...
- 使用Excel表格的记录单功能轻松处理工作表中数据的方法
使用Excel表格的记录单功能轻松处理工作表中数据的方法 记录单是将一条记录分别存储在同一行的几个单元格中,在同一列中分别存储所有记录的相似信息段.使用记录单功能可以轻松地对工作表中的数据进行查看.查 ...
- Oracle 取两个表中数据的交集并集差异集合
Oracle 取两个表中数据的交集 关键字: Oracle 取两个表中数据的交集 INTERSECT Oracle 作为一个大型的关系数据库,日常应用中往往需要提取两个表的交集数据 例如现有如下表,要 ...
随机推荐
- MongoDB数据库在centos下的操作
简介 MongoDB是一个基于分布式文件存储的数据库.由C++语言编写.旨在为WEB应用提供可扩展的高性能数据存储解决方案. MongoDB是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库 ...
- FI配置清单-概要
1.编辑公司代码 T-Code:OX02 路径:IMG >企业结构Enterprise >定义Definition >财务会计 Financial Accounting>编辑, ...
- CVE-2018-15688 systemd dhcp6组件越界写漏洞分析
编译的话 , 用 ubuntu 18.10, 没有 patch 的源码下载路径 https://codeload.github.com/poettering/systemd/zip/3941f8329 ...
- Cookie、Session 和 Token区别
1 Cookie.Session 和 Token 都是用来做持久化处理的,目的就是让客户端和服务端相互认识.Http 请求默认是不持久的没有状态的,谁也不认识谁. 2 Cookie: 是存放在客户 ...
- Android--自定义半圆环型进度(带动画)
package com.newair.ondrawtext; import android.animation.ValueAnimator; import android.annotation.Tar ...
- [iOS] UICollectionView初始化滚动到中间的bug
转载请保留地址wossoneri.com 问题 首先看一下我之前写的demo:link demo是封装了一个控件,直接在MainViewController的viewWillAppear里初始化,并且 ...
- [WPF 知识总结系列] —— 基本控件的简单样式集合
一.ScrollBar <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presenta ...
- springboot 学习之路 18(webflux详细介绍(2))
webflux的详细介绍 引言:上一节已经简单介绍webflux的一些基本概念,本章继续学习webflux的原理和实战方面的东西: Spring WebFlux架构: note:注意理解上面这张图.下 ...
- 基于docker搭建jumpserver堡垒机
一.环境信息 1.jumpserver 192.168.137.129 CentOS6.4 kernel版本为 3.10.5-3.el6.x86_64 2.客户机 dev01-04 3.docke ...
- Can't locate Data/Dumper.pm in perl5的处理
Can't locate Data/Dumper.pm in perl5的处理 wget http://www.cpan.org/modules/by-module/Data/Data-Dumper- ...