-
-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] purchase_order_ubl_py3o from v10 to v14
- Loading branch information
1 parent
87be97d
commit e3a8e6e
Showing
9 changed files
with
25 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
======================= | ||
Py3o UBL Purchase Order | ||
======================= | ||
|
||
If you use the py3o reporting engine (module *report_py3o* from the `reporting-engine <https://github.com/OCA/reporting-engine>`_ OCA project) to generate your PDF purchase orders/RFQs and you want these PDF documents to have an embedded UBL XML file, this module is for you ! | ||
|
||
Configuration | ||
============= | ||
|
||
No configuration is needed. | ||
|
||
Usage | ||
===== | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/226/10.0 | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/OCA/edi/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smashing it by providing a detailed and welcomed feedback. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Alexis de Lattre <[email protected]> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
To contribute to this module, please visit https://odoo-community.org. | ||
Will be re-generated from readme subdir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2017 Akretion (Alexis de Lattre <[email protected]>) | ||
# Copyright 2017-2021 Akretion France (http://www.akretion.com/) | ||
# @author: Alexis de Lattre <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
'name': 'Py3o UBL Purchase Order', | ||
'version': '10.0.1.0.0', | ||
'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': 'http://www.akretion.com', | ||
'depends': ['purchase_order_ubl', 'report_py3o'], | ||
'website': 'https://github.com/OCA/edi', | ||
'depends': ['purchase_order_ubl', 'report_py3o_fusion_server'], | ||
'installable': True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import py3o_report |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,28 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2017 Akretion (Alexis de Lattre <[email protected]>) | ||
# Copyright 2017-2021 Akretion France (http://www.akretion.com/) | ||
# @author: Alexis de Lattre <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models, api | ||
from odoo import api, models | ||
|
||
|
||
class Py3oReport(models.TransientModel): | ||
_inherit = 'py3o.report' | ||
|
||
@api.model | ||
def _postprocess_report(self, report_path, res_id, save_in_attachment): | ||
purchase_reports = [ | ||
def _ubl_purchase_order_report_names(self): | ||
return [ | ||
'purchase.report_purchaseorder', | ||
'purchase.report_purchasequotation'] | ||
|
||
def _postprocess_report(self, model_instance, result_path): | ||
purchase_reports = self._ubl_purchase_order_report_names() | ||
# We could match on object instead of report_name... | ||
# but I'm not sure it's a better approach | ||
if ( | ||
self.ir_actions_report_xml_id.report_name | ||
in purchase_reports and | ||
self.ir_actions_report_xml_id.report_type == 'py3o' and | ||
self.ir_actions_report_xml_id.py3o_filetype == 'pdf' and | ||
res_id and | ||
report_path): | ||
order = self.env['purchase.order'].browse(res_id) | ||
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 | ||
order.embed_ubl_xml_in_pdf(pdf_file=report_path) | ||
return super(Py3oReport, self)._postprocess_report( | ||
report_path, res_id, save_in_attachment) | ||
model_instance.embed_ubl_xml_in_pdf(None, pdf_file=result_path) | ||
return super()._postprocess_report(model_instance, result_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
No configuration needed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Alexis de Lattre <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
If you use the py3o reporting engine (module *report_py3o_fusion_server* from the `reporting-engine <https://github.com/OCA/reporting-engine>`_ OCA project) to generate your PDF purchase orders/RFQs and you want these PDF documents to have an embedded UBL XML file, this module is for you! |