Skip to content

[18.0][ADD] edi_purchase_diapar_oca#7

Open
P-H-Phuc wants to merge 16 commits into18.0from
18.0-mig-edi_purchase_diapar
Open

[18.0][ADD] edi_purchase_diapar_oca#7
P-H-Phuc wants to merge 16 commits into18.0from
18.0-mig-edi_purchase_diapar

Conversation

@P-H-Phuc
Copy link
Owner

@P-H-Phuc P-H-Phuc commented Dec 17, 2025

This module was initially part of the Foodcoop set of addons. We're now migrating it to 18.0 and taking this occasion to contribute it to OCA.

@P-H-Phuc P-H-Phuc changed the title [18.0][MIG] edi_purchase_diapar: Migration to 18.0 [18.0][ADD] edi_purchase_diapar Dec 17, 2025
Copy link

@nguyenminhchien nguyenminhchien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@P-H-Phuc P-H-Phuc force-pushed the 18.0-mig-edi_purchase_diapar branch from bbb4a17 to b48a236 Compare February 9, 2026 11:41
@P-H-Phuc P-H-Phuc changed the title [18.0][ADD] edi_purchase_diapar [18.0][ADD] edi_purchase_diapar_oca Feb 10, 2026
@P-H-Phuc
Copy link
Owner Author

P-H-Phuc commented Feb 10, 2026

CONFIGURATION

I. FS Storage

Go to Settings > Technical > FS Storage

  • Name: Diapar FTP Storage
  • Code: diapar_ftp
  • Protocol: ftp (FTPFileSystem)
  • Options: {"host": "127.0.0.1", "username": "admin", "password": "admin", "port": 5000}

II .EDI Backend Type

Go to EDI > Config > Backend types

  • Name: DIAPAR
  • Code: diapar
  • Name: Diapar

III. EDI Backend

Go to EDI > Config > Backends

  • Name: Diapar
  • EDI Backend type: DIAPAR
  • FS Storage: Diapar FTP Storage
  • Input pending directory: IN/PENDING
  • Input done directory: IN/DONE
  • Input error directory: IN/ERROR
  • Output pending directory: OUT/PENDING
  • Output done directory: OUT/DONE
  • Output error directory: OUT/ERROR

IV. EDI Exchange Template Output

Go to EDI > Config > EDI Exchange Template Output

  • Name: Diapar Output Exchange Template
  • EDI Backend type: Diapar
  • Backend: Diapar
  • Code: diapar.output.exchange.template
  • Output Type: text
  • Generator: Qweb Template
  • Qweb Template: create new template
  • Business params: Vrp Code, Customer Code, Constant File Start / End,...

V. EDI Exchange Type

Go to EDI > Config > Exchange types
1. OUTPUT: PO

  • Name / Code: diapar_out_order
  • Backend / Backend type?: Diapar
  • Direction: Output
  • Enabled for partners: Select partners...
  • Filename pattern: edi.config.system.po_text_file_pattern
  • File ext: C99
  • Encoding: iso-8859-1

2. INPUT: BLE (Despatch Advice)

  • Name / Code: diapar_in_despatch_advice
  • Backend / Backend type: Diapar
  • Direction: Input
  • partner_ids: Select partners...
  • Filename pattern: BLE*
  • File ext: txt
  • Encoding: iso-8859-1
  • Advanced Settings:
components:
    process:
        usage: input.process.diapar.purchase.price
        env_ctx:
            msg_type: 'Purchase Price'
  • INPUT: Purchase Price (CH)
    • Name/Code: diapar_in_purchase_price
    • Backend: Diapar
    • Direction: Input
    • partner_ids: from edi.config.system.supplier_id
    • Filename pattern: CH*
    • File ext: txt
    • Encoding: iso-8859-1
    • Advanced Settings:
components:
    process:
        usage: input.process.diapar.purchase.price
        env_ctx:
            msg_type: 'Purchase Price'

VI. EDI Configuration

Go to EDI > Config > Configurations

  • Name: Diapar Purchase Order
  • Backend: Diapar
  • Exchange Type: diapar_out_order
  • Trigger: On record write
  • Model: Purchase Order
  • EDI Config Do:
if record.state == 'purchase':
  record._edi_send_via_edi(conf.type_id)

VII. Vendor

Open Vendor form > EDI > Purchase > Select EDI Configure Diapar Purchase Order

@P-H-Phuc P-H-Phuc force-pushed the 18.0-mig-edi_purchase_diapar branch from b48a236 to aa112f3 Compare February 10, 2026 04:48
Copy link

@nguyenminhchien nguyenminhchien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I cannot test the module
  • When creating new product supplierinfo, i faced this error:
Image
  • When creating new PO without supplierinfo, i faced this error:
Image
  • Add unit tests please.
  • Create demo data following your guideline
Image


@api.constrains("product_code")
def _check_product_code(self):
if self.product_code:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only apply this constraint to edi supplier



class SupplierInfo(models.Model):
_inherit = "product.supplierinfo"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Admin user faced this error:

Image

@P-H-Phuc P-H-Phuc force-pushed the 18.0-mig-edi_purchase_diapar branch 2 times, most recently from 5337f81 to c8f2c77 Compare March 3, 2026 11:04
@P-H-Phuc P-H-Phuc force-pushed the 18.0-mig-edi_purchase_diapar branch from c8f2c77 to 946b534 Compare March 6, 2026 07:35
@P-H-Phuc P-H-Phuc force-pushed the 18.0-mig-edi_purchase_diapar branch from 946b534 to 1cf740b Compare March 6, 2026 07:50
@P-H-Phuc P-H-Phuc force-pushed the 18.0-mig-edi_purchase_diapar branch from f32a10b to 31bba96 Compare March 6, 2026 07:54
@P-H-Phuc P-H-Phuc requested a review from nguyenminhchien March 6, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants