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

[16.0][MIG] pingen: Migration to 16.0 #315

Merged
merged 35 commits into from
Dec 28, 2023

Conversation

ajaniszewska-dev
Copy link

@ajaniszewska-dev ajaniszewska-dev commented Jan 26, 2023

@ajaniszewska-dev ajaniszewska-dev changed the title [MIG] $MODULE: Migration to 12.0 [MIG] pingen Migration to 16.0 Jan 26, 2023
@ajaniszewska-dev ajaniszewska-dev changed the title [MIG] pingen Migration to 16.0 [MIG] pingen: Migration to 16.0 Jan 26, 2023
@ajaniszewska-dev ajaniszewska-dev changed the title [MIG] pingen: Migration to 16.0 [WIP][MIG] pingen: Migration to 16.0 Jan 26, 2023
@ajaniszewska-dev ajaniszewska-dev force-pushed the 16.0-mig-pingen branch 19 times, most recently from 68fe609 to 3e2c5f0 Compare January 31, 2023 13:08
Comment on lines 21 to 22
A second cron updates the informations of the documents from pingen.com, so we
know which of them have been sent.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is now managed through webhooks calls from pingen, can you please update?

Comment on lines 27 to 34
The authentication token is configured on the company's view. You can also
tick a checkbox if the staging environment (https://stage-api.pingen.com)
should be used.

The setup of the 2 crons can be changed as well:

* Run Pingen Document Push
* Run Pingen Document Update
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please update this part as well? Explaining how to configure the webhooks and so on?

Copy link
Author

Choose a reason for hiding this comment

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

@grindtildeath updated

@ajaniszewska-dev ajaniszewska-dev force-pushed the 16.0-mig-pingen branch 2 times, most recently from 3636851 to 3cc98c2 Compare October 9, 2023 13:41
pingen/__manifest__.py Outdated Show resolved Hide resolved
pingen/__manifest__.py Outdated Show resolved Hide resolved
pingen/readme/CONTRIBUTORS.rst Show resolved Hide resolved
Copy link
Contributor

@simahawk simahawk left a comment

Choose a reason for hiding this comment

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

LG overall. Can you please squash commits?

pingen/controllers/main.py Outdated Show resolved Hide resolved
staging=self.pingen_staging,
)

def _get_pingen_client(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't this redundant?

Copy link
Author

Choose a reason for hiding this comment

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

i dont see why?

Copy link
Contributor

Choose a reason for hiding this comment

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

because you return the same result of _pingen?

Copy link
Contributor

Choose a reason for hiding this comment

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

@ajaniszewska-dev
We could keep only _get_pingen_client and remove the extra call to _pingen. Not blocking though

pingen/tests/__init__.py Outdated Show resolved Hide resolved
@ajaniszewska-dev ajaniszewska-dev force-pushed the 16.0-mig-pingen branch 2 times, most recently from b0e5817 to 945608f Compare October 10, 2023 11:12
pingen/__init__.py Outdated Show resolved Hide resolved
@simahawk
Copy link
Contributor

@grindtildeath ping

Copy link
Contributor

@grindtildeath grindtildeath left a comment

Choose a reason for hiding this comment

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

Few more things to clean up

staging=self.pingen_staging,
)

def _get_pingen_client(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

@ajaniszewska-dev
We could keep only _get_pingen_client and remove the extra call to _pingen. Not blocking though

letter_id=document_uuid,
)
return response.json().get("data", {}).get("attributes")
# return response.json()['item']
Copy link
Contributor

Choose a reason for hiding this comment

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

🔥

Comment on lines 266 to 269
# if rjson.get('send'):
# # confusing name but send_id is the posted id
# posted_id = rjson['send'][0]['send_id']
# item = rjson['item']
Copy link
Contributor

Choose a reason for hiding this comment

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

🔥

Comment on lines 227 to 234
# we cannot use the `files` param alongside
# with the `datas`param when data is a
# JSON-encoded data. We have to construct
# the entire body and send it to `data`
# https://github.com/kennethreitz/requests/issues/950
# formdata = {
# 'file': (filename, filestream.read()),
# }
Copy link
Contributor

Choose a reason for hiding this comment

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

🔥

Comment on lines 237 to 239
# file_upload = self._get_file_upload()

# multipart, content_type = encode_multipart_formdata(formdata)
Copy link
Contributor

Choose a reason for hiding this comment

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

🔥

"file_original_name": filename,
"file_url": url,
"file_url_signature": url_signature,
# TODO Use parameters and mapping
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this TODO still relevant?

Copy link
Author

Choose a reason for hiding this comment

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

i'd like to know it too...probably not so ill remove together will all other commented code

def _prepare_pingen_document_vals(self):
return {
"attachment_id": self.id,
# 'config': 'created from attachment'
Copy link
Contributor

Choose a reason for hiding this comment

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

🔥

@@ -0,0 +1,317 @@
# Author: Guewen Baconnier
# Copyright 2012-2017 Camptocamp SA
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Copyright 2012-2017 Camptocamp SA
# Copyright 2012-2023 Camptocamp SA

I would do the same for all the other files

Comment on lines 141 to 145
# if post_id:
# state = 'sendcenter'
# elif infos['requirement_failure']:
# state = 'pingen_error'
# error = _('The document does not meet the Pingen requirements.')
Copy link
Contributor

Choose a reason for hiding this comment

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

🔥


<record forcecreate="True" id="ir_cron_update_pingen" model="ir.cron">
<field name="name">Run Pingen Document Update</field>
<field eval="True" name="active" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this one be set to False as default since the webhooks must update the document?

Copy link
Author

Choose a reason for hiding this comment

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

seems to make sense, updated

@github-actions github-actions bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Oct 15, 2023
@ajaniszewska-dev
Copy link
Author

@pedrobaeza any chance to merge this?

Comment on lines +55 to +56
return "https://api-staging.v2.pingen.com"
return "https://api.v2.pingen.com"
Copy link
Contributor

Choose a reason for hiding this comment

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

The urls with ".v2." will be discontinued in April 2024

Copy link
Author

Choose a reason for hiding this comment

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

as there is card for that, we will followup in another PR, so lets try to merge this one first.

@pedrobaeza
Copy link
Member

Please squash commit history for avoiding useless commits like "Remove commented code" or "fix pre-commit". You are also ignoring the commit message conventions:

https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#71commit-message

Please adjust them.

Standard migration, incl. changes proposed in OCA#290
Add unit test.
@ajaniszewska-dev
Copy link
Author

Please squash commit history for avoiding useless commits like "Remove commented code" or "fix pre-commit". You are also ignoring the commit message conventions:

https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#71commit-message

Please adjust them.

@pedrobaeza should be better. If there is still any wrong commit - please point what i missed. Thank you.

@pedrobaeza pedrobaeza changed the title [MIG] pingen: Migration to 16.0 [16.0][MIG] pingen: Migration to 16.0 Dec 28, 2023
@pedrobaeza
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 16.0-ocabot-merge-pr-315-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit d73e606 into OCA:16.0 Dec 28, 2023
5 of 7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 671f36c. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.