ERROR: null value in column "name" of relation "res_company" violates not-null c
作者:互联网
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).
标签:account,name,constraint,res,onboarding,state,done,null 来源: https://www.cnblogs.com/watermeloncode/p/16253411.html