一、全局搜索与显示

    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里面的常用方法的更多相关文章

  1. 前端开发:Javascript中的数组,常用方法解析

    前端开发:Javascript中的数组,常用方法解析 前言 Array是Javascript构成的一个重要的部分,它可以用来存储字符串.对象.函数.Number,它是非常强大的.因此深入了解Array ...

  2. Jquery元素选取、常用方法

    一:常用的选择器:(李昌辉) 基本选择器 $("#myDiv") //匹配唯一的具有此id值的元素 $("div") //匹配指定名称的所有元素 $(" ...

  3. python浅谈正则的常用方法

    python浅谈正则的常用方法覆盖范围70%以上 上一次很多朋友写文字屏蔽说到要用正则表达,其实不是我不想用(我正则用得不是很多,看过我之前爬虫的都知道,我直接用BeautifulSoup的网页标签去 ...

  4. C# Webbrowser 常用方法及多线程调用

    设置控件的值 /// <summary> /// 根据ID,NAME双重判断并设置值 /// </summary> /// <param name="tagNa ...

  5. list,tuple,dict,set常用方法

    Python中list,tuple,dict,set常用方法 collections模块提供的其它有用扩展类型 from collections import Counter from collect ...

  6. 记录yii2-imagine几个常用方法

    记录yii2-imagine几个常用方法: //压缩 Image::thumbnail('@webroot/img/test-image.jpg', 120, 120)->save(Yii::g ...

  7. DOM常用方法总结

    DOM(Document Object Model:文档对象模型)为javascript中的一部分,它为访问和修改html文档或xml文档提供了一些编程接口,DOM以对象的形式来描述文档中的内容,以树 ...

  8. JSP内置对象及常用方法

    jsp九大内置对象及四个作用域: 何为作用域 先让我们看看效果: 大概流程是这样的,我们访问index.jsp的时候,分别对pageContext, request, session,applicat ...

  9. java中集合类中Collection接口中的Map接口的常用方法熟悉

    1:Map接口提供了将键映射到值的对象.一个映射不能包含重复的键:每个键最多只能映射到一个值.Map接口中同样提供了集合的常用方法. 2:由于Map集合中的元素是通过key,value,进行存储的,要 ...

  10. 解析Exception和C#处理Exception的常用方法总结

    在.NET中,异常是指成员没有完成它的名称宣称可以完成的行动.在异常的机制中,异常和某件事情的发生频率无关. 异常处理四要素包括:一个表示异常详细信息的类类型:一个向调用者引发异常类实例的成员:调用者 ...

随机推荐

  1. Vue3状态管理终极指南:Pinia保姆级教程

    一.为什么选择Pinia?(Vuex对比分析) 1.1 核心优势解析 Composition API优先 :天然支持Vue3新特性,代码组织更灵活 TypeScript友好 :内置类型推导,无需额外类 ...

  2. C系统级编程-复习

    数组对象类型 Array of Type,它是多个相同对象类型的一维派生类型,包含两要素:元素个数,元素的对象类型 所谓多维数组,不过是元素的迭代衍生,本质还是一维的 声明 对象标识的名称 对象类型 ...

  3. nginx 根据 URL 参数引入不同的文件

    同步发布:https://blog.jijian.link/2020-06-30/nginx-import-file/ 编程世界中各种奇奇怪怪的需求都有,本次遇到一个需求:根据URL参数判断,包含 x ...

  4. 鸿蒙开发 HarmonyOS DevEco Studio 常用快捷键

    前言 做 HarmonyOS 鸿蒙开发离不开 DevEco Studio 开发工具, DevEco Studio 是基于 IntelliJ IDEA Community 开源版本打造,所以默认的快捷键 ...

  5. goland JetBrains编辑器:代码爆红找不到引用,但项目可运行

    前言 goland JetBrains 编辑器:代码爆红找不到引用,但项目可运行 解决 goland 缓存已满,需要清除缓存

  6. openssl基础使用(密码学 linux)

    目录        实验原理        实验过程            一.对称加密                1.使用rc4加解密                2.使用AES加解密     ...

  7. unigui的demo-\Demos\Desktop\DBAppDemo\SimpleDemo.dproj【11】

    这个demo很简单. 一个客户表,还有一个票据主从表. 看程序界面: 包括数据提交,彻头彻尾的c/s程序.你完全按照传统的C/S程序模式做开发就可.好处是效率.效率.还是效率! 你还有什么不满意!如果 ...

  8. 从DeepSeek看算法备案&大模型备案

    一.deepseek的备案情况 (一)算法备案情况 在算法备案系统网站上,北京深度求索人工智能基础技术研究有限公司和杭州深度求索人工智能基础技术研究有限公司分别进行了两个算法备案.从公司名称来看,正如 ...

  9. Assets, Resources and AssetBundles(五):AssetBundle usage patterns

    这是系列文章中的第五章,内容涉及"Unity5"中的资产.资源和资源管理. 本系列的前一章介绍了AssetBundles的基本原理,其中包括各种加载API的低级行为.本章讨论了在实 ...

  10. Tortoise-ORM与FastAPI集成:异步模型定义与实践

    title: Tortoise-ORM与FastAPI集成:异步模型定义与实践 date: 2025/04/20 11:38:23 updated: 2025/04/20 11:38:23 autho ...