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

[IMP] sql_export_mail, add partner as export email recipient #979

Open
wants to merge 3 commits into
base: 16.0
Choose a base branch
from

Conversation

joepsanders
Copy link

Adds partner_ids additional to user_ids to send the result of an sql_export by email.

  • Doesn't allow the usage of dynamic parameters "user_id" or "company_id" in combination with sending the report to a partner_id. This to prevent unwanted / unfiltered results to recipients.
  • Adds the email addresses of selected partners to the email addresses of selected users (if any)

@OCA-git-bot
Copy link
Contributor

Hi @legalsylvain,
some modules you are maintaining are being modified, check this out!

@joepsanders joepsanders force-pushed the oca-158-sqlexportmail-add-respartner-recipient branch from dc2119d to 4301da4 Compare February 18, 2025 14:10
@joepsanders joepsanders force-pushed the oca-158-sqlexportmail-add-respartner-recipient branch from b4fd008 to 678e37b Compare February 19, 2025 15:47
@joepsanders
Copy link
Author

squashed PR feedback @legalsylvain, could you review this addition?

Copy link
Contributor

@legalsylvain legalsylvain left a comment

Choose a reason for hiding this comment

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

hi @joepsanders Thanks for this addition.
Some minor remarks inline. Otherwise LGTM.

@@ -1,7 +1,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "SQL Export Mail",
"version": "16.0.2.0.2",
"version": "16.0.2.1.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to bump the version manually, as there is no migration script.

Copy link
Author

Choose a reason for hiding this comment

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

isn't this version update following the OCA guidelines? https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#12version-numbers

"y (Minor): Increments when new features are added that do not break backward compatibility. A module upgrade will likely be necessary."

Copy link
Contributor

@legalsylvain legalsylvain Feb 20, 2025

Choose a reason for hiding this comment

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

That's not my point.
The point is : Do not propose a change of version. When merging, maintainers will call "ocabot merge patch /minor / major". And then it will bump the version at this step.
Otherwise, if another PR bump also the version in the meantime, you'll face a conflict.

Copy link
Author

Choose a reason for hiding this comment

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

thanks for explaining!

@@ -138,13 +146,38 @@ def check_mail_user(self):
if not user.email:
raise UserError(_("The user does not have any e-mail address."))

@api.constrains("mail_partner_ids")
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the constrains should be raised, when query is changed. Or did I missed something ?

else:
mail_users = self.mail_user_ids
return ",".join([x.email for x in mail_users if x.email])
Copy link
Contributor

Choose a reason for hiding this comment

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

there was a test if user email was defined (or not). Why is the test removed ?

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@legalsylvain legalsylvain Feb 20, 2025

Choose a reason for hiding this comment

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

I don't think so.

Just tested in a shell :

(Console) >>> env["res.partner"].create({"name": "bob"}).mapped("email") [False] >>> ",".join([False]) Traceback (most recent call last): File "", line 1, in TypeError: sequence item 0: expected str instance, bool found

Copy link
Author

Choose a reason for hiding this comment

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

I stand corrected, thanks ;). See 2nd fixup commit

@joepsanders
Copy link
Author

hi @joepsanders Thanks for this addition. Some minor remarks inline. Otherwise LGTM.

Hi @legalsylvain, thanks for your swift review! See my answers / questions to your remarks and a fixup commit (to be squashed).

@joepsanders joepsanders force-pushed the oca-158-sqlexportmail-add-respartner-recipient branch from 9ba142d to deb77d3 Compare February 20, 2025 08:07
@joepsanders joepsanders force-pushed the oca-158-sqlexportmail-add-respartner-recipient branch from 90d70f7 to 3ba4d18 Compare February 20, 2025 09:12
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.

4 participants