Skip to Content

Welcome!

Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

Sign up

You need to be registered to interact with the community.
This question has been flagged
1 Reply
42 Views

I have overridden the message_new process and in that i have kept condition that if there is no attachment the it will call Super but it shows error as it tries to create Sale Order but i don't wanted to create Sale Order in else condition i just want to continue the base process if i don't get attachments. But it shows error as i have not null constraint in database.


Error:

2022-01-31 05:29:53,665 42399 ERROR bv_shurhold odoo.sql_db: bad query: INSERT INTO "sale_order" ("id", "create_uid", "create_date", "write_uid", "write_date", "canceled_in_shopify", "company_id", "date_order", "discount_type", "invoice_created", "invoice_delivery_method", "is_allocated", "is_pos_order", "is_risky_order", "is_service_tracking_updated", "is_status_updated", "name", "note", "order_source_id", "order_type", "partner_invoice_id", "partner_shipping_id", "picking_policy", "pricelist_id", "printnode_printed", "require_payment", "require_signature", "reservation_status", "sale_delivery_method", "sale_order_template_id", "state", "sub_status", "team_id", "user_id", "validity_date", "warehouse_id") VALUES (nextval('sale_order_id_seq'), 2, (now() at time zone 'UTC'), 2, (now() at time zone 'UTC'), false, 1, '2022-01-31 05:29:53', 'percent', false, 'none', false, false, false, false, false, 'Fwd: No attachments', '', 2, 'ground_order', NULL, NULL, 'direct', NULL, false, false, true, 'unallocated', 'none', NULL, 'draft', 'pending', 1, 2, NULL, 1) RETURNING id

ERROR: null value in column "partner_id" of relation "sale_order" violates not-null constraint

DETAIL: Failing row contains (1801, null, null, null, null, null, Fwd: No attachments, null, null, null, draft, 2022-01-31 05:29:53, null, t, f, 2022-01-31 05:29:50.451351, 2, null, null, null, null, null, null, null, , null, null, null, null, null, null, 1, 1, null, null, null, null, 2, 2, 2022-01-31 05:29:50.451351, null, null, direct, 1, null, null, null, null, null, null, null, null, null, f, percent, null, null, null, null, null, null, null, null, null, null, f, null, f, f, f, null, null, null, null, null, none, none, null, null, null, null, null, null, unallocated, pending, ground_order, null, null, f, f, null, null, null, f, null, null, null, null, 2, null).


2022-01-31 05:29:53,666 42399 INFO bv_shurhold psycopg2.errors.NotNullViolation: null value in column "partner_id" of relation "sale_order" violates not-null constraint

DETAIL: Failing row contains (1801, null, null, null, null, null, Fwd: No attachments, null, null, null, draft, 2022-01-31 05:29:53, null, t, f, 2022-01-31 05:29:50.451351, 2, null, null, null, null, null, null, null, , null, null, null, null, null, null, 1, 1, null, null, null, null, 2, 2, 2022-01-31 05:29:50.451351, null, null, direct, 1, null, null, null, null, null, null, null, null, null, f, percent, null, null, null, null, null, null, null, null, null, null, f, null, f, f, f, null, null, null, null, null, none, none, null, null, null, null, null, null, unallocated, pending, ground_order, null, null, f, f, null, null, null, f, null, null, null, null, 2, null).

Avatar
Discard

 Hi Akash,

you cannot Create sale order without partner_id. so you should first create res.partner record and then sale order with this record from the email.

Sale Order allways needs a pre defined res.partner record to be created.

if you already have a pre defined res.partner then send the partner_id with the mail and insert it in the partner_id field in sale order and then youll get no errors anymore.


hope that this solve your problem.

Avatar
Discard

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!