Files
odoo_source/addons/utm/tests
Adrien Schoffeniels 9e071ac34c [FIX] utm, *: allow quick creation of campaigns
Purpose:
========
Since the introduction of the required "title" field in the utm_campaign
model in commit [1], quick creation of campaigns from many2ones is not
possible anymore (the slow creation modal is opened when clicking on
"Create"), and the name value entered is not copied into the name field
of the creation form.

This is because the model now has a field "name", and a field "title",
which are both required. The creation using the many2one widget tries to
create a record using the entered value as title and no name, which fails.

It fails because the create method replaces this empty name by a False
value, since it could not generate a unique name given no name.

This commit makes sure that if a title but no name is given when creating
a new campaign record, one does not set the name value to False anymore.

It also makes sure that the value entered before clicking on the "create
and edit" button is copied in the form, by adding the "create_name_field"
option on the many2one fields (the form uses the title field, not the
name).
The "always_reload" option has also been added because without it, the
many2one shows the name of the created record instead of showing the title.

[1]: https://github.com/odoo/odoo/commit/4dbcefb5e5b1878e81fe9be9fe48a785f813334f

Task-3113954

closes odoo/odoo#110474

X-original-commit: 869208cd09b6ceb5dcda55b6fe4131d7cc8d43e8
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-01-20 06:21:02 +01:00
..
…