Skip to content

Commit

Permalink
purchase_order_ubl_py3o: black, isort, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexis-via committed Jul 13, 2023
1 parent e3a8e6e commit 8fe93c9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 18 deletions.
3 changes: 2 additions & 1 deletion purchase_order_ubl/models/purchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ def embed_ubl_xml_in_pdf(self, pdf_content, pdf_file=None):
xml_string, self.get_document_name(doc_type), version=version
)
pdf_content = self.embed_xml_in_pdf(
xml_string, xml_filename, pdf_content=pdf_content, pdf_file=pdf_file)
xml_string, xml_filename, pdf_content=pdf_content, pdf_file=pdf_file
)
return pdf_content

def get_ubl_purchase_order_doc_type(self):
Expand Down
18 changes: 9 additions & 9 deletions purchase_order_ubl_py3o/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'Py3o UBL Purchase Order',
'version': '14.0.1.0.0',
'category': 'Purchases',
'license': 'AGPL-3',
'summary': 'Generate UBL purchase orders with Py3o reporting engine',
'author': 'Akretion,Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/edi',
'depends': ['purchase_order_ubl', 'report_py3o_fusion_server'],
'installable': True,
"name": "Py3o UBL Purchase Order",
"version": "14.0.1.0.0",
"category": "Purchases",
"license": "AGPL-3",
"summary": "Generate UBL purchase orders with Py3o reporting engine",
"author": "Akretion,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/edi",
"depends": ["purchase_order_ubl", "report_py3o_fusion_server"],
"installable": True,
}
16 changes: 8 additions & 8 deletions purchase_order_ubl_py3o/models/py3o_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@


class Py3oReport(models.TransientModel):
_inherit = 'py3o.report'
_inherit = "py3o.report"

@api.model
def _ubl_purchase_order_report_names(self):
return [
'purchase.report_purchaseorder',
'purchase.report_purchasequotation']
return ["purchase.report_purchaseorder", "purchase.report_purchasequotation"]

Check warning on line 13 in purchase_order_ubl_py3o/models/py3o_report.py

View check run for this annotation

Codecov / codecov/patch

purchase_order_ubl_py3o/models/py3o_report.py#L13

Added line #L13 was not covered by tests

def _postprocess_report(self, model_instance, result_path):
purchase_reports = self._ubl_purchase_order_report_names()

Check warning on line 16 in purchase_order_ubl_py3o/models/py3o_report.py

View check run for this annotation

Codecov / codecov/patch

purchase_order_ubl_py3o/models/py3o_report.py#L16

Added line #L16 was not covered by tests
# We could match on object instead of report_name...
# but I'm not sure it's a better approach
if (
self.ir_actions_report_id.report_name in purchase_reports
and self.ir_actions_report_id.report_type == 'py3o'
and self.ir_actions_report_id.py3o_filetype == 'pdf'
and model_instance and result_path):
self.ir_actions_report_id.report_name in purchase_reports
and self.ir_actions_report_id.report_type == "py3o"
and self.ir_actions_report_id.py3o_filetype == "pdf"
and model_instance
and result_path
):
# re-write PDF on report_path
model_instance.embed_ubl_xml_in_pdf(None, pdf_file=result_path)
return super()._postprocess_report(model_instance, result_path)

Check warning on line 28 in purchase_order_ubl_py3o/models/py3o_report.py

View check run for this annotation

Codecov / codecov/patch

purchase_order_ubl_py3o/models/py3o_report.py#L27-L28

Added lines #L27 - L28 were not covered by tests
6 changes: 6 additions & 0 deletions setup/purchase_order_ubl_py3o/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit 8fe93c9

Please sign in to comment.