二、动作按钮里面也可以由字段判断:

def action_select_sale_order_line(self,cr,uid,ids,date_begin,date_end,context=None):
res={}
record=[]
seq=1
selfobj=self.browse(cr,uid,ids,context)
# date_begin=selfobj.date_begin
# date_end=selfobj.date_end
if date_begin and date_end:
if date_begin<date_end:
sql="select id,product_id,partner_id,product_qty,date_planned,COALESCE(memo,'') memo from sale_origin_line where date_planned>='%s' and date_planned<='%s'"%(date_begin,date_end)
cr.execute(sql)
dict=cr.dictfetchall()
if dict:
for line in dict:
record.append({'sequence':seq,'partner_id':line['partner_id'],'sale_order_ids':line['id'],'product_id':line['product_id'],'qty':line['product_qty'],'date_planned':line['date_planned'],'lnote':line['memo']})
seq+=1 return {'value':{'lines':record}}
一、一般的按钮动作的写法:
####整张外部订单取消,对应取消未发货的内部销售订单
def action_cancel_sale_order(self,cr,uid,ids,context=None):
assert len(ids)==1
sale_origin_obj=self.browse(cr,uid,ids,context)
a=sale_origin_obj.name
sql="select id from stock_picking where order_name='%s'"%(str(a))
cr.execute(sql)
dict=cr.fetchall()
count=len(dict)
if count >0:
raise osv.except_osv((u'警告!'),(u'已存在发货单不可取消,请点完结'))
sale_origin_obj.state='cancel'
for line in sale_origin_obj.line_id:
line.state='cancel'

最新文章

  1. 从tabBarController的一个item上的控制器跳转到另一个item上的控制器
  2. 常用的css命名规则:
  3. Dijkstra最短路径算法实例
  4. 免费素材:25套免费的 Web UI 设计的界面元素(转)
  5. React/React Native 的ES5 ES6写法对照表-b
  6. python的内置函数bin()
  7. HDU Computer Transformation1041 题解
  8. 与众不同 windows phone (30) - Communication(通信)之基于 Socket TCP 开发一个多人聊天室
  9. 一Flash从入门开发者放弃了成长之路
  10. java学习笔记----java入门
  11. 基于Vue2 搭建移动端 webapp 框架
  12. shell脚本中调用另一个脚本的三种不同方法(fork, exec, source)
  13. 使用BeautifulSoup和正则表达式爬取时光网不同地区top100电影并使用Matplotlib对比
  14. liunx_second_day
  15. 简要了解 MySql 5.5/5.6/5.7/8 出现的新特性
  16. v-bind指令动态绑定class和内联样式style
  17. javascript函数以及作用域简介
  18. P4417 [COCI2006-2007#2] STOL
  19. Java之Object类和常用的API
  20. 【原创】MySQL5.7.18(ptmalloc VS tcmalloc VS jemalloc)性能测试

热门文章

  1. Swift学习字符串、数组、字典
  2. Render
  3. 关于ArrayList的5道面试题
  4. Android 进阶 教你打造 Android 中的 IOC 框架 【ViewInject】 (下)
  5. JS代码检查工具ESLint
  6. C++中常用到的容器
  7. 【UOJ】67 新年的毒瘤 &amp;【BZOJ】1123 BLO
  8. BZOJ_2238_Mst_树剖+线段树
  9. 【CTF 攻略】CTF比赛中关于zip的总结
  10. 开源方案搭建可离线的精美矢量切片地图服务-3.Mapbox个性化地图定制入门