mirror of
https://github.com/bringout/oca-edi.git
synced 2026-04-21 00:52:04 +02:00
Initial commit: OCA Edi packages (42 packages)
This commit is contained in:
commit
df976c03db
2184 changed files with 571602 additions and 0 deletions
|
|
@ -0,0 +1,48 @@
|
|||
# Account Invoice UBL
|
||||
|
||||
Odoo addon: account_invoice_ubl
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install odoo-bringout-oca-edi-framework-account_invoice_ubl
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
This addon depends on:
|
||||
- account_einvoice_generate
|
||||
- account_payment_partner
|
||||
- base_ubl_payment
|
||||
- account_tax_unece
|
||||
- pdf_helper
|
||||
|
||||
## Manifest Information
|
||||
|
||||
- **Name**: Account Invoice UBL
|
||||
- **Version**: 16.0.1.0.0
|
||||
- **Category**: Accounting & Finance
|
||||
- **License**: AGPL-3
|
||||
- **Installable**: True
|
||||
|
||||
## Source
|
||||
|
||||
Based on [OCA/edi-framework](https://github.com/OCA/edi-framework) branch 16.0, addon `account_invoice_ubl`.
|
||||
|
||||
## License
|
||||
|
||||
This package maintains the original AGPL-3 license from the upstream Odoo project.
|
||||
|
||||
## Documentation
|
||||
|
||||
- Overview: doc/OVERVIEW.md
|
||||
- Architecture: doc/ARCHITECTURE.md
|
||||
- Models: doc/MODELS.md
|
||||
- Controllers: doc/CONTROLLERS.md
|
||||
- Wizards: doc/WIZARDS.md
|
||||
- Install: doc/INSTALL.md
|
||||
- Usage: doc/USAGE.md
|
||||
- Configuration: doc/CONFIGURATION.md
|
||||
- Dependencies: doc/DEPENDENCIES.md
|
||||
- Troubleshooting: doc/TROUBLESHOOTING.md
|
||||
- FAQ: doc/FAQ.md
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
.. image:: https://odoo-community.org/readme-banner-image
|
||||
:target: https://odoo-community.org/get-involved?utm_source=readme
|
||||
:alt: Odoo Community Association
|
||||
|
||||
===================
|
||||
Account Invoice UBL
|
||||
===================
|
||||
|
||||
..
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:9f1b0e852851f3ea85dba1780820cf44cc6e13acda198d7323763c4c115fbcc4
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||
:target: https://odoo-community.org/page/development-status
|
||||
:alt: Beta
|
||||
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github
|
||||
:target: https://github.com/OCA/edi/tree/16.0/account_invoice_ubl
|
||||
:alt: OCA/edi
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/edi-16-0/edi-16-0-account_invoice_ubl
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
||||
:target: https://runboat.odoo-community.org/builds?repo=OCA/edi&target_branch=16.0
|
||||
:alt: Try me on Runboat
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
This module adds support for UBL, the `Universal Business Language (UBL)
|
||||
<http://ubl.xml.org/>`_ standard, on invoices. The UBL 2.1 standard became the
|
||||
`ISO/IEC 19845 <http://www.iso.org/iso/catalogue_detail.htm?csnumber=66370>`_
|
||||
standard in December 2015 (cf the `official announce
|
||||
<http://www.prweb.com/releases/2016/01/prweb13186919.htm>`_).
|
||||
|
||||
With this module, you can generate customer invoices/refunds:
|
||||
|
||||
* in PDF format with an embedded UBL XML file
|
||||
* as an XML file with an optional embedded PDF file
|
||||
|
||||
This module supports UBL version 2.1 (used by default) and 2.0.
|
||||
|
||||
**Table of contents**
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
In the menu *Invoicing > Configuration > Settings > Invoicing*, under
|
||||
*Electronic Invoices*, check the value of 2 options:
|
||||
|
||||
* *XML Format embedded in PDF invoice* : if you want to have an UBL XML file
|
||||
embedded inside the PDF invoice, set it to
|
||||
*Universal Business Language (UBL)*
|
||||
* if you work directly with XML invoices and you want to have the PDF invoice
|
||||
in base64 inside the XML file, enable the *Embed PDF in UBL XML Invoice*.
|
||||
|
||||
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 to smash it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/OCA/edi/issues/new?body=module:%20account_invoice_ubl%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Authors
|
||||
~~~~~~~
|
||||
|
||||
* Akretion
|
||||
* Onestein
|
||||
* BCIM
|
||||
|
||||
Contributors
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
* Andrea Stirpe <a.stirpe@onestein.nl>
|
||||
* Foram Shah <foram.shah@initos.com>
|
||||
* Jacques-Etienne Baudoux (BCIM) <je@bcim.be>
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
|
||||
This module is maintained by the OCA.
|
||||
|
||||
.. image:: https://odoo-community.org/logo.png
|
||||
:alt: Odoo Community Association
|
||||
:target: https://odoo-community.org
|
||||
|
||||
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.
|
||||
|
||||
.. |maintainer-jbaudoux| image:: https://github.com/jbaudoux.png?size=40px
|
||||
:target: https://github.com/jbaudoux
|
||||
:alt: jbaudoux
|
||||
|
||||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
||||
|
||||
|maintainer-jbaudoux|
|
||||
|
||||
This module is part of the `OCA/edi <https://github.com/OCA/edi/tree/16.0/account_invoice_ubl>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import models
|
||||
from .hooks import set_xml_format_in_pdf_invoice_to_ubl
|
||||
from .hooks import remove_ubl_xml_format_in_pdf_invoice
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
# Copyright 2016-2018 Akretion (http://www.akretion.com)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "Account Invoice UBL",
|
||||
"version": "16.0.1.0.0",
|
||||
"category": "Accounting & Finance",
|
||||
"license": "AGPL-3",
|
||||
"summary": "Generate UBL XML file for customer invoices/refunds",
|
||||
"author": "Akretion,Onestein,BCIM,Odoo Community Association (OCA)",
|
||||
"maintainers": ["jbaudoux"],
|
||||
"website": "https://github.com/OCA/edi",
|
||||
"depends": [
|
||||
"account_einvoice_generate",
|
||||
"account_payment_partner",
|
||||
"base_ubl_payment",
|
||||
"account_tax_unece",
|
||||
"pdf_helper",
|
||||
],
|
||||
"data": ["views/account_move.xml", "views/res_config_settings.xml"],
|
||||
"post_init_hook": "set_xml_format_in_pdf_invoice_to_ubl",
|
||||
"uninstall_hook": "remove_ubl_xml_format_in_pdf_invoice",
|
||||
"installable": True,
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# Copyright 2018 Akretion (http://www.akretion.com)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# Copyright 2019 Onestein (<https://www.onestein.eu>)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import SUPERUSER_ID, api
|
||||
|
||||
|
||||
def set_xml_format_in_pdf_invoice_to_ubl(cr, registry):
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
companies = env["res.company"].search([])
|
||||
companies.write({"xml_format_in_pdf_invoice": "ubl"})
|
||||
|
||||
|
||||
def remove_ubl_xml_format_in_pdf_invoice(cr, registry):
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
companies = env["res.company"].search([("xml_format_in_pdf_invoice", "=", "ubl")])
|
||||
companies.write({"xml_format_in_pdf_invoice": "none"})
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_invoice_ubl
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_res_company
|
||||
msgid "Companies"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_res_config_settings
|
||||
msgid "Config Settings"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__embed_pdf_in_ubl_xml_invoice
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_config_settings__embed_pdf_in_ubl_xml_invoice
|
||||
msgid "Embed PDF in UBL XML Invoice"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model_terms:ir.ui.view,arch_db:account_invoice_ubl.view_move_form
|
||||
msgid "Generate UBL XML File"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,help:account_invoice_ubl.field_res_company__embed_pdf_in_ubl_xml_invoice
|
||||
#: model:ir.model.fields,help:account_invoice_ubl.field_res_config_settings__embed_pdf_in_ubl_xml_invoice
|
||||
msgid ""
|
||||
"If active, the standalone UBL Invoice XML file will include the PDF of the "
|
||||
"invoice in base64 under the node 'AdditionalDocumentReference'. For example,"
|
||||
" to be compliant with the e-fff standard used in Belgium, you should "
|
||||
"activate this option."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model_terms:ir.ui.view,arch_db:account_invoice_ubl.view_account_config_settings
|
||||
msgid "Include the PDF of the invoice in the standalone UBL Invoice XML file."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_account_move
|
||||
msgid "Journal Entry"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_ir_actions_report
|
||||
msgid "Report Action"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields.selection,name:account_invoice_ubl.selection__res_company__xml_format_in_pdf_invoice__ubl
|
||||
msgid "Universal Business Language (UBL)"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__xml_format_in_pdf_invoice
|
||||
msgid "XML Format embedded in PDF invoice"
|
||||
msgstr ""
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_invoice_ubl
|
||||
#
|
||||
# Translators:
|
||||
# enjolras <yo@miguelrevilla.com>, 2018
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-03-12 01:43+0000\n"
|
||||
"PO-Revision-Date: 2023-11-25 11:34+0000\n"
|
||||
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
|
||||
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
|
||||
"Language: es\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: Weblate 4.17\n"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_res_company
|
||||
msgid "Companies"
|
||||
msgstr "Compañías"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_res_config_settings
|
||||
msgid "Config Settings"
|
||||
msgstr "Ajustes de Configuración"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_account_move__display_name
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_ir_actions_report__display_name
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__display_name
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_config_settings__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "Mostrar Nombre"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__embed_pdf_in_ubl_xml_invoice
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_config_settings__embed_pdf_in_ubl_xml_invoice
|
||||
msgid "Embed PDF in UBL XML Invoice"
|
||||
msgstr "Incrustar PDF en Factura XML UBL"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model_terms:ir.ui.view,arch_db:account_invoice_ubl.view_move_form
|
||||
msgid "Generate UBL XML File"
|
||||
msgstr "Incrustar PDF en Factura XML UBL"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_account_move__id
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_ir_actions_report__id
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__id
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_config_settings__id
|
||||
msgid "ID"
|
||||
msgstr "ID"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,help:account_invoice_ubl.field_res_company__embed_pdf_in_ubl_xml_invoice
|
||||
#: model:ir.model.fields,help:account_invoice_ubl.field_res_config_settings__embed_pdf_in_ubl_xml_invoice
|
||||
msgid ""
|
||||
"If active, the standalone UBL Invoice XML file will include the PDF of the "
|
||||
"invoice in base64 under the node 'AdditionalDocumentReference'. For example, "
|
||||
"to be compliant with the e-fff standard used in Belgium, you should activate "
|
||||
"this option."
|
||||
msgstr ""
|
||||
"Si está activada, el archivo XML de factura UBL independiente incluirá el "
|
||||
"PDF de la factura en base64 en el nodo 'AdditionalDocumentReference'. Por "
|
||||
"ejemplo, para cumplir con la norma e-fff utilizada en Bélgica, debe activar "
|
||||
"esta opción."
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model_terms:ir.ui.view,arch_db:account_invoice_ubl.view_account_config_settings
|
||||
msgid "Include the PDF of the invoice in the standalone UBL Invoice XML file."
|
||||
msgstr ""
|
||||
"Incluir el PDF de la factura en el archivo XML de factura UBL independiente."
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_account_move
|
||||
msgid "Journal Entry"
|
||||
msgstr "Entrada Diaria"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_account_move____last_update
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_ir_actions_report____last_update
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company____last_update
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_config_settings____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr "Última Modificación el"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_ir_actions_report
|
||||
msgid "Report Action"
|
||||
msgstr "Informar Acción"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields.selection,name:account_invoice_ubl.selection__res_company__xml_format_in_pdf_invoice__ubl
|
||||
msgid "Universal Business Language (UBL)"
|
||||
msgstr "Lenguaje Comercial Universal (LCU)"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__xml_format_in_pdf_invoice
|
||||
msgid "XML Format embedded in PDF invoice"
|
||||
msgstr "Formato XML integrado en factura PDF"
|
||||
|
||||
#~ msgid "Invoice"
|
||||
#~ msgstr "Factura"
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_invoice_ubl
|
||||
#
|
||||
# Translators:
|
||||
# Quentin THEURET <odoo@kerpeo.com>, 2018
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-01-29 11:53+0000\n"
|
||||
"PO-Revision-Date: 2018-01-29 11:53+0000\n"
|
||||
"Last-Translator: Quentin THEURET <odoo@kerpeo.com>, 2018\n"
|
||||
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
|
||||
"Language: fr\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_res_company
|
||||
msgid "Companies"
|
||||
msgstr "Sociétés"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_res_config_settings
|
||||
#, fuzzy
|
||||
msgid "Config Settings"
|
||||
msgstr "account.config.settings"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_account_move__display_name
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_ir_actions_report__display_name
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__display_name
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_config_settings__display_name
|
||||
msgid "Display Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__embed_pdf_in_ubl_xml_invoice
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_config_settings__embed_pdf_in_ubl_xml_invoice
|
||||
msgid "Embed PDF in UBL XML Invoice"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model_terms:ir.ui.view,arch_db:account_invoice_ubl.view_move_form
|
||||
msgid "Generate UBL XML File"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_account_move__id
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_ir_actions_report__id
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__id
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_config_settings__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,help:account_invoice_ubl.field_res_company__embed_pdf_in_ubl_xml_invoice
|
||||
#: model:ir.model.fields,help:account_invoice_ubl.field_res_config_settings__embed_pdf_in_ubl_xml_invoice
|
||||
msgid ""
|
||||
"If active, the standalone UBL Invoice XML file will include the PDF of the "
|
||||
"invoice in base64 under the node 'AdditionalDocumentReference'. For example, "
|
||||
"to be compliant with the e-fff standard used in Belgium, you should activate "
|
||||
"this option."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model_terms:ir.ui.view,arch_db:account_invoice_ubl.view_account_config_settings
|
||||
msgid "Include the PDF of the invoice in the standalone UBL Invoice XML file."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_account_move
|
||||
msgid "Journal Entry"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_account_move____last_update
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_ir_actions_report____last_update
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company____last_update
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_config_settings____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_ir_actions_report
|
||||
msgid "Report Action"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields.selection,name:account_invoice_ubl.selection__res_company__xml_format_in_pdf_invoice__ubl
|
||||
msgid "Universal Business Language (UBL)"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__xml_format_in_pdf_invoice
|
||||
msgid "XML Format embedded in PDF invoice"
|
||||
msgstr ""
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_invoice_ubl
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 12.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"PO-Revision-Date: 2019-11-14 16:34+0000\n"
|
||||
"Last-Translator: Bole <bole@dajmi5.com>\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: hr\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
|
||||
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
|
||||
"X-Generator: Weblate 3.8\n"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_res_company
|
||||
msgid "Companies"
|
||||
msgstr "Tvrtke"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_res_config_settings
|
||||
msgid "Config Settings"
|
||||
msgstr "Postavke"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_account_move__display_name
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_ir_actions_report__display_name
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__display_name
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_config_settings__display_name
|
||||
msgid "Display Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__embed_pdf_in_ubl_xml_invoice
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_config_settings__embed_pdf_in_ubl_xml_invoice
|
||||
msgid "Embed PDF in UBL XML Invoice"
|
||||
msgstr "Pridruži PDF u UBL XML datuteku"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model_terms:ir.ui.view,arch_db:account_invoice_ubl.view_move_form
|
||||
msgid "Generate UBL XML File"
|
||||
msgstr "Generiraj UBL XML datoteku"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_account_move__id
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_ir_actions_report__id
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__id
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_config_settings__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,help:account_invoice_ubl.field_res_company__embed_pdf_in_ubl_xml_invoice
|
||||
#: model:ir.model.fields,help:account_invoice_ubl.field_res_config_settings__embed_pdf_in_ubl_xml_invoice
|
||||
msgid ""
|
||||
"If active, the standalone UBL Invoice XML file will include the PDF of the "
|
||||
"invoice in base64 under the node 'AdditionalDocumentReference'. For example, "
|
||||
"to be compliant with the e-fff standard used in Belgium, you should activate "
|
||||
"this option."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model_terms:ir.ui.view,arch_db:account_invoice_ubl.view_account_config_settings
|
||||
msgid "Include the PDF of the invoice in the standalone UBL Invoice XML file."
|
||||
msgstr "Uključi PDF računa u samostalnu UBL XML datoteku."
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_account_move
|
||||
msgid "Journal Entry"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_account_move____last_update
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_ir_actions_report____last_update
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company____last_update
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_config_settings____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_ir_actions_report
|
||||
msgid "Report Action"
|
||||
msgstr "Akcija izvještaja"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields.selection,name:account_invoice_ubl.selection__res_company__xml_format_in_pdf_invoice__ubl
|
||||
msgid "Universal Business Language (UBL)"
|
||||
msgstr "Universal Business Language (UBL)"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__xml_format_in_pdf_invoice
|
||||
msgid "XML Format embedded in PDF invoice"
|
||||
msgstr "XML format ugnježđen u PDF datoteku"
|
||||
|
||||
#~ msgid "Invoice"
|
||||
#~ msgstr "Račun"
|
||||
|
||||
#~ msgid "None"
|
||||
#~ msgstr "Ništa"
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_invoice_ubl
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: it\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_res_company
|
||||
msgid "Companies"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_res_config_settings
|
||||
msgid "Config Settings"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__embed_pdf_in_ubl_xml_invoice
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_config_settings__embed_pdf_in_ubl_xml_invoice
|
||||
msgid "Embed PDF in UBL XML Invoice"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model_terms:ir.ui.view,arch_db:account_invoice_ubl.view_move_form
|
||||
msgid "Generate UBL XML File"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,help:account_invoice_ubl.field_res_company__embed_pdf_in_ubl_xml_invoice
|
||||
#: model:ir.model.fields,help:account_invoice_ubl.field_res_config_settings__embed_pdf_in_ubl_xml_invoice
|
||||
msgid ""
|
||||
"If active, the standalone UBL Invoice XML file will include the PDF of the "
|
||||
"invoice in base64 under the node 'AdditionalDocumentReference'. For example,"
|
||||
" to be compliant with the e-fff standard used in Belgium, you should "
|
||||
"activate this option."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model_terms:ir.ui.view,arch_db:account_invoice_ubl.view_account_config_settings
|
||||
msgid "Include the PDF of the invoice in the standalone UBL Invoice XML file."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_account_move
|
||||
msgid "Journal Entry"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_ir_actions_report
|
||||
msgid "Report Action"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields.selection,name:account_invoice_ubl.selection__res_company__xml_format_in_pdf_invoice__ubl
|
||||
msgid "Universal Business Language (UBL)"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__xml_format_in_pdf_invoice
|
||||
msgid "XML Format embedded in PDF invoice"
|
||||
msgstr ""
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_invoice_ubl
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 13.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"PO-Revision-Date: 2020-12-14 00:28+0000\n"
|
||||
"Last-Translator: Bosd <c5e2fd43-d292-4c90-9d1f-74ff3436329a@anonaddy.me>\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: nl\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: Weblate 4.3.2\n"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_res_company
|
||||
msgid "Companies"
|
||||
msgstr "Bedrijven"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_res_config_settings
|
||||
msgid "Config Settings"
|
||||
msgstr "Configuratie instellingen"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_account_move__display_name
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_ir_actions_report__display_name
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__display_name
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_config_settings__display_name
|
||||
msgid "Display Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__embed_pdf_in_ubl_xml_invoice
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_config_settings__embed_pdf_in_ubl_xml_invoice
|
||||
msgid "Embed PDF in UBL XML Invoice"
|
||||
msgstr "Geintegreerde PDF in UBL XML Factuur"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model_terms:ir.ui.view,arch_db:account_invoice_ubl.view_move_form
|
||||
msgid "Generate UBL XML File"
|
||||
msgstr "Genereer UBL XML bestand"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_account_move__id
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_ir_actions_report__id
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__id
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_config_settings__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,help:account_invoice_ubl.field_res_company__embed_pdf_in_ubl_xml_invoice
|
||||
#: model:ir.model.fields,help:account_invoice_ubl.field_res_config_settings__embed_pdf_in_ubl_xml_invoice
|
||||
msgid ""
|
||||
"If active, the standalone UBL Invoice XML file will include the PDF of the "
|
||||
"invoice in base64 under the node 'AdditionalDocumentReference'. For example, "
|
||||
"to be compliant with the e-fff standard used in Belgium, you should activate "
|
||||
"this option."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model_terms:ir.ui.view,arch_db:account_invoice_ubl.view_account_config_settings
|
||||
msgid "Include the PDF of the invoice in the standalone UBL Invoice XML file."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_account_move
|
||||
msgid "Journal Entry"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_account_move____last_update
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_ir_actions_report____last_update
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company____last_update
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_config_settings____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model,name:account_invoice_ubl.model_ir_actions_report
|
||||
msgid "Report Action"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields.selection,name:account_invoice_ubl.selection__res_company__xml_format_in_pdf_invoice__ubl
|
||||
msgid "Universal Business Language (UBL)"
|
||||
msgstr "Universal Business Language (UBL)"
|
||||
|
||||
#. module: account_invoice_ubl
|
||||
#: model:ir.model.fields,field_description:account_invoice_ubl.field_res_company__xml_format_in_pdf_invoice
|
||||
msgid "XML Format embedded in PDF invoice"
|
||||
msgstr "XML Formaat gebruikt in de PDF factuur"
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import res_company
|
||||
from . import res_config_settings
|
||||
from . import account_move
|
||||
from . import ir_actions_report
|
||||
|
|
@ -0,0 +1,574 @@
|
|||
# Copyright 2016-2017 Akretion (http://www.akretion.com)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# Copyright 2019 Onestein (<https://www.onestein.eu>)
|
||||
# Copyright 2023 Jacques-Etienne Baudoux (BCIM) <je@bcim.be>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
import base64
|
||||
import io
|
||||
import logging
|
||||
|
||||
from lxml import etree
|
||||
|
||||
from odoo import fields, models
|
||||
from odoo.tools import float_is_zero, float_round
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_name = "account.move"
|
||||
_inherit = ["account.move", "base.ubl"]
|
||||
|
||||
def _ubl_add_header(self, parent_node, ns, version="2.1"):
|
||||
self.ensure_one()
|
||||
ubl_version = etree.SubElement(parent_node, ns["cbc"] + "UBLVersionID")
|
||||
ubl_version.text = version
|
||||
doc_id = etree.SubElement(parent_node, ns["cbc"] + "ID")
|
||||
doc_id.text = self.name
|
||||
issue_date = etree.SubElement(parent_node, ns["cbc"] + "IssueDate")
|
||||
issue_date.text = self.invoice_date.strftime("%Y-%m-%d")
|
||||
if (
|
||||
self.invoice_date_due
|
||||
and version >= "2.1"
|
||||
and self.move_type == "out_invoice"
|
||||
):
|
||||
due_date = etree.SubElement(parent_node, ns["cbc"] + "DueDate")
|
||||
due_date.text = fields.Date.to_string(self.invoice_date_due)
|
||||
if self.move_type == "out_invoice":
|
||||
type_code = etree.SubElement(parent_node, ns["cbc"] + "InvoiceTypeCode")
|
||||
elif self.move_type == "out_refund":
|
||||
type_code = etree.SubElement(parent_node, ns["cbc"] + "CreditNoteTypeCode")
|
||||
type_code.text = self._ubl_get_invoice_type_code()
|
||||
if self.narration:
|
||||
note = etree.SubElement(parent_node, ns["cbc"] + "Note")
|
||||
note.text = self.narration
|
||||
doc_currency = etree.SubElement(parent_node, ns["cbc"] + "DocumentCurrencyCode")
|
||||
doc_currency.text = self.currency_id.name
|
||||
# TODO: enable when below commit of 15.0 is back ported to 14.0
|
||||
# [IMP] account_edi(_*): Standalone UBL format + edi.format inheritance
|
||||
# https://github.com/odoo/odoo/commit/b58810a77bb4c432a6aef18413659b1ea7b25c71
|
||||
# or when migrating to 15.0
|
||||
# buyer_reference = etree.SubElement(parent_node, ns["cbc"] + "BuyerReference")
|
||||
# buyer_reference.text = self.ref or ""
|
||||
|
||||
def _ubl_get_invoice_type_code(self):
|
||||
if self.move_type == "out_invoice":
|
||||
return "380"
|
||||
elif self.move_type == "out_refund":
|
||||
return "381"
|
||||
|
||||
def _ubl_get_order_reference(self):
|
||||
"""An identifier of a referenced purchase order, issued by the Buyer"""
|
||||
return self.ref or "/"
|
||||
|
||||
def _ubl_get_salesorder_reference(self):
|
||||
"""An identifier of a referenced sales order, issued by the Seller"""
|
||||
return self.invoice_origin
|
||||
|
||||
def _ubl_add_order_reference(self, parent_node, ns, version="2.1"):
|
||||
self.ensure_one()
|
||||
buyer_ref = self._ubl_get_order_reference()
|
||||
seller_ref = self._ubl_get_salesorder_reference()
|
||||
if buyer_ref or seller_ref:
|
||||
node = etree.SubElement(parent_node, ns["cac"] + "OrderReference")
|
||||
if buyer_ref:
|
||||
node_id = etree.SubElement(node, ns["cbc"] + "ID")
|
||||
node_id.text = buyer_ref
|
||||
if seller_ref:
|
||||
node_salesorderid = etree.SubElement(node, ns["cbc"] + "SalesOrderID")
|
||||
node_salesorderid.text = seller_ref
|
||||
|
||||
def _ubl_get_buyer_reference(self):
|
||||
return self.partner_id.name
|
||||
|
||||
def _ubl_add_buyer_reference(self, parent_node, ns, version="2.1"):
|
||||
self.ensure_one()
|
||||
buyer_ref = self._ubl_get_buyer_reference()
|
||||
if buyer_ref:
|
||||
buyer_order_ref = etree.SubElement(
|
||||
parent_node, ns["cbc"] + "BuyerReference"
|
||||
)
|
||||
buyer_order_ref.text = buyer_ref
|
||||
|
||||
def _ubl_get_contract_document_reference_dict(self):
|
||||
"""Result: dict with key = Doc Type Code, value = ID"""
|
||||
self.ensure_one()
|
||||
return {}
|
||||
|
||||
def _ubl_add_contract_document_reference(self, parent_node, ns, version="2.1"):
|
||||
self.ensure_one()
|
||||
cdr_dict = self._ubl_get_contract_document_reference_dict()
|
||||
for doc_type_code, doc_id in cdr_dict.items():
|
||||
cdr = etree.SubElement(parent_node, ns["cac"] + "ContractDocumentReference")
|
||||
cdr_id = etree.SubElement(cdr, ns["cbc"] + "ID")
|
||||
cdr_id.text = doc_id
|
||||
cdr_type_code = etree.SubElement(cdr, ns["cbc"] + "DocumentTypeCode")
|
||||
cdr_type_code.text = doc_type_code
|
||||
|
||||
def _ubl_add_attachments(self, parent_node, ns, version="2.1"):
|
||||
self.ensure_one()
|
||||
if self.company_id.embed_pdf_in_ubl_xml_invoice and not self.env.context.get(
|
||||
"no_embedded_pdf"
|
||||
):
|
||||
filename = "Invoice-" + self.name + ".pdf"
|
||||
docu_reference = etree.SubElement(
|
||||
parent_node, ns["cac"] + "AdditionalDocumentReference"
|
||||
)
|
||||
docu_reference_id = etree.SubElement(docu_reference, ns["cbc"] + "ID")
|
||||
docu_reference_id.text = filename
|
||||
attach_node = etree.SubElement(docu_reference, ns["cac"] + "Attachment")
|
||||
binary_node = etree.SubElement(
|
||||
attach_node,
|
||||
ns["cbc"] + "EmbeddedDocumentBinaryObject",
|
||||
mimeCode="application/pdf",
|
||||
filename=filename,
|
||||
)
|
||||
ctx = dict()
|
||||
ctx["no_embedded_ubl_xml"] = True
|
||||
ctx["force_report_rendering"] = True
|
||||
pdf_inv = (
|
||||
self.env["ir.actions.report"]
|
||||
.with_context(**ctx)
|
||||
._render_qweb_pdf("account.account_invoices", [self.id])[0]
|
||||
)
|
||||
binary_node.text = base64.b64encode(pdf_inv)
|
||||
|
||||
def _ubl_get_invoice_vat_exclusive_amount(self):
|
||||
amount = self.amount_untaxed
|
||||
# Add also non-VAT taxes that are not subjected to VAT
|
||||
for tline in self.line_ids:
|
||||
if not tline.tax_line_id:
|
||||
continue
|
||||
if tline.tax_line_id.unece_type_id.code != "VAT":
|
||||
sign = 1 if tline.is_refund else -1
|
||||
amount += sign * tline.balance
|
||||
return amount
|
||||
|
||||
def _ubl_get_invoice_vat_amount(self):
|
||||
amount = self.amount_tax
|
||||
# Remove non-VAT taxes that are not subjected to VAT
|
||||
for tline in self.line_ids:
|
||||
if not tline.tax_line_id:
|
||||
continue
|
||||
if tline.tax_line_id.unece_type_id.code != "VAT":
|
||||
sign = 1 if tline.is_refund else -1
|
||||
amount -= sign * tline.balance
|
||||
return amount
|
||||
|
||||
def _ubl_get_charge_total_amount(self):
|
||||
amount = 0.0
|
||||
for tline in self.line_ids:
|
||||
if not tline.tax_line_id:
|
||||
continue
|
||||
if tline.tax_line_id.unece_type_id.code != "VAT":
|
||||
if not tline.tax_line_id.include_base_amount:
|
||||
# For non-VAT taxes, not subject to VAT, they are declared
|
||||
# as AllowanceCharge
|
||||
sign = 1 if tline.is_refund else -1
|
||||
amount += sign * tline.balance
|
||||
return amount
|
||||
|
||||
def _ubl_add_legal_monetary_total(self, parent_node, ns, version="2.1"):
|
||||
self.ensure_one()
|
||||
monetary_total = etree.SubElement(parent_node, ns["cac"] + "LegalMonetaryTotal")
|
||||
cur_name = self.currency_id.name
|
||||
prec = self.currency_id.decimal_places
|
||||
line_total = etree.SubElement(
|
||||
monetary_total, ns["cbc"] + "LineExtensionAmount", currencyID=cur_name
|
||||
)
|
||||
line_total.text = "%0.*f" % (prec, self.amount_untaxed)
|
||||
tax_excl_total = etree.SubElement(
|
||||
monetary_total, ns["cbc"] + "TaxExclusiveAmount", currencyID=cur_name
|
||||
)
|
||||
tax_excl_total.text = "%0.*f" % (
|
||||
prec,
|
||||
self._ubl_get_invoice_vat_exclusive_amount(),
|
||||
)
|
||||
tax_incl_total = etree.SubElement(
|
||||
monetary_total, ns["cbc"] + "TaxInclusiveAmount", currencyID=cur_name
|
||||
)
|
||||
tax_incl_total.text = "%0.*f" % (prec, self.amount_total)
|
||||
charge_total_amount = self._ubl_get_charge_total_amount()
|
||||
if charge_total_amount:
|
||||
el_charge_total_amount = etree.SubElement(
|
||||
monetary_total, ns["cbc"] + "ChargeTotalAmount", currencyID=cur_name
|
||||
)
|
||||
el_charge_total_amount.text = "%0.*f" % (prec, charge_total_amount)
|
||||
prepaid_amount = etree.SubElement(
|
||||
monetary_total, ns["cbc"] + "PrepaidAmount", currencyID=cur_name
|
||||
)
|
||||
prepaid_value = self.amount_total - self.amount_residual
|
||||
prepaid_amount.text = "%0.*f" % (prec, prepaid_value)
|
||||
payable_amount = etree.SubElement(
|
||||
monetary_total, ns["cbc"] + "PayableAmount", currencyID=cur_name
|
||||
)
|
||||
payable_amount.text = "%0.*f" % (prec, self.amount_residual)
|
||||
|
||||
def _ubl_get_invoice_line_price_unit(self, iline):
|
||||
"""Compute the base unit price without taxes"""
|
||||
price = iline.price_unit
|
||||
qty = 1.0
|
||||
if iline.tax_ids:
|
||||
tax_incl = any(t.price_include for t in iline.tax_ids)
|
||||
if tax_incl:
|
||||
# To prevent rounding issue, we must declare tax excluded price
|
||||
# for the total quantity
|
||||
qty = iline.quantity
|
||||
taxes = iline.tax_ids.compute_all(
|
||||
price,
|
||||
self.currency_id,
|
||||
qty,
|
||||
product=iline.product_id,
|
||||
partner=self.partner_id,
|
||||
)
|
||||
if taxes:
|
||||
price = taxes["total_excluded"]
|
||||
dpo = self.env["decimal.precision"]
|
||||
price_precision = dpo.precision_get("Product Price")
|
||||
return price, price_precision, qty
|
||||
|
||||
def _ubl_get_invoice_line_discount(self, iline, base_price, base_qty):
|
||||
# Formula: Net amount = Invoiced quantity * (Item net price/item price
|
||||
# base quantity) + Sum of invoice line charge amount - sum of invoice
|
||||
# line allowance amount
|
||||
discount = iline.quantity / base_qty * base_price - iline.price_subtotal
|
||||
dpo = self.env["decimal.precision"]
|
||||
price_precision = dpo.precision_get("Product Price")
|
||||
discount = float_round(discount, precision_digits=price_precision)
|
||||
return discount, price_precision
|
||||
|
||||
def _ubl_add_invoice_line_discount(
|
||||
self, xml_root, iline, base_price, base_qty, ns, version="2.1"
|
||||
):
|
||||
discount, prec = self._ubl_get_invoice_line_discount(
|
||||
iline, base_price, base_qty
|
||||
)
|
||||
if float_is_zero(discount, precision_digits=prec):
|
||||
return
|
||||
charge_node = etree.SubElement(xml_root, ns["cac"] + "AllowanceCharge")
|
||||
charge_indicator_node = etree.SubElement(
|
||||
charge_node, ns["cbc"] + "ChargeIndicator"
|
||||
)
|
||||
charge_indicator_node.text = "false"
|
||||
charge_reason_code_node = etree.SubElement(
|
||||
charge_node, ns["cbc"] + "AllowanceChargeReasonCode"
|
||||
)
|
||||
charge_reason_code_node.text = "95"
|
||||
charge_reason_node = etree.SubElement(
|
||||
charge_node, ns["cbc"] + "AllowanceChargeReason"
|
||||
)
|
||||
charge_reason_node.text = "Discount"
|
||||
charge_amount_node = etree.SubElement(
|
||||
charge_node, ns["cbc"] + "Amount", currencyID=self.currency_id.name
|
||||
)
|
||||
charge_amount_node.text = "%0.*f" % (prec, discount)
|
||||
|
||||
def _ubl_add_invoice_line(self, parent_node, iline, line_number, ns, version="2.1"):
|
||||
self.ensure_one()
|
||||
cur_name = self.currency_id.name
|
||||
if self.move_type == "out_invoice":
|
||||
line_root = etree.SubElement(parent_node, ns["cac"] + "InvoiceLine")
|
||||
elif self.move_type == "out_refund":
|
||||
line_root = etree.SubElement(parent_node, ns["cac"] + "CreditNoteLine")
|
||||
dpo = self.env["decimal.precision"]
|
||||
qty_precision = dpo.precision_get("Product Unit of Measure")
|
||||
account_precision = self.currency_id.decimal_places
|
||||
line_id = etree.SubElement(line_root, ns["cbc"] + "ID")
|
||||
line_id.text = str(line_number)
|
||||
uom_unece_code = False
|
||||
# product_uom_id is not a required field on account.move.line
|
||||
if self.move_type == "out_invoice":
|
||||
qty_element_name = "InvoicedQuantity"
|
||||
elif self.move_type == "out_refund":
|
||||
qty_element_name = "CreditedQuantity"
|
||||
if iline.product_uom_id.unece_code:
|
||||
uom_unece_code = iline.product_uom_id.unece_code
|
||||
quantity = etree.SubElement(
|
||||
line_root, ns["cbc"] + qty_element_name, unitCode=uom_unece_code
|
||||
)
|
||||
else:
|
||||
quantity = etree.SubElement(line_root, ns["cbc"] + qty_element_name)
|
||||
qty = iline.quantity
|
||||
quantity.text = "%0.*f" % (qty_precision, qty)
|
||||
base_price, price_precision, base_qty = self._ubl_get_invoice_line_price_unit(
|
||||
iline
|
||||
)
|
||||
line_amount = etree.SubElement(
|
||||
line_root, ns["cbc"] + "LineExtensionAmount", currencyID=cur_name
|
||||
)
|
||||
line_amount.text = "%0.*f" % (account_precision, iline.price_subtotal)
|
||||
self._ubl_add_invoice_line_discount(
|
||||
line_root, iline, base_price, base_qty, ns, version=version
|
||||
)
|
||||
self._ubl_add_item(
|
||||
iline.name,
|
||||
iline.product_id,
|
||||
line_root,
|
||||
ns,
|
||||
type_="sale",
|
||||
version=version,
|
||||
)
|
||||
price_node = etree.SubElement(line_root, ns["cac"] + "Price")
|
||||
price_amount = etree.SubElement(
|
||||
price_node, ns["cbc"] + "PriceAmount", currencyID=cur_name
|
||||
)
|
||||
price_amount.text = "%0.*f" % (price_precision, base_price)
|
||||
if uom_unece_code:
|
||||
base_qty_node = etree.SubElement(
|
||||
price_node, ns["cbc"] + "BaseQuantity", unitCode=uom_unece_code
|
||||
)
|
||||
else:
|
||||
base_qty_node = etree.SubElement(price_node, ns["cbc"] + "BaseQuantity")
|
||||
base_qty_node.text = "%0.*f" % (qty_precision, base_qty)
|
||||
|
||||
def _ubl_add_tax_total(self, xml_root, ns, version="2.1"):
|
||||
self.ensure_one()
|
||||
cur_name = self.currency_id.name
|
||||
prec = self.currency_id.decimal_places
|
||||
|
||||
tax_lines = {}
|
||||
for tline in self.line_ids:
|
||||
sign = 1 if tline.is_refund else -1
|
||||
if tline.tax_line_id:
|
||||
# There are as many tax line as there are repartition lines
|
||||
tax_lines.setdefault(
|
||||
tline.tax_line_id,
|
||||
{"base": 0.0, "amount": 0.0},
|
||||
)
|
||||
tax_lines[tline.tax_line_id]["base"] += tline.tax_base_amount
|
||||
tax_lines[tline.tax_line_id]["amount"] += sign * tline.balance
|
||||
elif tline.tax_ids:
|
||||
# In case there are no repartition lines
|
||||
for tax in tline.tax_ids:
|
||||
if not tline.is_refund and tax.invoice_repartition_line_ids:
|
||||
continue
|
||||
if tline.is_refund and tax.refund_repartition_line_ids:
|
||||
continue
|
||||
tax_lines.setdefault(
|
||||
tax,
|
||||
{"base": 0.0, "amount": 0.0},
|
||||
)
|
||||
tax_lines[tax]["base"] += sign * tline.balance
|
||||
|
||||
exempt = 0.0
|
||||
exempt_taxes = self.line_ids.tax_line_id.browse()
|
||||
for tax, amounts in tax_lines.items():
|
||||
if tax.unece_type_id.code != "VAT":
|
||||
if tax.include_base_amount:
|
||||
continue
|
||||
exempt += amounts["amount"]
|
||||
exempt_taxes |= tax
|
||||
# For non-VAT taxes, not subject to VAT, declare as AllowanceCharge
|
||||
charge_node = etree.SubElement(xml_root, ns["cac"] + "AllowanceCharge")
|
||||
charge_indicator_node = etree.SubElement(
|
||||
charge_node, ns["cbc"] + "ChargeIndicator"
|
||||
)
|
||||
charge_indicator_node.text = "true"
|
||||
charge_reason_code_node = etree.SubElement(
|
||||
charge_node, ns["cbc"] + "AllowanceChargeReasonCode"
|
||||
)
|
||||
charge_reason_code_node.text = "ABK"
|
||||
charge_reason_node = etree.SubElement(
|
||||
charge_node, ns["cbc"] + "AllowanceChargeReason"
|
||||
)
|
||||
charge_reason_node.text = "Miscellaneous"
|
||||
charge_amount_node = etree.SubElement(
|
||||
charge_node, ns["cbc"] + "Amount", currencyID=cur_name
|
||||
)
|
||||
charge_amount_node.text = "%0.*f" % (prec, amounts["amount"])
|
||||
self._ubl_add_tax_category(tax, charge_node, ns, version=version)
|
||||
|
||||
tax_total_node = etree.SubElement(xml_root, ns["cac"] + "TaxTotal")
|
||||
tax_amount_node = etree.SubElement(
|
||||
tax_total_node, ns["cbc"] + "TaxAmount", currencyID=cur_name
|
||||
)
|
||||
tax_amount_node.text = "%0.*f" % (prec, self._ubl_get_invoice_vat_amount())
|
||||
for tax, amounts in tax_lines.items():
|
||||
if tax.unece_type_id.code == "VAT":
|
||||
self._ubl_add_tax_subtotal(
|
||||
amounts["base"],
|
||||
amounts["amount"],
|
||||
tax,
|
||||
cur_name,
|
||||
tax_total_node,
|
||||
ns,
|
||||
version=version,
|
||||
)
|
||||
|
||||
if not float_is_zero(exempt, precision_digits=prec):
|
||||
self._ubl_add_tax_subtotal(
|
||||
exempt,
|
||||
0,
|
||||
exempt_taxes[0],
|
||||
cur_name,
|
||||
tax_total_node,
|
||||
ns,
|
||||
version=version,
|
||||
)
|
||||
if len(exempt_taxes) > 1:
|
||||
# xpath cac:TaxCategory/cbc:Name
|
||||
exempt_node = tax_total_node[-1]
|
||||
exempt_node = [
|
||||
e for e in list(exempt_node) if e.tag == ns["cac"] + "TaxCategory"
|
||||
][0]
|
||||
exempt_node = [
|
||||
e for e in list(exempt_node) if e.tag == ns["cbc"] + "Name"
|
||||
][0]
|
||||
exempt_node.text = " + ".join([e.name for e in exempt_taxes])
|
||||
|
||||
def generate_invoice_ubl_xml_etree(self, version="2.1"):
|
||||
self.ensure_one()
|
||||
if self.move_type == "out_invoice":
|
||||
nsmap, ns = self._ubl_get_nsmap_namespace("Invoice-2", version=version)
|
||||
xml_root = etree.Element("Invoice", nsmap=nsmap)
|
||||
elif self.move_type == "out_refund":
|
||||
nsmap, ns = self._ubl_get_nsmap_namespace("CreditNote-2", version=version)
|
||||
xml_root = etree.Element("CreditNote", nsmap=nsmap)
|
||||
self._ubl_add_header(xml_root, ns, version=version)
|
||||
if version == "2.1":
|
||||
self._ubl_add_buyer_reference(xml_root, ns, version=version)
|
||||
self._ubl_add_order_reference(xml_root, ns, version=version)
|
||||
self._ubl_add_contract_document_reference(xml_root, ns, version=version)
|
||||
self._ubl_add_attachments(xml_root, ns, version=version)
|
||||
self._ubl_add_supplier_party(
|
||||
False,
|
||||
self.company_id,
|
||||
"AccountingSupplierParty",
|
||||
xml_root,
|
||||
ns,
|
||||
version=version,
|
||||
)
|
||||
self._ubl_add_customer_party(
|
||||
self.partner_id,
|
||||
False,
|
||||
"AccountingCustomerParty",
|
||||
xml_root,
|
||||
ns,
|
||||
version=version,
|
||||
)
|
||||
# the field 'partner_shipping_id' is defined in the 'sale' module
|
||||
if hasattr(self, "partner_shipping_id") and self.partner_shipping_id:
|
||||
self._ubl_add_delivery(self.partner_shipping_id, xml_root, ns)
|
||||
if self.move_type == "out_invoice":
|
||||
# Put paymentmeans block even when invoice is paid ?
|
||||
payment_identifier = self.get_payment_identifier()
|
||||
self._ubl_add_payment_means(
|
||||
self.partner_bank_id,
|
||||
self.payment_mode_id,
|
||||
self.invoice_date_due,
|
||||
xml_root,
|
||||
ns,
|
||||
payment_identifier=payment_identifier,
|
||||
version=version,
|
||||
)
|
||||
if self.invoice_payment_term_id:
|
||||
self._ubl_add_payment_terms(
|
||||
self.invoice_payment_term_id, xml_root, ns, version=version
|
||||
)
|
||||
self._ubl_add_tax_total(xml_root, ns, version=version)
|
||||
self._ubl_add_legal_monetary_total(xml_root, ns, version=version)
|
||||
|
||||
line_number = 0
|
||||
invoice_lines = self.invoice_line_ids.filtered(
|
||||
lambda line: line.display_type not in ("line_note", "line_section")
|
||||
)
|
||||
for iline in invoice_lines:
|
||||
line_number += 1
|
||||
self._ubl_add_invoice_line(
|
||||
xml_root, iline, line_number, ns, version=version
|
||||
)
|
||||
return xml_root
|
||||
|
||||
def generate_ubl_xml_string(self, version="2.1"):
|
||||
self.ensure_one()
|
||||
assert self.state == "posted"
|
||||
assert self.move_type in ("out_invoice", "out_refund")
|
||||
logger.debug("Starting to generate UBL XML Invoice file")
|
||||
lang = self.get_ubl_lang()
|
||||
# The aim of injecting lang in context
|
||||
# is to have the content of the XML in the partner's lang
|
||||
# but the problem is that the error messages will also be in
|
||||
# that lang. But the error messages should almost never
|
||||
# happen except the first days of use, so it's probably
|
||||
# not worth the additional code to handle the 2 langs
|
||||
xml_root = self.with_context(lang=lang).generate_invoice_ubl_xml_etree(
|
||||
version=version
|
||||
)
|
||||
xml_string = etree.tostring(
|
||||
xml_root, pretty_print=True, encoding="UTF-8", xml_declaration=True
|
||||
)
|
||||
if self.move_type == "out_invoice":
|
||||
self._ubl_check_xml_schema(xml_string, "Invoice", version=version)
|
||||
elif self.move_type == "out_refund":
|
||||
self._ubl_check_xml_schema(xml_string, "CreditNote", version=version)
|
||||
logger.debug(
|
||||
"Invoice UBL XML file generated for account invoice ID %d " "(state %s)",
|
||||
self.id,
|
||||
self.state,
|
||||
)
|
||||
logger.debug(xml_string.decode("utf-8"))
|
||||
return xml_string
|
||||
|
||||
def get_ubl_filename(self, version="2.1"):
|
||||
"""This method is designed to be inherited"""
|
||||
if self.move_type == "out_invoice":
|
||||
return "UBL-Invoice-%s.xml" % version
|
||||
elif self.move_type == "out_refund":
|
||||
return "UBL-CreditNote-%s.xml" % version
|
||||
|
||||
def get_ubl_version(self):
|
||||
return self.env.context.get("ubl_version") or "2.1"
|
||||
|
||||
def get_ubl_lang(self):
|
||||
self.ensure_one()
|
||||
return self.partner_id.lang or "en_US"
|
||||
|
||||
def _embed_ubl_xml_in_pdf(self, pdf_stream):
|
||||
self.ensure_one()
|
||||
if self.is_ubl_sale_invoice_posted():
|
||||
version = self.get_ubl_version()
|
||||
xml_filename = self.get_ubl_filename(version=version)
|
||||
xml_string = self.generate_ubl_xml_string(version=version)
|
||||
pdf_content = pdf_stream["stream"].getvalue()
|
||||
new_content = self.env["pdf.helper"].pdf_embed_xml(
|
||||
pdf_content,
|
||||
xml_filename,
|
||||
xml_string,
|
||||
)
|
||||
# Replace the current content.
|
||||
pdf_stream["stream"].close()
|
||||
pdf_stream["stream"] = io.BytesIO(new_content)
|
||||
|
||||
def attach_ubl_xml_file_button(self):
|
||||
self.ensure_one()
|
||||
assert self.move_type in ("out_invoice", "out_refund")
|
||||
assert self.state == "posted"
|
||||
version = self.get_ubl_version()
|
||||
xml_string = self.generate_ubl_xml_string(version=version)
|
||||
filename = self.get_ubl_filename(version=version)
|
||||
attach = (
|
||||
self.env["ir.attachment"]
|
||||
.with_context(**{})
|
||||
.create(
|
||||
{
|
||||
"name": filename,
|
||||
"res_id": self.id,
|
||||
"res_model": self._name,
|
||||
"datas": base64.b64encode(xml_string),
|
||||
# If default_type = 'out_invoice' in context, 'type'
|
||||
# would take 'out_invoice' value by default !
|
||||
"type": "binary",
|
||||
}
|
||||
)
|
||||
)
|
||||
action = self.env["ir.attachment"].action_get()
|
||||
action.update({"res_id": attach.id, "views": False, "view_mode": "form,tree"})
|
||||
return action
|
||||
|
||||
def is_ubl_sale_invoice_posted(self):
|
||||
self.ensure_one()
|
||||
is_ubl = self.company_id.xml_format_in_pdf_invoice == "ubl"
|
||||
if is_ubl and self.is_sale_document() and self.state == "posted":
|
||||
return True
|
||||
return False
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
# Copyright 2016-2017 Akretion (http://www.akretion.com)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# Copyright 2019 Onestein (<https://www.onestein.eu>)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class IrActionsReport(models.Model):
|
||||
_inherit = "ir.actions.report"
|
||||
|
||||
def _render_qweb_pdf_prepare_streams(self, report_ref, data, res_ids=None):
|
||||
# It works, but:
|
||||
# - when you click on the "Print" button or use the "Print" menu,
|
||||
# the XML file is regenerated even when the invoice is read from the attachment.
|
||||
# - when you open the invoice from the attachment, you get the "original" XML
|
||||
# file
|
||||
collected_streams = super()._render_qweb_pdf_prepare_streams(
|
||||
report_ref, data, res_ids=res_ids
|
||||
)
|
||||
amo = self.env["account.move"]
|
||||
invoice_reports = amo._get_invoice_report_names()
|
||||
report_name = self._get_report(report_ref).report_name
|
||||
if (
|
||||
collected_streams
|
||||
and res_ids
|
||||
and len(res_ids) == 1
|
||||
and report_name in invoice_reports
|
||||
and not self.env.context.get("no_embedded_ubl_xml")
|
||||
):
|
||||
move = amo.browse(res_ids)
|
||||
if move._xml_format_in_pdf_invoice() == "ubl":
|
||||
pdf_stream = collected_streams[move.id]
|
||||
move._embed_ubl_xml_in_pdf(pdf_stream)
|
||||
return collected_streams
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
# Copyright 2016-2018 Akretion (http://www.akretion.com)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
_inherit = "res.company"
|
||||
|
||||
xml_format_in_pdf_invoice = fields.Selection(
|
||||
selection_add=[("ubl", "Universal Business Language (UBL)")], default="ubl"
|
||||
)
|
||||
embed_pdf_in_ubl_xml_invoice = fields.Boolean(
|
||||
string="Embed PDF in UBL XML Invoice",
|
||||
help="If active, the standalone UBL Invoice XML file will include the "
|
||||
"PDF of the invoice in base64 under the node "
|
||||
"'AdditionalDocumentReference'. For example, to be compliant with the "
|
||||
"e-fff standard used in Belgium, you should activate this option.",
|
||||
)
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
# Copyright 2017 Akretion (http://www.akretion.com)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResConfigSettings(models.TransientModel):
|
||||
_inherit = "res.config.settings"
|
||||
|
||||
embed_pdf_in_ubl_xml_invoice = fields.Boolean(
|
||||
related="company_id.embed_pdf_in_ubl_xml_invoice",
|
||||
readonly=False,
|
||||
)
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
In the menu *Invoicing > Configuration > Settings > Invoicing*, under
|
||||
*Electronic Invoices*, check the value of 2 options:
|
||||
|
||||
* *XML Format embedded in PDF invoice* : if you want to have an UBL XML file
|
||||
embedded inside the PDF invoice, set it to
|
||||
*Universal Business Language (UBL)*
|
||||
* if you work directly with XML invoices and you want to have the PDF invoice
|
||||
in base64 inside the XML file, enable the *Embed PDF in UBL XML Invoice*.
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
* Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
* Andrea Stirpe <a.stirpe@onestein.nl>
|
||||
* Foram Shah <foram.shah@initos.com>
|
||||
* Jacques-Etienne Baudoux (BCIM) <je@bcim.be>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
This module adds support for UBL, the `Universal Business Language (UBL)
|
||||
<http://ubl.xml.org/>`_ standard, on invoices. The UBL 2.1 standard became the
|
||||
`ISO/IEC 19845 <http://www.iso.org/iso/catalogue_detail.htm?csnumber=66370>`_
|
||||
standard in December 2015 (cf the `official announce
|
||||
<http://www.prweb.com/releases/2016/01/prweb13186919.htm>`_).
|
||||
|
||||
With this module, you can generate customer invoices/refunds:
|
||||
|
||||
* in PDF format with an embedded UBL XML file
|
||||
* as an XML file with an optional embedded PDF file
|
||||
|
||||
This module supports UBL version 2.1 (used by default) and 2.0.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
|
|
@ -0,0 +1,460 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
|
||||
<title>README.rst</title>
|
||||
<style type="text/css">
|
||||
|
||||
/*
|
||||
:Author: David Goodger (goodger@python.org)
|
||||
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
Despite the name, some widely supported CSS2 features are used.
|
||||
|
||||
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th {
|
||||
border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first {
|
||||
/* Override more specific margin styles with "! important". */
|
||||
margin-top: 0 ! important }
|
||||
|
||||
.last, .with-subtitle {
|
||||
margin-bottom: 0 ! important }
|
||||
|
||||
.hidden {
|
||||
display: none }
|
||||
|
||||
.subscript {
|
||||
vertical-align: sub;
|
||||
font-size: smaller }
|
||||
|
||||
.superscript {
|
||||
vertical-align: super;
|
||||
font-size: smaller }
|
||||
|
||||
a.toc-backref {
|
||||
text-decoration: none ;
|
||||
color: black }
|
||||
|
||||
blockquote.epigraph {
|
||||
margin: 2em 5em ; }
|
||||
|
||||
dl.docutils dd {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Uncomment (and remove this text!) to get bold-faced definition list terms
|
||||
dl.docutils dt {
|
||||
font-weight: bold }
|
||||
*/
|
||||
|
||||
div.abstract {
|
||||
margin: 2em 5em }
|
||||
|
||||
div.abstract p.topic-title {
|
||||
font-weight: bold ;
|
||||
text-align: center }
|
||||
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ;
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title {
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title, .code .error {
|
||||
color: red ;
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
div.dedication {
|
||||
margin: 2em 5em ;
|
||||
text-align: center ;
|
||||
font-style: italic }
|
||||
|
||||
div.dedication p.topic-title {
|
||||
font-weight: bold ;
|
||||
font-style: normal }
|
||||
|
||||
div.figure {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
div.footer, div.header {
|
||||
clear: both;
|
||||
font-size: smaller }
|
||||
|
||||
div.line-block {
|
||||
display: block ;
|
||||
margin-top: 1em ;
|
||||
margin-bottom: 1em }
|
||||
|
||||
div.line-block div.line-block {
|
||||
margin-top: 0 ;
|
||||
margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
|
||||
div.sidebar {
|
||||
margin: 0 0 0.5em 1em ;
|
||||
border: medium outset ;
|
||||
padding: 1em ;
|
||||
background-color: #ffffee ;
|
||||
width: 40% ;
|
||||
float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric {
|
||||
font-family: sans-serif ;
|
||||
font-size: medium }
|
||||
|
||||
div.system-messages {
|
||||
margin: 5em }
|
||||
|
||||
div.system-messages h1 {
|
||||
color: red }
|
||||
|
||||
div.system-message {
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.system-message p.system-message-title {
|
||||
color: red ;
|
||||
font-weight: bold }
|
||||
|
||||
div.topic {
|
||||
margin: 2em }
|
||||
|
||||
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
|
||||
h1.title {
|
||||
text-align: center }
|
||||
|
||||
h2.subtitle {
|
||||
text-align: center }
|
||||
|
||||
hr.docutils {
|
||||
width: 75% }
|
||||
|
||||
img.align-left, .figure.align-left, object.align-left, table.align-left {
|
||||
clear: left ;
|
||||
float: left ;
|
||||
margin-right: 1em }
|
||||
|
||||
img.align-right, .figure.align-right, object.align-right, table.align-right {
|
||||
clear: right ;
|
||||
float: right ;
|
||||
margin-left: 1em }
|
||||
|
||||
img.align-center, .figure.align-center, object.align-center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
table.align-center {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.align-left {
|
||||
text-align: left }
|
||||
|
||||
.align-center {
|
||||
clear: both ;
|
||||
text-align: center }
|
||||
|
||||
.align-right {
|
||||
text-align: right }
|
||||
|
||||
/* reset inner alignment in figures */
|
||||
div.align-right {
|
||||
text-align: inherit }
|
||||
|
||||
/* div.align-center * { */
|
||||
/* text-align: left } */
|
||||
|
||||
.align-top {
|
||||
vertical-align: top }
|
||||
|
||||
.align-middle {
|
||||
vertical-align: middle }
|
||||
|
||||
.align-bottom {
|
||||
vertical-align: bottom }
|
||||
|
||||
ol.simple, ul.simple {
|
||||
margin-bottom: 1em }
|
||||
|
||||
ol.arabic {
|
||||
list-style: decimal }
|
||||
|
||||
ol.loweralpha {
|
||||
list-style: lower-alpha }
|
||||
|
||||
ol.upperalpha {
|
||||
list-style: upper-alpha }
|
||||
|
||||
ol.lowerroman {
|
||||
list-style: lower-roman }
|
||||
|
||||
ol.upperroman {
|
||||
list-style: upper-roman }
|
||||
|
||||
p.attribution {
|
||||
text-align: right ;
|
||||
margin-left: 50% }
|
||||
|
||||
p.caption {
|
||||
font-style: italic }
|
||||
|
||||
p.credits {
|
||||
font-style: italic ;
|
||||
font-size: smaller }
|
||||
|
||||
p.label {
|
||||
white-space: nowrap }
|
||||
|
||||
p.rubric {
|
||||
font-weight: bold ;
|
||||
font-size: larger ;
|
||||
color: maroon ;
|
||||
text-align: center }
|
||||
|
||||
p.sidebar-title {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold ;
|
||||
font-size: larger }
|
||||
|
||||
p.sidebar-subtitle {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
p.topic-title {
|
||||
font-weight: bold }
|
||||
|
||||
pre.address {
|
||||
margin-bottom: 0 ;
|
||||
margin-top: 0 ;
|
||||
font: inherit }
|
||||
|
||||
pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
pre.code .ln { color: gray; } /* line numbers */
|
||||
pre.code, code { background-color: #eeeeee }
|
||||
pre.code .comment, code .comment { color: #5C6576 }
|
||||
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
||||
pre.code .literal.string, code .literal.string { color: #0C5404 }
|
||||
pre.code .name.builtin, code .name.builtin { color: #352B84 }
|
||||
pre.code .deleted, code .deleted { background-color: #DEB0A1}
|
||||
pre.code .inserted, code .inserted { background-color: #A3D289}
|
||||
|
||||
span.classifier {
|
||||
font-family: sans-serif ;
|
||||
font-style: oblique }
|
||||
|
||||
span.classifier-delimiter {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
span.interpreted {
|
||||
font-family: sans-serif }
|
||||
|
||||
span.option {
|
||||
white-space: nowrap }
|
||||
|
||||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic, pre.problematic {
|
||||
color: red }
|
||||
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation {
|
||||
border-left: solid 1px gray;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docinfo {
|
||||
margin: 2em 4em }
|
||||
|
||||
table.docutils {
|
||||
margin-top: 0.5em ;
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
table.footnote {
|
||||
border-left: solid 1px black;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {
|
||||
padding-left: 0.5em ;
|
||||
padding-right: 0.5em ;
|
||||
vertical-align: top }
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold ;
|
||||
text-align: left ;
|
||||
white-space: nowrap ;
|
||||
padding-left: 0 }
|
||||
|
||||
/* "booktabs" style (no vertical lines) */
|
||||
table.docutils.booktabs {
|
||||
border: 0px;
|
||||
border-top: 2px solid;
|
||||
border-bottom: 2px solid;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.docutils.booktabs * {
|
||||
border: 0px;
|
||||
}
|
||||
table.docutils.booktabs th {
|
||||
border-bottom: thin solid;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
||||
font-size: 100% }
|
||||
|
||||
ul.auto-toc {
|
||||
list-style-type: none }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document">
|
||||
|
||||
|
||||
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
|
||||
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
|
||||
</a>
|
||||
<div class="section" id="account-invoice-ubl">
|
||||
<h1>Account Invoice UBL</h1>
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:9f1b0e852851f3ea85dba1780820cf44cc6e13acda198d7323763c4c115fbcc4
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/edi/tree/16.0/account_invoice_ubl"><img alt="OCA/edi" src="https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/edi-16-0/edi-16-0-account_invoice_ubl"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/edi&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module adds support for UBL, the <a class="reference external" href="http://ubl.xml.org/">Universal Business Language (UBL)</a> standard, on invoices. The UBL 2.1 standard became the
|
||||
<a class="reference external" href="http://www.iso.org/iso/catalogue_detail.htm?csnumber=66370">ISO/IEC 19845</a>
|
||||
standard in December 2015 (cf the <a class="reference external" href="http://www.prweb.com/releases/2016/01/prweb13186919.htm">official announce</a>).</p>
|
||||
<p>With this module, you can generate customer invoices/refunds:</p>
|
||||
<ul class="simple">
|
||||
<li>in PDF format with an embedded UBL XML file</li>
|
||||
<li>as an XML file with an optional embedded PDF file</li>
|
||||
</ul>
|
||||
<p>This module supports UBL version 2.1 (used by default) and 2.0.</p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a></li>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="configuration">
|
||||
<h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
|
||||
<p>In the menu <em>Invoicing > Configuration > Settings > Invoicing</em>, under
|
||||
<em>Electronic Invoices</em>, check the value of 2 options:</p>
|
||||
<ul class="simple">
|
||||
<li><dl class="first docutils">
|
||||
<dt><em>XML Format embedded in PDF invoice</em> <span class="classifier-delimiter">:</span> <span class="classifier">if you want to have an UBL XML file</span></dt>
|
||||
<dd>embedded inside the PDF invoice, set it to
|
||||
<em>Universal Business Language (UBL)</em></dd>
|
||||
</dl>
|
||||
</li>
|
||||
<li>if you work directly with XML invoices and you want to have the PDF invoice
|
||||
in base64 inside the XML file, enable the <em>Embed PDF in UBL XML Invoice</em>.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
<h2><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h2>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/edi/issues">GitHub Issues</a>.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||
<a class="reference external" href="https://github.com/OCA/edi/issues/new?body=module:%20account_invoice_ubl%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
<h2><a class="toc-backref" href="#toc-entry-3">Credits</a></h2>
|
||||
<div class="section" id="authors">
|
||||
<h3><a class="toc-backref" href="#toc-entry-4">Authors</a></h3>
|
||||
<ul class="simple">
|
||||
<li>Akretion</li>
|
||||
<li>Onestein</li>
|
||||
<li>BCIM</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="contributors">
|
||||
<h3><a class="toc-backref" href="#toc-entry-5">Contributors</a></h3>
|
||||
<ul class="simple">
|
||||
<li>Alexis de Lattre <<a class="reference external" href="mailto:alexis.delattre@akretion.com">alexis.delattre@akretion.com</a>></li>
|
||||
<li>Andrea Stirpe <<a class="reference external" href="mailto:a.stirpe@onestein.nl">a.stirpe@onestein.nl</a>></li>
|
||||
<li>Foram Shah <<a class="reference external" href="mailto:foram.shah@initos.com">foram.shah@initos.com</a>></li>
|
||||
<li>Jacques-Etienne Baudoux (BCIM) <<a class="reference external" href="mailto:je@bcim.be">je@bcim.be</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h3><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h3>
|
||||
<p>This module is maintained by the OCA.</p>
|
||||
<a class="reference external image-reference" href="https://odoo-community.org">
|
||||
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
|
||||
</a>
|
||||
<p>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.</p>
|
||||
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
|
||||
<p><a class="reference external image-reference" href="https://github.com/jbaudoux"><img alt="jbaudoux" src="https://github.com/jbaudoux.png?size=40px" /></a></p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/edi/tree/16.0/account_invoice_ubl">OCA/edi</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import test_ubl_generate
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
# Copyright 2016-2017 Akretion (http://www.akretion.com)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# Copyright 2019 Onestein (<https://www.onestein.eu>)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
class TestUblInvoiceMixin:
|
||||
def _create_invoice(
|
||||
self, product=False, qty=1, price=12.42, discount=0, validate=True
|
||||
):
|
||||
aio = self.env["account.move"]
|
||||
ato = self.env["account.tax"]
|
||||
company = self.env.ref("base.main_company")
|
||||
taxes = ato.search(
|
||||
[
|
||||
("company_id", "=", company.id),
|
||||
("type_tax_use", "=", "sale"),
|
||||
("unece_type_id", "!=", False),
|
||||
("unece_categ_id", "!=", False),
|
||||
("amount_type", "=", "percent"),
|
||||
]
|
||||
)
|
||||
if taxes:
|
||||
tax = taxes[0]
|
||||
else:
|
||||
unece_type_id = self.env.ref("account_tax_unece.tax_type_vat").id
|
||||
unece_categ_id = self.env.ref("account_tax_unece.tax_categ_s").id
|
||||
tax = ato.create(
|
||||
{
|
||||
"name": "German VAT purchase 18.0%",
|
||||
"description": "DE-VAT-sale-18.0",
|
||||
"company_id": company.id,
|
||||
"type_tax_use": "sale",
|
||||
"price_include": False,
|
||||
"amount": 18,
|
||||
"amount_type": "percent",
|
||||
"unece_type_id": unece_type_id,
|
||||
"unece_categ_id": unece_categ_id,
|
||||
}
|
||||
)
|
||||
# validate invoice
|
||||
if not product:
|
||||
product = self.env.ref("product.product_product_4")
|
||||
invoice = aio.create(
|
||||
{
|
||||
"partner_id": self.env.ref("base.res_partner_2").id,
|
||||
"currency_id": self.env.ref("base.EUR").id,
|
||||
"move_type": "out_invoice",
|
||||
"company_id": company.id,
|
||||
"name": "SO1242",
|
||||
"invoice_line_ids": [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"product_id": product.id,
|
||||
"product_uom_id": product.uom_id.id,
|
||||
"quantity": qty,
|
||||
"price_unit": price,
|
||||
"discount": discount,
|
||||
"name": product.name,
|
||||
"tax_ids": [(6, 0, [tax.id])],
|
||||
},
|
||||
)
|
||||
],
|
||||
}
|
||||
)
|
||||
if validate:
|
||||
invoice.action_post()
|
||||
return invoice
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
# Copyright 2016-2017 Akretion (http://www.akretion.com)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# Copyright 2019 Onestein (<https://www.onestein.eu>)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo.tests.common import HttpCase, tagged
|
||||
from odoo.tools import mute_logger
|
||||
|
||||
from ..hooks import (
|
||||
remove_ubl_xml_format_in_pdf_invoice,
|
||||
set_xml_format_in_pdf_invoice_to_ubl,
|
||||
)
|
||||
from .common import TestUblInvoiceMixin
|
||||
|
||||
MUTE_LOGGER = "odoo.addons.account_invoice_ubl.models.account_move"
|
||||
|
||||
# Use http case to make PDF rendering work
|
||||
|
||||
|
||||
@tagged("-at_install", "post_install")
|
||||
class TestUblInvoice(HttpCase, TestUblInvoiceMixin):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
|
||||
|
||||
# Reduce log noise on CI while rendering GET assets
|
||||
@mute_logger("werkzeug")
|
||||
def test_ubl_generate(self):
|
||||
invoice = self._create_invoice()
|
||||
if invoice.company_id.xml_format_in_pdf_invoice != "ubl":
|
||||
invoice.company_id.xml_format_in_pdf_invoice = "ubl"
|
||||
for version in ["2.0", "2.1"]:
|
||||
pdf_file = (
|
||||
self.env["ir.actions.report"]
|
||||
.with_context(ubl_version=version, force_report_rendering=True)
|
||||
._render_qweb_pdf("account.report_invoice_with_payments", invoice.ids)[
|
||||
0
|
||||
]
|
||||
)
|
||||
res = self.env["pdf.helper"].pdf_get_xml_files(pdf_file)
|
||||
invoice_filename = invoice.get_ubl_filename(version=version)
|
||||
self.assertTrue(invoice_filename in res)
|
||||
|
||||
@mute_logger("werkzeug")
|
||||
def test_attach_ubl_xml_file_button(self):
|
||||
invoice = self._create_invoice()
|
||||
if invoice.company_id.xml_format_in_pdf_invoice != "ubl":
|
||||
invoice.company_id.xml_format_in_pdf_invoice = "ubl"
|
||||
self.assertFalse(invoice.company_id.embed_pdf_in_ubl_xml_invoice)
|
||||
with mute_logger(MUTE_LOGGER):
|
||||
action = invoice.attach_ubl_xml_file_button()
|
||||
self.assertEqual(action["res_model"], "ir.attachment")
|
||||
self.assertEqual(action["view_mode"], "form,tree")
|
||||
self.assertFalse(action["views"])
|
||||
invoice.company_id.embed_pdf_in_ubl_xml_invoice = True
|
||||
with mute_logger(MUTE_LOGGER):
|
||||
action = invoice.attach_ubl_xml_file_button()
|
||||
self.assertEqual(action["res_model"], "ir.attachment")
|
||||
self.assertEqual(action["view_mode"], "form,tree")
|
||||
self.assertFalse(action["views"])
|
||||
|
||||
def test_install_uninstall_hooks(self):
|
||||
set_xml_format_in_pdf_invoice_to_ubl(self.env.cr, None)
|
||||
self.assertTrue(
|
||||
self.env["res.company"].search([("xml_format_in_pdf_invoice", "=", "ubl")])
|
||||
)
|
||||
remove_ubl_xml_format_in_pdf_invoice(self.env.cr, None)
|
||||
self.assertFalse(
|
||||
self.env["res.company"].search([("xml_format_in_pdf_invoice", "=", "ubl")])
|
||||
)
|
||||
set_xml_format_in_pdf_invoice_to_ubl(self.env.cr, None)
|
||||
self.assertTrue(
|
||||
self.env["res.company"].search([("xml_format_in_pdf_invoice", "=", "ubl")])
|
||||
)
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright 2016-2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
<odoo>
|
||||
<record id="view_move_form" model="ir.ui.view">
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_move_form" />
|
||||
<field name="arch" type="xml">
|
||||
<button name="button_draft" position="before">
|
||||
<button
|
||||
type="object"
|
||||
name="attach_ubl_xml_file_button"
|
||||
attrs="{'invisible': ['|', ('move_type', 'not in', ['out_invoice', 'out_refund']), ('state', '!=', 'posted')]}"
|
||||
string="Generate UBL XML File"
|
||||
/>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
<odoo>
|
||||
<record id="view_account_config_settings" model="ir.ui.view">
|
||||
<field name="model">res.config.settings</field>
|
||||
<field
|
||||
name="inherit_id"
|
||||
ref="account_einvoice_generate.view_account_config_settings"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@id='e-invoices']" position="inside">
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="embed_pdf_in_ubl_xml_invoice" />
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="embed_pdf_in_ubl_xml_invoice" />
|
||||
<div class="text-muted">
|
||||
Include the PDF of the invoice in the standalone UBL Invoice XML file.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
# Architecture
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
U[Users] -->|HTTP| V[Views and QWeb Templates]
|
||||
V --> C[Controllers]
|
||||
V --> W[Wizards – Transient Models]
|
||||
C --> M[Models and ORM]
|
||||
W --> M
|
||||
M --> R[Reports]
|
||||
DX[Data XML] --> M
|
||||
S[Security – ACLs and Groups] -. enforces .-> M
|
||||
|
||||
subgraph Account_invoice_ubl Module - account_invoice_ubl
|
||||
direction LR
|
||||
M:::layer
|
||||
W:::layer
|
||||
C:::layer
|
||||
V:::layer
|
||||
R:::layer
|
||||
S:::layer
|
||||
DX:::layer
|
||||
end
|
||||
|
||||
classDef layer fill:#eef8ff,stroke:#6ea8fe,stroke-width:1px
|
||||
```
|
||||
|
||||
Notes
|
||||
- Views include tree/form/kanban templates and report templates.
|
||||
- Controllers provide website/portal routes when present.
|
||||
- Wizards are UI flows implemented with `models.TransientModel`.
|
||||
- Data XML loads data/demo records; Security defines groups and access.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# Configuration
|
||||
|
||||
Refer to Odoo settings for account_invoice_ubl. Configure related models, access rights, and options as needed.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# Controllers
|
||||
|
||||
This module does not define custom HTTP controllers.
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# Dependencies
|
||||
|
||||
This addon depends on:
|
||||
|
||||
- [account_einvoice_generate](../../odoo-bringout-oca-edi-framework-account_einvoice_generate)
|
||||
- account_payment_partner
|
||||
- [base_ubl_payment](../../odoo-bringout-oca-edi-base_ubl_payment)
|
||||
- account_tax_unece
|
||||
- [pdf_helper](../../odoo-bringout-oca-edi-framework-pdf_helper)
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
# FAQ
|
||||
|
||||
- Q: Which Odoo version? A: 16.0 (OCA/OCB packaged).
|
||||
- Q: How to enable? A: Start server with --addon account_invoice_ubl or install in UI.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# Install
|
||||
|
||||
```bash
|
||||
pip install odoo-bringout-oca-edi-framework-account_invoice_ubl"
|
||||
# or
|
||||
uv pip install odoo-bringout-oca-edi-framework-account_invoice_ubl"
|
||||
```
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
# Models
|
||||
|
||||
Detected core models and extensions in account_invoice_ubl.
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class account_move
|
||||
class ir_actions_report
|
||||
class res_company
|
||||
class res_config_settings
|
||||
```
|
||||
|
||||
Notes
|
||||
- Classes show model technical names; fields omitted for brevity.
|
||||
- Items listed under _inherit are extensions of existing models.
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
# Overview
|
||||
|
||||
Packaged Odoo addon: account_invoice_ubl. Provides features documented in upstream Odoo 16 under this addon.
|
||||
|
||||
- Source: OCA/OCB 16.0, addon account_invoice_ubl
|
||||
- License: LGPL-3
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# Reports
|
||||
|
||||
This module does not define custom reports.
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# Security
|
||||
|
||||
This module does not define custom security rules or access controls beyond Odoo defaults.
|
||||
|
||||
Default Odoo security applies:
|
||||
- Base user access through standard groups
|
||||
- Model access inherited from dependencies
|
||||
- No custom row-level security rules
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# Troubleshooting
|
||||
|
||||
- Ensure Python and Odoo environment matches repo guidance.
|
||||
- Check database connectivity and logs if startup fails.
|
||||
- Validate that dependent addons listed in DEPENDENCIES.md are installed.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# Usage
|
||||
|
||||
Start Odoo including this addon (from repo root):
|
||||
|
||||
```bash
|
||||
python3 scripts/nix_odoo_web_server.py --db-name mydb --addon account_invoice_ubl
|
||||
```
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# Wizards
|
||||
|
||||
This module does not include UI wizards.
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
[project]
|
||||
name = "odoo-bringout-oca-edi-framework-account_invoice_ubl"
|
||||
version = "16.0.0"
|
||||
description = "Account Invoice UBL - Generate UBL XML file for customer invoices/refunds"
|
||||
authors = [
|
||||
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
|
||||
]
|
||||
dependencies = [
|
||||
"odoo-bringout-oca-edi-framework-account_einvoice_generate>=16.0.0",
|
||||
"odoo-bringout-oca-edi-framework-account_payment_partner>=16.0.0",
|
||||
"odoo-bringout-oca-edi-framework-base_ubl_payment>=16.0.0",
|
||||
"odoo-bringout-oca-edi-framework-account_tax_unece>=16.0.0",
|
||||
"odoo-bringout-oca-edi-framework-pdf_helper>=16.0.0",
|
||||
"requests>=2.25.1"
|
||||
]
|
||||
readme = "README.md"
|
||||
requires-python = ">= 3.11"
|
||||
classifiers = [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Topic :: Office/Business",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
homepage = "https://github.com/bringout/0"
|
||||
repository = "https://github.com/bringout/0"
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.metadata]
|
||||
allow-direct-references = true
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["account_invoice_ubl"]
|
||||
|
||||
[tool.rye]
|
||||
managed = true
|
||||
dev-dependencies = [
|
||||
"pytest>=8.4.1",
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue