Metadata-Version: 2.1
Name: odoo-addon-l10n_th_bank_payment_export
Version: 15.0.4.1.2
Summary: Base export payment text file to bank
Home-page: https://github.com/OCA/l10n-thailand
Author: Ecosoft, Odoo Community Association (OCA)
Author-email: support@odoo-community.org
License: AGPL-3
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 15.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Classifier: Development Status :: 3 - Alpha
Requires-Python: >=3.8
Requires-Dist: odoo-addon-partner-bank-code<15.1dev,>=15.0dev
Requires-Dist: odoo-addon-report-xlsx-helper<15.1dev,>=15.0dev
Requires-Dist: odoo<15.1dev,>=15.0a

.. image:: https://odoo-community.org/readme-banner-image
   :target: https://odoo-community.org/get-involved?utm_source=readme
   :alt: Odoo Community Association

============================================
Thai Localization - Base Bank Payment Export
============================================

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

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
    :target: https://odoo-community.org/page/development-status
    :alt: Alpha
.. |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%2Fl10n--thailand-lightgray.png?logo=github
    :target: https://github.com/OCA/l10n-thailand/tree/15.0/l10n_th_bank_payment_export
    :alt: OCA/l10n-thailand
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
    :target: https://translation.odoo-community.org/projects/l10n-thailand-15-0/l10n-thailand-15-0-l10n_th_bank_payment_export
    :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/l10n-thailand&target_branch=15.0
    :alt: Try me on Runboat

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

The ``l10n_th_bank_payment_export`` module provides a **base wizard model** to support exporting payment files in **text format**, which is commonly required by Thai banks.

This module itself does **not generate a payment file directly**, but serves as a foundation that other modules can extend to support bank-specific formats (e.g. KTB, BBL, SCB, etc.)

**Key Features:**

- Supports exporting payments to a bank-specific text format.
- Includes a flexible **template system** to define default values.
- Export structure can be configured dynamically using conditions and expressions.

.. note::
   This module requires further development to be functional with a specific bank. See module ``l10n_th_bank_payment_export_ktb`` as a reference implementation.

.. IMPORTANT::
   This is an alpha version, the data model and design can change at any time without warning.
   Only for development or testing purpose, do not use in production.
   `More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
   :local:

Configuration
=============

Bank Payment Template
======================

Used to **group default values** for easier user selection and error reduction during data entry.

Steps:

#. Go to *Invoicing > Configuration > Payments > Bank Payment Templates*
#. Create a new template and:

   - Select the **bank**.
   - In the template lines, define **field names** and **default values**.
#. When a user selects this template during payment export, the system will **auto-fill** the corresponding values.

.. note::
   Values must be valid (existing in the system). Invalid or incorrect entries will result in an error.

Bank Export Format
===================

Defines the structure of the output **text file** according to the specific bank's requirements.

Menu: *Settings > Technical > Bank Export Format*

Format Fields:

- **Description**: Explanation of the line.
- **Condition Line**: Logic to determine whether this line should be included.
- **Group**: Used to group lines for looping purposes.
- **Loop**: Repeats the line for each ``bank.payment.export.line``.
- **Sub Loop**: Nested loop (e.g. all invoices related to a payment line).
- **Sub Value Loop**: Field needed to drive the sub loop.
- **End Line**: Adds ``/r/t`` at the end of the line (if checked).
- **Length**: Max length of the value (required for Fixed values).
- **From/To**: Character position range (start-end).
- **Alignment**: Align value to **left** or **right**.
- **Blank Space**: Filler if the value doesn’t reach the defined length.
- **Value Type**: ``Fixed`` for hardcoded value, ``Python`` for dynamic value.
- **Value**:

  - If ``Fixed``: static value to be printed.
  - If ``Python``: expression evaluated dynamically.

Python Dynamic Fields:

- ``rec``: The export document (``bank.payment.export``)
- ``line``:

  - If **no Loop**, refers to ``rec.export_line_ids``
  - If **Loop**, refers to the current line
- ``sub_line``: Object in the **Sub Loop**
- ``today``: Current date
- ``today_datetime``: Current date and time
- ``idx``: Index of the current line
- ``idx_line``: Index within the loop
- ``idx_sub_line``: Index within the sub loop
- ``wht_cert``: Withholding tax certificate (requires ``l10n_th_account_tax``)
- ``invoices``: Invoices related to the payment

Usage
=====

There are **two ways** to use this module:

1. From a Payment
==================

#. Go to *Invoicing > Vendors > Payments*
#. Select a payment
#. Click *Action > Create Bank Payment Export*

2. Directly Create Export
==========================

#. Go to *Invoicing > Accounting > Bank Payment Export*
#. Click *Create*
#. Select the payment(s), or click *Get All Payments*
#. Click *Confirm*

You can now **Export** the file:

- *Export Text File*: Generates a ``.txt`` file, status changes to ``Done``.
- *Export Excel*: Previews data in ``.xlsx`` format.

Additional Notes:

- Rejected lines can be re-generated using the *Reject* action.
- *Cancel* stops export before sending to the bank.
- Enable *Show Full Accounting Features* to access the menu.
- Only *Account Managers* can confirm and export files.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-thailand/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/l10n-thailand/issues/new?body=module:%20l10n_th_bank_payment_export%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
~~~~~~~

* Ecosoft

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

* `Ecosoft <http://ecosoft.co.th>`__:

  * Saran Lim. <saranl@ecosoft.co.th>

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

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

|maintainer-Saran440| 

This module is part of the `OCA/l10n-thailand <https://github.com/OCA/l10n-thailand/tree/15.0/l10n_th_bank_payment_export>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
