Skip to content

Commit

Permalink
Remove commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaniszewska-dev committed Oct 11, 2023
1 parent 6d2a3ef commit 94da297
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 33 deletions.
2 changes: 1 addition & 1 deletion pingen/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Author: Guewen Baconnier
# Copyright 2012-2017 Camptocamp SA
# Copyright 2012-2023 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
Expand Down
2 changes: 1 addition & 1 deletion pingen/data/pingen_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<record forcecreate="True" id="ir_cron_update_pingen" model="ir.cron">
<field name="name">Run Pingen Document Update</field>
<field eval="True" name="active" />
<field eval="False" name="active" />
<field name="user_id" ref="base.user_root" />
<field name="interval_number">1</field>
<field name="interval_type">days</field>
Expand Down
2 changes: 1 addition & 1 deletion pingen/models/base_config_settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2018 Camptocamp SA
# Copyright 2012-2023 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models

Expand Down
3 changes: 1 addition & 2 deletions pingen/models/ir_attachment.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Author: Guewen Baconnier
# Copyright 2012-2017 Camptocamp SA
# Copyright 2012-2023 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

import base64
Expand All @@ -22,7 +22,6 @@ class IrAttachment(models.Model):
def _prepare_pingen_document_vals(self):
return {
"attachment_id": self.id,
# 'config': 'created from attachment'
}

def _handle_pingen_document(self):
Expand Down
21 changes: 1 addition & 20 deletions pingen/models/pingen.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Author: Guewen Baconnier
# Copyright 2012-2017 Camptocamp SA
# Copyright 2012-2023 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

import json
Expand Down Expand Up @@ -224,27 +224,13 @@ def push_document(
3. dict of the created item on pingen (details)
"""

# 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()),
# }

url, url_signature = self._get_file_upload()
# file_upload = self._get_file_upload()

# multipart, content_type = encode_multipart_formdata(formdata)

self.upload_file(url, filestream.read(), content_type)

data_attributes = {
"file_original_name": filename,
"file_url": url,
"file_url_signature": url_signature,
# TODO Use parameters and mapping
"address_position": "left",
"auto_send": send,
"delivery_product": delivery_product,
Expand All @@ -263,10 +249,6 @@ def push_document(
rjson_data = response.json().get("data", {})

document_id = rjson_data.get("id")
# if rjson.get('send'):
# # confusing name but send_id is the posted id
# posted_id = rjson['send'][0]['send_id']
# item = rjson['item']
item = rjson_data.get("attributes")

return document_id, False, item
Expand Down Expand Up @@ -314,4 +296,3 @@ def post_infos(self, document_uuid):
letter_id=document_uuid,
)
return response.json().get("data", {}).get("attributes")

Check warning on line 298 in pingen/models/pingen.py

View check run for this annotation

Codecov / codecov/patch

pingen/models/pingen.py#L298

Added line #L298 was not covered by tests
# return response.json()['item']
7 changes: 1 addition & 6 deletions pingen/models/pingen_document.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Author: Guewen Baconnier
# Copyright 2012-2017 Camptocamp SA
# Copyright 2012-2023 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

import logging
Expand Down Expand Up @@ -138,11 +138,6 @@ def _push_to_pingen(self, pingen=None):
raise

Check warning on line 138 in pingen/models/pingen_document.py

View check run for this annotation

Codecov / codecov/patch

pingen/models/pingen_document.py#L138

Added line #L138 was not covered by tests
error = False
state = "pushed"
# if post_id:
# state = 'sendcenter'
# elif infos['requirement_failure']:
# state = 'pingen_error'
# error = _('The document does not meet the Pingen requirements.')
push_date = pingen_datetime_to_utc(infos.get("created_at"))
self.write(
{
Expand Down
2 changes: 1 addition & 1 deletion pingen/models/res_company.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Author: Guewen Baconnier
# Copyright 2012-2017 Camptocamp SA
# Copyright 2012-2023 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models
Expand Down
2 changes: 1 addition & 1 deletion pingen/tests/test_pingen.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Camptocamp SA
# Copyright 2012-2023 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

import base64
Expand Down

0 comments on commit 94da297

Please sign in to comment.