Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T0424 FEAT: Add field to the tag to help identify them #7

Merged
merged 3 commits into from
Nov 20, 2023

Conversation

nfluckiger
Copy link

We are adding some fields to give more information to the tag. The main 3 are the author, the department who use the tag and a description. We add those to all tag and show them in the list view.
To add the department we need to add a new dependence the hr base module.

We add a new value to the smart part of the tag. This new value give the possibility to give a end date to a tag. We had a cron who archive tag who are older than their valid date.

@ecino
Copy link
Member

ecino commented Nov 14, 2023

Pre-commit must be executed for the tests to pass. In a terminal, on the repository, run :

pip install pre-commit pre-commit run -a

Also the tests are failing with this issue:

`2023-11-14 07:22:56,655 531 WARNING odoo odoo.fields: Field res.partner.category.tagged_partner_count: unknown parameter 'stored', if this is an actual parameter you may want to override the method _valid_field_parameter on the relevant model in order to allow it
2023-11-14 07:22:56,752 531 INFO odoo odoo.modules.registry: module partner_tag_smart_assignation: creating or updating database tables
2023-11-14 07:22:56,944 531 INFO odoo odoo.modules.loading: loading partner_tag_smart_assignation/cron/update_cron.xml
2023-11-14 07:22:56,956 531 INFO odoo odoo.modules.loading: loading partner_tag_smart_assignation/views/smart_tagger_view.xml
2023-11-14 07:22:56,988 531 INFO odoo odoo.modules.loading: Module partner_tag_smart_assignation: loading demo
2023-11-14 07:22:57,000 531 INFO odoo odoo.addons.partner_tag_smart_assignation.tests.test_smart_tagger: Starting TestSmartTagger.test_check_validity_dates ...
2023-11-14 07:22:57,079 531 WARNING odoo odoo.models: method res.partner.category.check_condition: @constrains parameter 'tag_filter_condition_id.model_id' is not a field name
2023-11-14 07:22:57,079 531 WARNING odoo odoo.models: method res.partner.category.check_condition: @constrains parameter 'tag_filter_condition_id.domain' is not a field name
2023-11-14 07:22:57,093 531 ERROR odoo odoo.sql_db: bad query: INSERT INTO "ir_filters" ("id", "create_uid", "create_date", "write_uid", "write_date", "action_id", "active", "context", "domain", "is_default", "model_id", "name", "sort", "user_id") VALUES (nextval('ir_filters_id_seq'), 1, (now() at time zone 'UTC'), 1, (now() at time zone 'UTC'), NULL, true, '{}', '[["name","ilike","o"]]', false, 'res.partner', 'SmartTagTestCondition', '[]', NULL) RETURNING id
ERROR: duplicate key value violates unique constraint "ir_filters_name_model_uid_unique_action_index"
DETAIL: Key (lower(name::text), model_id, (COALESCE(user_id, '-1'::integer)), (COALESCE(action_id, '-1'::integer)))=(smarttagtestcondition, res.partner, -1, -1) already exists.

2023-11-14 07:22:57,097 531 INFO odoo odoo.addons.partner_tag_smart_assignation.tests.test_smart_tagger: ======================================================================
2023-11-14 07:22:57,097 531 ERROR odoo odoo.addons.partner_tag_smart_assignation.tests.test_smart_tagger: ERROR: TestSmartTagger.test_check_validity_dates
Traceback (most recent call last):
File "/__w/partner-contact/partner-contact/partner_tag_smart_assignation/tests/test_smart_tagger.py", line 144, in test_check_validity_dates
active_tag = self.create_tag()
File "/__w/partner-contact/partner-contact/partner_tag_smart_assignation/tests/test_smart_tagger.py", line 63, in create_tag
"tag_filter_condition_id": self.create_condition().id,
File "/__w/partner-contact/partner-contact/partner_tag_smart_assignation/tests/test_smart_tagger.py", line 43, in create_condition
"action_id": False,
File "", line 2, in create
File "/opt/odoo/odoo/api.py", line 352, in _model_create_multi
return create(self, [arg])
File "/opt/odoo/odoo/addons/base/models/ir_fields.py", line 534, in create
recs = super().create(vals_list)
File "", line 2, in create
File "/opt/odoo/odoo/api.py", line 353, in _model_create_multi
return create(self, arg)
File "/opt/odoo/odoo/models.py", line 3892, in create
records = self._create(data_list)
File "/opt/odoo/odoo/models.py", line 3998, in _create
cr.execute(query, params)
File "", line 2, in execute
File "/opt/odoo/odoo/sql_db.py", line 101, in check
return f(self, *args, **kwargs)
File "/opt/odoo/odoo/sql_db.py", line 301, in execute
res = self._obj.execute(query, params)
psycopg2.IntegrityError: duplicate key value violates unique constraint "ir_filters_name_model_uid_unique_action_index"
DETAIL: Key (lower(name::text), model_id, (COALESCE(user_id, '-1'::integer)), (COALESCE(action_id, '-1'::integer)))=(smarttagtestcondition, res.partner, -1, -1) already exists.`

We are adding some fields to give more information to the tag. The main 3 are the author, the department who use the tag and a description. We add those to all tag and show them in the list view.
To add the department we need to add a new dependence the hr base module.

We add a new value to the smart part of the tag. This new value give the possibility to give a end date to a tag. We had a cron who  archive tag who are older than their valid date.
@ecino ecino merged commit ee0cc6e into CompassionCH:14.0 Nov 20, 2023
1 of 4 checks passed
ecino pushed a commit that referenced this pull request Nov 20, 2023
* added fields

* added dropdown and valid_until

* T0424 FEAT: Add field to the tag to help identify them

We are adding some fields to give more information to the tag. The main 3 are the author, the department who use the tag and a description. We add those to all tag and show them in the list view.
To add the department we need to add a new dependence the hr base module.

We add a new value to the smart part of the tag. This new value give the possibility to give a end date to a tag. We had a cron who  archive tag who are older than their valid date.

---------

Co-authored-by: zoro2002 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants