Purpose:
When we have a SQL error, it's not very easy to identify the root of the crash. For example if a mandatory field is not set on a row creation, it difficult to see which field isn't correctly set as a lot of fields are not required and a lot a NULL values are present in the INSERT querry.
Specification:
Show a proper log message, with the reason (cause) of the sql error.
Behavior Modification Examples:
Some sample log after applied fix. The new line are those beginning by '+'
2016-10-25 09:59:40,208 21161 INFO ent_master odoo.sql_db: bad query: INSERT INTO "res_partner_category" ("id", "active", "color", "create_uid", "write_uid", "create_date", "write_date") VALUES(nextval('res_partner_category_id_seq'), true, 10, 1, 1, (now() at time zone 'UTC'), (now() at time zone 'UTC')) RETURNING id
+REASON: null value in column "name" violates not-null constraint
+DETAIL: Failing row contains (27, null, null, 1, null, 10, 1, null, 2016-10-25 09:59:40.207202, t, 2016-10-25 09:59:40.207202).
2016-10-25 10:00:29,710 21161 INFO ent_master odoo.sql_db: bad query: UPDATE "res_partner" SET "parent_id"=1001,"type"='contact',"name"='Course Script',"company_name"=NULL,"write_uid"=1,"write_date"=(now() at time zone 'UTC') WHERE id IN (1)
+REASON: insert or update on table "res_partner" violates foreign key constraint "res_partner_parent_id_fkey"
+DETAIL: Key (parent_id)=(1001) is not present in table "res_partner".
2016-10-25 10:23:28,690 21336 INFO ent_master odoo.sql_db: bad query: DELETE FROM res_country WHERE id IN (235)
+REASON: null value in column "country_id" violates not-null constraint
+DETAIL: Failing row contains (9, 1, AL, Alabama, null, 1, 2016-10-24 10:19:58.765552, 2016-10-21 09:32:26.939607).
+CONTEXT: SQL statement "UPDATE ONLY "public"."res_country_state" SET "country_id" = NULL WHERE $1 OPERATOR(pg_catalog.=) "country_id""
Purpose is to remove old variables in next version:
- obj
- object
- cr
- user
- uid
- context
- pool
- workflow
record = model.browse(env.context['active_id'])
records = model.browse(env.context['active_ids'])
obj, object => record
user => env.user
cr => env.cr
uid => env.user.id
context => env.context
pool => env
workflow => record.signal_workflow()
After modifying the database schema, if some models do not have a table/view,
attempt to recreate it by calling their method `init()`, following inter-model
dependencies.
Fix the model `board.board` by making it an abstract model.
Add the missing model dependencies on report `crm.partner.report.assign` to make
it depend on report `account.invoice.report`.
If multiple views had the same name and same priority, the order
of application of their xpath was not deterministic. That may be a
big deal if both of them were doing xpath with position = inside.
This fixes the problem of recomputing that field in a much better way. The
field was stored for the sake of searching; instead we implemented a search
method for it.
Migration in new api, remove user_id in the request.
This commit avoid to have traceback: 'ValueError: : tuple index out of range'
This commit closes#13860