Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions edi_purchase_oca/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
============
EDI Purchase
============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:8ab40ab13f4a26ea0ba04ff19e53af88e490d1b2e783699454ae6255422e00c3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi--framework-lightgray.png?logo=github
:target: https://github.com/OCA/edi-framework/tree/18.0/edi_purchase_oca
:alt: OCA/edi-framework
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/edi-framework-18-0/edi-framework-18-0-edi_purchase_oca
: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-framework&target_branch=18.0
:alt: Try me on Runboat

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

This module intends to create a base to be extended by local edi rules
for purchase.

In order to add a new integration, you need to create a listener:

.. code:: python

class MyEventListener(Component):
_name = "purchase.order.event.listener.demo"
_inherit = "base.event.listener"
_apply_on = ["purchase.order"]

def on_button_confirm_purchase_order(self, move):
"""Add your code here"""

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/edi-framework/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-framework/issues/new?body=module:%20edi_purchase_oca%0Aversion:%2018.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
-------

* ForgeFlow
* Camptocamp

Contributors
------------

- Lois Rilo lois.rilo@forgeflow.com
- Simone Orsi simone.orsi@camptocamp.com

- Phan Hong Phuc <phucph@trobz.com>

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.

This module is part of the `OCA/edi-framework <https://github.com/OCA/edi-framework/tree/18.0/edi_purchase_oca>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions edi_purchase_oca/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import components
24 changes: 24 additions & 0 deletions edi_purchase_oca/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2022 ForgeFlow S.L. (https://www.forgeflow.com)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
"name": "EDI Purchase",
"summary": """
Define EDI Configuration for Purchase Orders""",
"version": "18.0.1.0.0",
"license": "LGPL-3",
"author": "ForgeFlow, Camptocamp, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/edi-framework",
"depends": ["purchase", "edi_oca", "component_event"],
"data": [
"views/purchase_order_views.xml",
"views/edi_exchange_record_views.xml",
"views/res_partner_view.xml",
"data/edi_configuration.xml",
],
"demo": [
"demo/edi_backend.xml",
"demo/edi_exchange_type.xml",
"demo/edi_configuration.xml",
],
}
1 change: 1 addition & 0 deletions edi_purchase_oca/components/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import listeners
27 changes: 27 additions & 0 deletions edi_purchase_oca/components/listeners.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2024 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.addons.component.core import Component


class EDIConfigPOListener(Component):
_name = "edi.listener.config.purchase.order"
_inherit = "base.event.listener"
_apply_on = ["purchase.order"]

def on_record_create(self, record, fields=None):
trigger = "on_record_create"
return self._exec_conf(record, trigger)

def on_record_write(self, record, fields=None):
trigger = "on_record_write"
return self._exec_conf(record, trigger)

def on_edi_purchase_order_state_change(self, record, state=None):
trigger = "on_edi_purchase_order_state_change"
return self._exec_conf(record, trigger)

def _exec_conf(self, record, trigger, conf_field="edi_purchase_conf_ids"):
confs = record.partner_id[conf_field].edi_get_conf(trigger)
for conf in confs:
conf.edi_exec_snippet_do(record)
13 changes: 13 additions & 0 deletions edi_purchase_oca/data/edi_configuration.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Generic state change -->
<record
id="edi_conf_trigger_purchase_order_state_change"
model="edi.configuration.trigger"
>
<field name="name">On PO state change</field>
<field name="code">on_edi_purchase_order_state_change</field>
<field name="description">Trigger when a purchase order state changes</field>
<field name="model_id" ref="purchase.model_purchase_order" />
</record>
</odoo>
11 changes: 11 additions & 0 deletions edi_purchase_oca/demo/edi_backend.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="demo_edi_backend_type_purchase" model="edi.backend.type">
<field name="name">Purchase DEMO</field>
<field name="code">purchase_demo</field>
</record>
<record id="demo_edi_backend" model="edi.backend">
<field name="name">purchase DEMO</field>
<field name="backend_type_id" ref="demo_edi_backend_type_purchase" />
</record>
</odoo>
23 changes: 23 additions & 0 deletions edi_purchase_oca/demo/edi_configuration.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="demo_edi_configuration_confirmed" model="edi.configuration">
<field name="name">Demo PO send</field>
<field
name="description"
>Show case how you can send out an order automatically</field>
<field name="type_id" ref="demo_edi_exc_type_order_out" />
<field name="backend_id" ref="demo_edi_backend" />
<field name="model_id" ref="purchase.model_purchase_order" />
<field name="trigger_id" ref="edi_conf_trigger_purchase_order_state_change" />
<field name="snippet_do">
# ('draft', 'RFQ'),
# ('sent', 'RFQ Sent'),
# ('to approve', 'To Approve'),
# ('purchase', 'Purchase Order'),
# ('done', 'Locked'),
# ('cancel', 'Cancelled')
if record.state == 'purchase':
record._edi_send_via_edi(conf.type_id)
</field>
</record>
</odoo>
12 changes: 12 additions & 0 deletions edi_purchase_oca/demo/edi_exchange_type.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="demo_edi_exc_type_order_out" model="edi.exchange.type">
<field name="backend_type_id" ref="demo_edi_backend_type_purchase" />
<field name="backend_id" ref="demo_edi_backend" />
<field name="name">Demo Purchase Order out</field>
<field name="code">demo_PurchaseOrder_out</field>
<field name="direction">output</field>
<field name="exchange_filename_pattern">{record_name}-{type.code}-{dt}</field>
<field name="exchange_file_ext">xml</field>
</record>
</odoo>
122 changes: 122 additions & 0 deletions edi_purchase_oca/i18n/edi_purchase_oca.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * edi_purchase_oca
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-12-31 04:47+0000\n"
"PO-Revision-Date: 2025-12-31 04:47+0000\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: edi_purchase_oca
#: model_terms:ir.ui.view,arch_db:edi_purchase_oca.purchase_order_form
msgid "<span class=\"o_stat_text\">EDI</span>"
msgstr ""

#. module: edi_purchase_oca
#: model:ir.model,name:edi_purchase_oca.model_res_partner
msgid "Contact"
msgstr ""

#. module: edi_purchase_oca
#: model_terms:ir.ui.view,arch_db:edi_purchase_oca.purchase_order_form
msgid "Disable"
msgstr ""

#. module: edi_purchase_oca
#: model:ir.model.fields,field_description:edi_purchase_oca.field_purchase_order__edi_disable_auto
msgid "Disable auto"
msgstr ""

#. module: edi_purchase_oca
#: model_terms:ir.ui.view,arch_db:edi_purchase_oca.purchase_order_form
msgid "EDI"
msgstr ""

#. module: edi_purchase_oca
#: model:ir.model.fields,field_description:edi_purchase_oca.field_purchase_order__origin_exchange_type_id
msgid "EDI origin exchange type"
msgstr ""

#. module: edi_purchase_oca
#: model:ir.model.fields,field_description:edi_purchase_oca.field_purchase_order__origin_exchange_record_id
msgid "EDI origin record"
msgstr ""

#. module: edi_purchase_oca
#: model:ir.model.fields,field_description:edi_purchase_oca.field_res_partner__edi_purchase_conf_ids
#: model:ir.model.fields,field_description:edi_purchase_oca.field_res_users__edi_purchase_conf_ids
msgid "EDI purchase configuration"
msgstr ""

#. module: edi_purchase_oca
#: model:ir.model.fields,help:edi_purchase_oca.field_purchase_order__origin_exchange_record_id
msgid "EDI record that originated this document."
msgstr ""

#. module: edi_purchase_oca
#: model:ir.model.fields,field_description:edi_purchase_oca.field_purchase_order__edi_config
msgid "Edi Config"
msgstr ""

#. module: edi_purchase_oca
#: model:ir.model.fields,field_description:edi_purchase_oca.field_purchase_order__edi_has_form_config
msgid "Edi Has Form Config"
msgstr ""

#. module: edi_purchase_oca
#: model_terms:ir.ui.view,arch_db:edi_purchase_oca.purchase_order_form
msgid "Electronic Data Interchange"
msgstr ""

#. module: edi_purchase_oca
#: model:ir.model.fields,field_description:edi_purchase_oca.field_purchase_order__exchange_record_ids
msgid "Exchange Record"
msgstr ""

#. module: edi_purchase_oca
#: model:ir.model.fields,field_description:edi_purchase_oca.field_purchase_order__exchange_record_count
msgid "Exchange Record Count"
msgstr ""

#. module: edi_purchase_oca
#: model:ir.model.fields,field_description:edi_purchase_oca.field_purchase_order__exchange_related_record_ids
msgid "Exchange Related Record"
msgstr ""

#. module: edi_purchase_oca
#: model:ir.ui.menu,name:edi_purchase_oca.menu_purchase_edi_root
msgid "Exchange records"
msgstr ""

#. module: edi_purchase_oca
#: model_terms:ir.ui.view,arch_db:edi_purchase_oca.view_partner_form
msgid "Purchase"
msgstr ""

#. module: edi_purchase_oca
#: model:ir.model,name:edi_purchase_oca.model_purchase_order
msgid "Purchase Order"
msgstr ""

#. module: edi_purchase_oca
#: model:ir.actions.act_window,name:edi_purchase_oca.act_open_edi_exchange_record_purchase_order_view
msgid "Purchase Order Exchange Record"
msgstr ""

#. module: edi_purchase_oca
#: model:ir.ui.menu,name:edi_purchase_oca.menu_purchase_edi_exchange_record
msgid "Purchase Orders"
msgstr ""

#. module: edi_purchase_oca
#: model:ir.model.fields,help:edi_purchase_oca.field_purchase_order__edi_disable_auto
msgid "When marked, EDI automatic processing will be avoided"
msgstr ""
Loading