odoo16里面的常用方法
一、全局搜索与显示
def name_get(self):
res = []
for order in self:
name = order.name
if order.draw_number:
name = "%s-%s" % (name, order.draw_number)
res += [(order.id, name)]
return res
@api.model
def name_search(self, name='', args=None, operator='ilike', limit=100):
if not args:
args = []
if name:
positive_operators = ['=', 'ilike', '=ilike', 'like', '=like']
products = self.env['product.template']
if operator in positive_operators:
products = self.search([('name', 'ilike', name)] + args, limit=limit)
if not products:
products = self.search([('draw_number', 'ilike', name)] + args, limit=limit)
if not products:
products = self.search([('default_code', 'ilike', name)] + args, limit=limit)
else:
products = self.search(args, limit=limit)
return products.name_get()
二、继承修改xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_product_template_form_inherit" model="ir.ui.view">
<field name="name">product.template.form.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='default_code']" position="attributes">
<attribute name="string">物料编码</attribute>
</xpath>
<xpath expr="//field[@name='default_code']" position="after">
<field name="draw_number"/>
</xpath>
</field>
</record>
</odoo>
三、qweb实现打印单
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="bill_of_sales_order_report_document1">
<t t-call="web.external_layout">
<div class="page" style="margin-top:0px">
<style type="text/css">
.tg {border-collapse:collapse;border-spacing:0;}
.tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial,
sans-serif;font-size:10px;
overflow:hidden;padding:10px 5px;word-break:normal;}
.tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial,
sans-serif;font-size:10px;
font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}
.tg .tg-cly1{text-align:left;vertical-align:middle}
.tg .tg-lqfj{font-size:10px;text-align:center;vertical-align:middle}
.tg .tg-blwt{background-color:#D0CECE;border-color:inherit;text-align:center;vertical-align:middle}
.tg .tg-d9wi{background-color:#D0CECE;font-size:10px;text-align:center;vertical-align:middle}
.tg .tg-24qy{background-color:#D0CECE;text-align:center;vertical-align:middle}
.tg .tg-nrix{text-align:center;vertical-align:middle}
</style>
<table class="tg" style="undefined;table-layout: fixed; width: 100%">
<thead style="border-style:none;font-family:Arial;font-size:15px">
<tr style="border-style:none;">
<th height="10" colspan="8" style="border-style:none;">
<div class="text-center" style="border-style:none;">
<h4 class="text_center">
安徽联科技有限公司
</h4>
</div>
<tr style="border-style:none;">
<td style="border-style:none;font-family:Arial;font-size:12px" colspan="4">客户名称:
<span t-field="doc_id.partner_id.name"/> </td>
<td style="border-style:none;font-family:Arial;font-size:12px" colspan="4">制单日期:
<span t-field="doc_id.date_order" t-options='{"widget": "date"}'/>
</td>
</tr>
<tr style="border-style:none;">
<td style="border-style:none;font-family:Arial;font-size:12px" colspan="4">客户地址:
<span t-field="doc_id.partner_id.street"/>
</td>
</tr>
</th>
</tr>
<tr>
<th class="tg-blwt">订单号码</th>
<th class="tg-24qy">货物编号</th>
<th class="tg-24qy">型号/规格</th>
<th class="tg-24qy">单位</th>
<th class="tg-24qy">数量</th>
<th class="tg-24qy">单价</th>
<th class="tg-24qy">备注</th>
<th class="tg-d9wi">入库单号</th>
</tr>
</thead>
<tbody>
<t t-set="items" t-value="[0,1,2]"/>
<t t-set="i" t-value="0"/>
<t t-set="k" t-value="0"/>
<t t-set="q" t-value="0"/>
<tr t-foreach="doc_id.order_line" t-as="l" class="gxtr">
<td class="tg-nrix">
<span t-field="doc_id.name"/>
</td>
<td class="tg-nrix">
<span t-field="l.product_id.name"/>
</td>
<td class="tg-nrix">
<span t-field="l.product_id.name"/>
</td>
<td class="tg-nrix">
<span t-field="l.product_uom.name"/>
</td>
<td class="tg-nrix">
<span t-field="l.product_uom_qty"/>
</td>
<td class="tg-nrix">
<span t-field="l.price_unit"/>
</td>
<td class="tg-nrix">
<span t-field="l.name"/>
</td>
<td class="tg-lqfj">
<span t-value="l.product_uom_qty"/>
</td>
<t t-set="q" t-value="q+l.product_uom_qty"/>
<t t-set="i" t-value="i+1"/>
</tr>
<tr t-foreach="items" t-as="j" class="gxtr">
<t t-if="j>=(i%8)">
<td class="tg-nrix"></td>
<td class="tg-nrix"></td>
<td class="tg-nrix"></td>
<td class="tg-nrix"></td>
<td class="tg-nrix"></td>
<td class="tg-nrix"></td>
<td class="tg-nrix"></td>
<td class="tg-lqfj"></td>
</t>
<t t-set="k" t-value="k+1"/>
</tr>
<tr>
<td class="tg-nrix" colspan="4"></td>
<td class="tg-nrix" style="border-right:none">
<t t-esc="q"/>
</td>
<td style="border-left:none" colspan="3">
</td>
</tr>
</tbody>
<tfoot style="border-style:none;">
<tr style="border-style:none;">
<td style="border-style:none;font-family:Arial;font-size:12px" colspan="4">制单:
<span t-field="doc_id.create_uid.name"/>
</td>
</tr>
</tfoot>
</table>
</div>
</t>
</template> <template id="bill_of_sales_order_report">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="doc_id">
<t t-call="bill_of_sales_order_report_document1" t-lang="doc_id.partner_id.lang"/>
</t>
</t>
</template>
</odoo>
四、全局修改样式面包屑
.breadcrumb-item + .breadcrumb-item::before {
float: left;
padding-right: 0.5rem;
color: red !important;
content: var(--bs-breadcrumb-divider, ">>>") !important;}
odoo16里面的常用方法的更多相关文章
- 前端开发:Javascript中的数组,常用方法解析
前端开发:Javascript中的数组,常用方法解析 前言 Array是Javascript构成的一个重要的部分,它可以用来存储字符串.对象.函数.Number,它是非常强大的.因此深入了解Array ...
- Jquery元素选取、常用方法
一:常用的选择器:(李昌辉) 基本选择器 $("#myDiv") //匹配唯一的具有此id值的元素 $("div") //匹配指定名称的所有元素 $(" ...
- python浅谈正则的常用方法
python浅谈正则的常用方法覆盖范围70%以上 上一次很多朋友写文字屏蔽说到要用正则表达,其实不是我不想用(我正则用得不是很多,看过我之前爬虫的都知道,我直接用BeautifulSoup的网页标签去 ...
- C# Webbrowser 常用方法及多线程调用
设置控件的值 /// <summary> /// 根据ID,NAME双重判断并设置值 /// </summary> /// <param name="tagNa ...
- list,tuple,dict,set常用方法
Python中list,tuple,dict,set常用方法 collections模块提供的其它有用扩展类型 from collections import Counter from collect ...
- 记录yii2-imagine几个常用方法
记录yii2-imagine几个常用方法: //压缩 Image::thumbnail('@webroot/img/test-image.jpg', 120, 120)->save(Yii::g ...
- DOM常用方法总结
DOM(Document Object Model:文档对象模型)为javascript中的一部分,它为访问和修改html文档或xml文档提供了一些编程接口,DOM以对象的形式来描述文档中的内容,以树 ...
- JSP内置对象及常用方法
jsp九大内置对象及四个作用域: 何为作用域 先让我们看看效果: 大概流程是这样的,我们访问index.jsp的时候,分别对pageContext, request, session,applicat ...
- java中集合类中Collection接口中的Map接口的常用方法熟悉
1:Map接口提供了将键映射到值的对象.一个映射不能包含重复的键:每个键最多只能映射到一个值.Map接口中同样提供了集合的常用方法. 2:由于Map集合中的元素是通过key,value,进行存储的,要 ...
- 解析Exception和C#处理Exception的常用方法总结
在.NET中,异常是指成员没有完成它的名称宣称可以完成的行动.在异常的机制中,异常和某件事情的发生频率无关. 异常处理四要素包括:一个表示异常详细信息的类类型:一个向调用者引发异常类实例的成员:调用者 ...
随机推荐
- 分布式锁—3.Redisson的公平锁
大纲 1.Redisson公平锁RedissonFairLock概述 2.公平锁源码之加锁和排队 3.公平锁源码之可重入加锁 4.公平锁源码之新旧版本对比 5.公平锁源码之队列重排 6.公平锁源码之释 ...
- Netty基础—5.Netty的使用简介
大纲 1.Netty服务端的启动流程 2.服务端IO事件的处理类 3.Netty客户端的启动流程 4.客户端IO事件的处理类 5.启动Netty服务端和客户端的方法说明 6.Netty服务端和客户端使 ...
- 记录一下 简单udp和sni 代理 done
由于之前借鉴 Kestrel 了非常多抽象和优化实现,对于后续的扩展非常便利, 实现 简单udp和sni 代理 两个功能比预期快了超多(当然也有偷懒因素) (PS 大家有空的话,能否在 GitHub ...
- 【Bug记录】defineEmits 在 TS 项目报错
前言 单文件组件 <script setup> 是 Vue3.2 版本后非常流行的写法. 但是在开发过程中,按照官网使用 defineEmits ,结果项目报错,无法运行. 错误截图 Un ...
- SpreadJS V18.0 新版本发布!数据驱动革新,效率与体验全面升级
表格控件SpreadJS推出V18.0及V8.0版本!本次更新聚焦数据管理.多语言适配.报表与透视表增强,新增多项重磅功能,赋能企业高效应对复杂业务场景.核心亮点速览 一.表格绑定数据源:直连数据管理 ...
- CentOS7 安装 Redis 7.0.2
安装 Redis # 首先安装依赖gcc, 后面需要使用make编译redis yum install gcc -y # 进入 /usr/local/src 目录, 把源码下载到这里 cd /usr/ ...
- BFS 2025/1/16
BFS Basic 主要特点:空间复杂度较高,基于队列 经常用于求最优解的搜索题 经典模型:连通块,最短迷宫路径,曼哈顿距离 Question 01 [ACP2056 山峰与山谷] 主体是广搜模板 难 ...
- android中大咖:TlistView
d的android中的Tlistview相当于cxGrid,其开发使用中的主咖地位至高无上. 可是如何高效使用快速实现的需求呢?需要的话补官方的教程 上图: GOODLUCK!
- 关于TFDMemtable的使用场景【3】处理数据
原因很多: 1.通过TFDMemtable处理数据时,避免影响数据感知 2.处理速度很快. ------------------------------ 从Tdataset读取数据: Procedur ...
- ro在xe10.3上的安装
在学习研究RO. RO9.2.101.1295在xe10.3上安装遇到新问题.记录处理的办法: 没有采用执行exe安装的方法.而是采用复制源代码后编译安装. 1.把生成的bpl.dcp安装到默认目录, ...