1 # 创建res.company公司信息的时候,发现它执行了两次create()方法,并且第二次调用create,传了一个[{}]做为参数
2 # 原因是,你创建res.company的时候并没有指定哪个res.users用户去创建,没有指定就没办法获取一些特定值
3 # 之所以没有指定,是因为你是在处理http请求的时候去创建公司信息,而这个时候用户还没有登录
4 # 所以你可以这么做:
5 request.env['res.company'].sudo().with_user(1).create(values)
6 # with_user:指定用户id为1的账户去执行创建

# 报错信息:
ERROR shequ_demo odoo.sql_db: bad query: INSERT INTO "res_company" ("id", "create_uid", "create_date", "write_uid", "write_date", "account_check_printing_date_label", "account_check_printing_layout", "account_check_printing_margin_left", "account_check_printing_margin_right", "account_check_printing_margin_top", "account_dashboard_onboarding_state", "account_invoice_onboarding_state", "account_onboarding_create_invoice_state", "account_onboarding_invoice_layout_state", "account_onboarding_sale_tax_state", "account_opening_date", "account_setup_bank_data_state", "account_setup_bill_state", "account_setup_coa_state", "account_setup_fy_data_state", "base_onboarding_company_state", "currency_id", "expects_chart_of_accounts", "fiscalyear_last_day", "fiscalyear_last_month", "font", "invoice_is_email", "invoice_is_print", "paperformat_id", "payment_acquirer_onboarding_state", "portal_confirmation_sign", "quotation_validity_days", "sale_onboarding_order_confirmation_state", "sale_onboarding_sample_quotation_state", "sale_quotation_onboarding_state", "sc_shipyard_id_bit", "sc_type", "sc_type_bit", "sequence", "tax_calculation_rounding_method", "tempshow") VALUES (nextval('res_company_id_seq'), NULL, (now() at time zone 'UTC'), NULL, (now() at time zone 'UTC'), true, 'disabled', 0.25, 0.25, 0.25, 'not_done', 'not_done', 'not_done', 'not_done', 'not_done', '2022-01-01', 'not_done', 'not_done', 'not_done', 'not_done', 'not_done', NULL, true, 31, '12', 'Lato', true, true, 1, 'not_done', true, 30, 'not_done', 'not_done', 'not_done', false, 'normal', false, 10, 'round_per_line', '') RETURNING id
ERROR: null value in column "name" of relation "res_company" violates not-null constraint
DETAIL: Failing row contains (26, null, null, null, 10, 2022-05-10 03:21:18.168334, null, null, null, null, null, null, null, 1, null, not_done, Lato, null, null, null, null, 2022-05-10 03:21:18.168334, normal, f, null, f, null, null, null, null, null, , null, null, null, null, null, null, null, null, null, 31, 12, null, null, null, null, t, null, null, null, null, null, null, null, null, null, round_per_line, null, null, null, null, null, null, null, null, null, null, null, t, t, null, 2022-01-01, not_done, not_done, not_done, not_done, not_done, not_done, not_done, not_done, null, not_done, null, null, null, null, null, null, not_done, null, t, null, 30, not_done, not_done, not_done, null, null, disabled, t, null, 0.25, 0.25, 0.25).

 

ERROR: null value in column "name" of relation "res_company" violates not-null constraint的更多相关文章

  1. [MySQL-1] mysql error 1101 blob/text column can't have a default value

    在MySQL Query Browser上创建一个含有TEXT类型的字段,创建不成功,报错:mysql error 1101 blob/text column can't have a default ...

  2. 一个坑:java.sql.ResultSet.getInt==》the column value; if the value is SQL NULL, the value returned is 0

    Retrieves the value of the designated column in the current row of this ResultSet object as a String ...

  3. POSTGRESQL中ERROR: recursive query "t" column 2 has type character varying(150) in non-recursive term but type character varying overall

    最近在做项目的时候有个需求是需要查到当前登录的用户下辖所有区域的数据,并将查询出来的部门信息以如下格式展示 最高人民法院>江苏省高级人民法院>南通市中级人民法院最高人民法院>江苏省高 ...

  4. org.springframework.jdbc.UncategorizedSQLException: Error attempting to get column 'alarmGroup' from result set. Cause: java.sql.SQLException: Error

    异常展示: org.springframework.jdbc.UncategorizedSQLException: Error attempting to get column 'alarmGroup ...

  5. MySQL5.7更改密码时出现ERROR 1054 (42S22): Unknown column 'password' in 'field list'

    转自:http://blog.csdn.net/u010603691/article/details/50379282 新安装的MySQL5.7,登录时提示密码错误,安装的时候并没有更改密码,后来通过 ...

  6. Parse Fatal Error at line 41 column 24: 元素类型 "url-pattern" 必须由匹配的结束标记 "</url-pattern>" 终止

    1.错误描述 严重: Parse Fatal Error at line 41 column 24: 元素类型 "url-pattern" 必须由匹配的结束标记 "< ...

  7. Error Code: 1054. Unknown column 'age' in 'user'

    1.错误描述 10:28:20 alter table user modify age int(3) after sex Error Code: 1054. Unknown column 'age' ...

  8. MySQL 报错ERROR 1054 (42S22): Unknown column 'plugin' in 'mysql.user'

    MySQL  我们在创建用户的时候,可能会遇到以下报错: ERROR 1054 (42S22): Unknown column 'plugin' in 'mysql.user' 说明mysq.user ...

  9. mysql 5.7 ERROR 1054(42S22) Unknown column 'password' in ‘field list’ 报错

    mysql 忘记密码 报错?ERROR 1054(42S22) Unknown column 'password' in ‘field list’原因:5.7版本下的mysql数据库下已经没有pass ...

随机推荐

  1. JavaScript 单线程之异步编程

    Js 单线程之异步编程 先了解一个概念,为什么 JavaScript 采用单线程模式工作,最初设计这门语言的初衷是为了让它运行在浏览器上面.它的目的是为了实现页面的动态交互,而交互的核心是进行 Dom ...

  2. GO GMP协程调度实现原理 5w字长文史上最全

    1 Runtime简介 Go语言是互联网时代的C,因为其语法简洁易学,对高并发拥有语言级别的亲和性.而且不同于虚拟机的方案.Go通过在编译时嵌入平台相关的系统指令可直接编译为对应平台的机器码,同时嵌入 ...

  3. ExtJS 布局-Border 布局(Border layout)

    更新记录: 2022年6月11日 发布. 2022年6月1日 开始. 1.说明 边框布局允许根据区域(如中心.北部.南部.西部和东部)指定子部件的位置.还可以调整子组件的大小和折叠. 2.设置布局方法 ...

  4. JAVA用for循环打印*三角形

    public class Sanjiaoxing { //本节为for循环的嵌套结构练习 public static void main(String[] args) { // TODO Auto-g ...

  5. k8s client-go源码分析 informer源码分析(6)-Indexer源码分析

    client-go之Indexer源码分析 1.Indexer概述 Indexer中有informer维护的指定资源对象的相对于etcd数据的一份本地内存缓存,可通过该缓存获取资源对象,以减少对api ...

  6. 如何修改servlet的创建时机?

    在xml中使用<load-on-startup>标签 当标签里为正整数时意味着服务器启动时创建 当为负数时(默认负数)意味着第一次访问时创建 顺带说一下service设置变量时的问题尽量在 ...

  7. NC16539 [NOIP2013]表达式求值

    NC16539 [NOIP2013]表达式求值 题目 题目描述 给定一个只包含加法和乘法的算术表达式,请你编程计算表达式的值. 输入描述 输入仅有一行,为需要你计算的表达式,表达式中只包含数字.加法运 ...

  8. # NC20860 兔子的区间密码

    NC20860 兔子的区间密码 题目 题目描述 有一只可爱的兔子被困在了密室了,密室里有两个数字,还有一行字: 只有解开密码,才能够出去. 可爱的兔子摸索了好久,发现密室里的两个数字是表示的是一个区间 ...

  9. NC15553 数学考试

    NC15553 数学考试 题目 题目描述 今天qwb要参加一个数学考试,这套试卷一共有 \(n\) 道题,每道题qwb能获得的分数为 \(a_i\) ,qwb并不打算把这些题全做完, 他想选总共 \( ...

  10. Burnside 引理与 Pólya 定理

    群 群的定义 在数学中,群是由一种集合以及一个二元运算所组成的,符合"群公理"的代数结构. 一个群是一个集合 \(G\) 加上对 \(G\) 的二元运算.二元运算用 \(\cdot ...