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

11.0 mig mass_mailing_list_dynamic #284

Closed
wants to merge 6 commits into from

Conversation

damcar
Copy link
Contributor

@damcar damcar commented Jun 14, 2018

Need mass_mailing_partner (dependency) module to works.

@damcar damcar changed the title 11.0 mig mass mailing list dynamic 11.0 mig mass_mailing_list_dynamic Jun 14, 2018
@yajo yajo added this to the 11.0 milestone Jun 15, 2018
@yajo
Copy link
Member

yajo commented Jun 15, 2018

Thanks, setting as WIP until dependency is merged.

yajo and others added 6 commits June 28, 2018 18:12
* [FIX+IMP] mass_mailing_list_dynamic: tests, icons, filters...

* Brand new icon
* Added feature of loading an existing filter as criteria
* Tests as SavepointCase for optimizing times
* Tests in post-install for avoiding errors on res.partner not null constraints
  when several modules added them.
* Updated documentation.
* Fix mock in test for not commiting test data.

* [FIX] mass_mailing_list_dynamic: Wasn't able to create contacts in fully synced lists

Syncing context was being set in the wrong object. Added to test too.

* [FIX] mass_mailing_list_dynamic: Allow to write back vals from res.partner

Module mass_mailing_partner writes back certain values from partner to
mass_mailing_contact. Module should allow that write operation.
- Adds is_synced field to track whether a dynamic list has unsynced
changes or not so the user is aware that the definitive number of
contacts is yet to be determined.
- It fixes an issue that made impossible deleting a res.partner filter
when a list had use it to filter contacts.
- It also shows only the filters available for the user (shared and
belonging to self).
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About the change you have made on the behavior, I think it should be at least configurable, having 2 options:

  • Always create new mass mailing contacts
  • Try to reuse existing mass mailing contacts

The first one will use the behavior on previous version, and the second will use your new method.

Why this? Because there's something important in the mass mailing contacts management: the unsubscription. If you always reuse existing contacts, then if the contact has opt_out checked, it won't receive any mailing, so the dynamic list won't serve at all.

That's why I would even say that the default behavior should be the first one.

What do you think?

for one in self:
if any((list.dynamic and
list.sync_method == "full") for list in one.list_ids):
# if any((one.list_id.dynamic and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this commented text

# one.list_id.sync_method == "full") for one in self):
raise ValidationError(
_("Cannot edit manually contacts in a fully "
"synchronized list. Change its sync method or execute "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Align correctly these lines

]).unlink()
current_contacts = Contact.search([("list_id", "=", one.id)])
current_partners = current_contacts.mapped("partner_id")
contacts = Contact.search([("list_ids", "in", [one.id]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why changing the style in this search? This need one extra line for the same arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right, it's not necessary!

@pedrobaeza
Copy link
Member

@damcar have you seen my comments?

@damcar
Copy link
Contributor Author

damcar commented Aug 29, 2018

@pedrobaeza sorry for the response time!
Regarding your comments of 28/06, it's a good idea, i will take this change.
For your other comments in the code, it's ok for me.

for contact in contacts:
# No delete contacts with other lists
if len(contact.list_ids) > 1:
contact.write({'list_ids': [(3, one.id, False)]})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might prefer to do contact.list_ids -= one

# Add list in existing contacts
for contact in current_contacts_not_in_list:
contact.write({
"list_ids": [(4, one.id, False)],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you might also prefer contact.list_ids |= one

@rafaelbn
Copy link
Member

Hello! Thanks fo this contribution! 😄

Travis is 🔴 runbot is 🔴 this both should be fixed

In this kinf of migration the most important is thinking that there are customer using this in v10 in production and when we migrate them to v11 the modules should make the same, could have improvements but never change behavior.

@emagdalenaC2i emagdalenaC2i mentioned this pull request Dec 29, 2018
26 tasks
@github-actions
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Dec 12, 2021
@github-actions github-actions bot closed this Jan 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants