Skip to content

Commit

Permalink
[ADD] test_base_import_pdf_simple: New module
Browse files Browse the repository at this point in the history
TT48213
  • Loading branch information
victoralmau committed May 30, 2024
1 parent d115a92 commit c5da511
Show file tree
Hide file tree
Showing 15 changed files with 940 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/test_base_import_pdf_simple/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
87 changes: 87 additions & 0 deletions test_base_import_pdf_simple/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
===========================
Test Base Import Pdf Simple
===========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:d1fd050f741ace1e34d8aa94bc309bc8c6e1522ce0a3f872a1cc382a71418dd6
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/licence-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/15.0/test_base_import_pdf_simple
:alt: OCA/edi
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/edi-15-0/edi-15-0-test_base_import_pdf_simple
: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=15.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Test suite for base_import_pdf_simple. Normally you don't need to install this.

**Table of contents**

.. contents::
:local:

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:%20test_base_import_pdf_simple%0Aversion:%2015.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
~~~~~~~

* Tecnativa

Contributors
~~~~~~~~~~~~

* `Tecnativa <https://www.tecnativa.com>`_:

* Víctor Martínez
* Pedro M. Baeza

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-victoralmau| image:: https://github.com/victoralmau.png?size=40px
:target: https://github.com/victoralmau
:alt: victoralmau

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-victoralmau|

This module is part of the `OCA/edi <https://github.com/OCA/edi/tree/15.0/test_base_import_pdf_simple>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions test_base_import_pdf_simple/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .hooks import post_init_hook
16 changes: 16 additions & 0 deletions test_base_import_pdf_simple/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Test Base Import Pdf Simple",
"version": "15.0.1.0.0",
"website": "https://github.com/OCA/edi",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": ["purchase", "base_import_pdf_simple"],
"installable": True,
"demo": [
"demo/base_import_pdf_template.xml",
],
"maintainers": ["victoralmau"],
"post_init_hook": "post_init_hook",
}
252 changes: 252 additions & 0 deletions test_base_import_pdf_simple/demo/base_import_pdf_template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="partner_decathlon" model="res.partner">
<field name="name">Decathlon</field>
</record>
<record id="generic_product" model="product.product">
<field name="name">Test Generic Product</field>
<field name="default_code">GENERIC</field>
</record>
<!-- Product Data !-->
<record id="supplierinfo_decathlon_4449130" model="product.supplierinfo">
<field name="name" ref="partner_decathlon" />
<field name="product_code">4449130</field>
</record>
<record model="product.product">
<field name="name">Test Mochila</field>
<field name="default_code">MOCHILA</field>
<field name="purchase_ok" eval="True" />
<field
name="seller_ids"
eval="[(6, 0, [ref('supplierinfo_decathlon_4449130')])]"
/>
</record>
<record id="supplierinfo_decathlon_5284409" model="product.supplierinfo">
<field name="name" ref="partner_decathlon" />
<field name="product_code">5284409</field>
</record>
<record id="product_aislante" model="product.product">
<field name="name">Test Aislante</field>
<field name="default_code">AISLANTE</field>
<field name="purchase_ok" eval="True" />
<field
name="seller_ids"
eval="[(6, 0, [ref('supplierinfo_decathlon_5284409')])]"
/>
</record>
<record id="supplierinfo_decathlon_4225123" model="product.supplierinfo">
<field name="name" ref="partner_decathlon" />
<field name="product_code">4225123</field>
</record>
<record id="product_hamaca" model="product.product">
<field name="name">Test Hamaca</field>
<field name="default_code">HAMACA</field>
<field name="purchase_ok" eval="True" />
<field
name="seller_ids"
eval="[(6, 0, [ref('supplierinfo_decathlon_4225123')])]"
/>
</record>
<record id="supplierinfo_decathlon_4006580" model="product.supplierinfo">
<field name="name" ref="partner_decathlon" />
<field name="product_code">4006580</field>
</record>
<record id="product_botiquin" model="product.product">
<field name="name">Test Botiquin</field>
<field name="default_code">BOTIQUIN</field>
<field name="purchase_ok" eval="True" />
<field
name="seller_ids"
eval="[(6, 0, [ref('supplierinfo_decathlon_4006580')])]"
/>
</record>
<!-- Purchase order Template Data !-->
<record id="po_decathlon" model="base.import.pdf.template">
<field name="name">Purchase Orders Decathlon</field>
<field name="model_id" ref="purchase.model_purchase_order" />
<field name="child_field_id" ref="purchase.field_purchase_order__order_line" />
<!-- <field name="auto_detect_pattern">(?<=ESA79935607)[\S\s]*</field> -->
<field name="header_items">Referencia,Cantidad,Precio</field>
</record>
<record id="po_decathlon_line_partner_id" model="base.import.pdf.template.line">
<field name="template_id" ref="po_decathlon" />
<field name="related_model">header</field>
<field name="field_id" ref="purchase.field_purchase_order__partner_id" />
<field name="value_type">fixed</field>
<field name="fixed_value" ref="partner_decathlon" />
</record>
<record id="po_decathlon_line_partner_ref" model="base.import.pdf.template.line">
<field name="template_id" ref="po_decathlon" />
<field name="related_model">header</field>
<field name="field_id" ref="purchase.field_purchase_order__partner_ref" />
<field name="pattern">ES[0-9]{10}</field>
<field name="value_type">variable</field>
</record>
<record id="po_decathlon_line_product_id" model="base.import.pdf.template.line">
<field name="template_id" ref="po_decathlon" />
<field name="related_model">lines</field>
<field name="field_id" ref="purchase.field_purchase_order_line__product_id" />
<field name="column">0</field>
<field name="pattern">([0-9]{7}) [0-7]{1}</field>
<field name="value_type">variable</field>
<field name="search_field_id" ref="product.field_product_product__seller_ids" />
<field
name="search_subfield_id"
ref="product.field_product_supplierinfo__product_code"
/>
<!-- <field name="default_value">product.product,cls.env.ref('test_base_import_pdf_simple.generic_product').id</field> -->
</record>
<record id="po_decathlon_line_product_qty" model="base.import.pdf.template.line">
<field name="template_id" ref="po_decathlon" />
<field name="related_model">lines</field>
<field name="field_id" ref="purchase.field_purchase_order_line__product_qty" />
<field name="column">1</field>
<field name="pattern">[0-9]{7} ([0-7]{1})</field>
<field name="value_type">variable</field>
</record>
<record id="po_decathlon_line_price_unit" model="base.import.pdf.template.line">
<field name="template_id" ref="po_decathlon" />
<field name="related_model">lines</field>
<field name="field_id" ref="purchase.field_purchase_order_line__price_unit" />
<field name="column">2</field>
<field name="pattern">[0-9]{7} [0-9]{1} ([0-9]{2}.[0-9]{2})</field>
<field name="value_type">variable</field>
<field name="log_distinct_value" eval="True" />
</record>
<!-- Account invoice Template Data !-->
<record id="partner_tecnativa" model="res.partner">
<field name="name">Tecnativa</field>
</record>
<record id="supplierinfo_tecnativa_CONS_0001" model="product.supplierinfo">
<field name="name" ref="partner_tecnativa" />
<field name="product_code">CONS_0001</field>
</record>
<record model="product.product">
<field name="name">Test Rotulador</field>
<field name="default_code">ROTULADOR</field>
<field name="purchase_ok" eval="True" />
<field
name="seller_ids"
eval="[(6, 0, [ref('supplierinfo_tecnativa_CONS_0001')])]"
/>
</record>
<record id="supplierinfo_tecnativa_CONS_0002" model="product.supplierinfo">
<field name="name" ref="partner_tecnativa" />
<field name="product_code">CONS_0002</field>
</record>
<record model="product.product">
<field name="name">Test Boligrafo</field>
<field name="default_code">BOLIGRAFO</field>
<field name="purchase_ok" eval="True" />
<field
name="seller_ids"
eval="[(6, 0, [ref('supplierinfo_tecnativa_CONS_0002')])]"
/>
</record>
<record id="supplierinfo_tecnativa_FURN_0003" model="product.supplierinfo">
<field name="name" ref="partner_tecnativa" />
<field name="product_code">FURN_0003</field>
</record>
<record model="product.product">
<field name="name">Test Leds</field>
<field name="default_code">LEDS</field>
<field name="purchase_ok" eval="True" />
<field
name="seller_ids"
eval="[(6, 0, [ref('supplierinfo_tecnativa_FURN_0003')])]"
/>
</record>
<record id="supplierinfo_tecnativa_E_COM10" model="product.supplierinfo">
<field name="name" ref="partner_tecnativa" />
<field name="product_code">E-COM10</field>
</record>
<record model="product.product">
<field name="name">Test Plastificadora</field>
<field name="default_code">PLASTIFICADORA</field>
<field name="purchase_ok" eval="True" />
<field
name="seller_ids"
eval="[(6, 0, [ref('supplierinfo_tecnativa_E_COM10')])]"
/>
</record>
<record id="supplierinfo_tecnativa_FURN_8621" model="product.supplierinfo">
<field name="name" ref="partner_tecnativa" />
<field name="product_code">FURN_8621</field>
</record>
<record model="product.product">
<field name="name">Test Lmaninas</field>
<field name="default_code">LAMINAS</field>
<field name="purchase_ok" eval="True" />
<field
name="seller_ids"
eval="[(6, 0, [ref('supplierinfo_tecnativa_FURN_8621')])]"
/>
</record>
<record id="supplierinfo_tecnativa_FURN_7023" model="product.supplierinfo">
<field name="name" ref="partner_tecnativa" />
<field name="product_code">FURN_7023</field>
</record>
<record model="product.product">
<field name="name">Test Trituradora</field>
<field name="default_code">TRITURADORA</field>
<field name="purchase_ok" eval="True" />
<field
name="seller_ids"
eval="[(6, 0, [ref('supplierinfo_tecnativa_FURN_7023')])]"
/>
</record>
<record id="invoice_tecnativa" model="base.import.pdf.template">
<field name="name">Invoices Tecnativa</field>
<field name="model_id" ref="account.model_account_move" />
<field
name="child_field_id"
ref="account.field_account_move__invoice_line_ids"
/>
<!-- <field name="auto_detect_pattern">(?<=B 8 7 5 3 0 4 3 2)[\S\s]*</field> -->
<field name="header_items">Producto,Cantidad,Precio</field>
</record>
<record
id="invoice_tecnativa_line_partner_id"
model="base.import.pdf.template.line"
>
<field name="template_id" ref="invoice_tecnativa" />
<field name="related_model">header</field>
<field name="field_id" ref="account.field_account_move__partner_id" />
<field name="value_type">fixed</field>
<field name="fixed_value" ref="partner_tecnativa" />
</record>
<record
id="invoice_tecnativa_line_product_id"
model="base.import.pdf.template.line"
>
<field name="template_id" ref="invoice_tecnativa" />
<field name="related_model">lines</field>
<field name="field_id" ref="account.field_account_move_line__product_id" />
<field name="column">0</field>
<field name="pattern">\[([A-Z\d]+[_|-][A-Z\d]+)\]</field>
<field name="value_type">variable</field>
<field name="search_field_id" ref="product.field_product_product__seller_ids" />
<field
name="search_subfield_id"
ref="product.field_product_supplierinfo__product_code"
/>
<!-- <field name="default_value">product.product,cls.env.ref('test_base_import_pdf_simple.generic_product').id</field> -->
</record>
<record id="invoice_tecnativa_line_quantity" model="base.import.pdf.template.line">
<field name="template_id" ref="invoice_tecnativa" />
<field name="related_model">lines</field>
<field name="field_id" ref="account.field_account_move_line__quantity" />
<field name="column">1</field>
<field name="pattern">(^\d{1,3}\n)[0-9]{1,2}</field>
<field name="value_type">variable</field>
</record>
<record id="invoice_tecnativa_price_unit" model="base.import.pdf.template.line">
<field name="template_id" ref="invoice_tecnativa" />
<field name="related_model">lines</field>
<field name="field_id" ref="account.field_account_move_line__price_unit" />
<field name="column">2</field>
<field name="pattern">(^\d{1,3}\.(?!00)\d{2}\n)</field>
<field name="value_type">variable</field>
<field name="log_distinct_value" eval="True" />
</record>
</odoo>
Loading

0 comments on commit c5da511

Please sign in to comment.