Skip to content

Commit

Permalink
Merge PR #1595 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by yvaucher
  • Loading branch information
OCA-git-bot committed Sep 30, 2024
2 parents 83f96e5 + 95dc4eb commit e94d186
Show file tree
Hide file tree
Showing 18 changed files with 789 additions and 0 deletions.
87 changes: 87 additions & 0 deletions account_move_substate/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
======================
Account Move Sub State
======================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Faccount--invoicing-lightgray.png?logo=github
:target: https://github.com/OCA/account-invoicing/tree/14.0/account_move_substate
:alt: OCA/account-invoicing
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-invoicing-14-0/account-invoicing-14-0-account_move_substate
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/95/14.0
:alt: Try me on Runbot

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

This module allows to add a substate to journal entry.
For each journal entry state you can define a substate.
We this module you can define substate which allow you to extend accounting workflow.

**Table of contents**

.. contents::
:local:

Usage
=====

#. Go to ** Settings > Technical > Database Structure ** and Add "Base substate".
If necessery you can add "target State values" (ex define a substate for "cancel"
state).
Substate sequence is very important.
#. Create a journal entry and check if the substate are displayed on the header of
form view. Check if you can't set substate defined for journal entry if state is a draft.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-invoicing/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_move_substate%0Aversion:%2014.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>`__:

* Pimolnat Suntian <[email protected]>

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/account-invoicing <https://github.com/OCA/account-invoicing/tree/14.0/account_move_substate>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions account_move_substate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
20 changes: 20 additions & 0 deletions account_move_substate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2021 Ecosoft (<http://ecosoft.co.th>)
# Copyright 2023 360ERP (<https://360ERP.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Account Move Sub State",
"version": "15.0.1.0.0",
"category": "Accounting & Finance",
"author": "360ERP, Ecosoft, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-invoicing",
"license": "AGPL-3",
"depends": ["account", "base_substate"],
"data": [
"data/account_move_substate_mail_template_data.xml",
"data/account_move_substate_data.xml",
"views/account_move_views.xml",
],
"demo": ["demo/account_move_substate_demo.xml"],
"installable": True,
}
19 changes: 19 additions & 0 deletions account_move_substate/data/account_move_substate_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="base_substate_type_account_move" model="base.substate.type">
<field name="name">Account Move Substate</field>
<field name="model">account.move</field>
<field name="target_state_field">state</field>
</record>
<!-- Journal entry related substate to journal entry state (draft, posted) -->
<record id="target_state_value_draft" model="target.state.value">
<field name="name">Draft</field>
<field name="base_substate_type_id" ref="base_substate_type_account_move" />
<field name="target_state_value">draft</field>
</record>
<record id="target_state_value_posted" model="target.state.value">
<field name="name">Posted</field>
<field name="base_substate_type_id" ref="base_substate_type_account_move" />
<field name="target_state_value">posted</field>
</record>
</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<!-- Sample account move substate -related template -->
<record
id="mail_template_data_account_move_substate_verified"
model="mail.template"
>
<field name="name">Verified</field>
<field name="model_id" ref="account.model_account_move" />
<field name="subject">Your journal entry {{object.name}} is verified</field>
<field name="use_default_to" eval="True" />
<field name="body_html" type="html">
<div>
Dear <t t-out="object.user_id.name or 'accounting user'" />,<br />
This email is to inform that your journal entry <t
t-out="object.name or ''"
/> was verified by accounting manager.
<br /><br />
Best Regards,
<t t-if="user.signature">
<br />
<t t-out="user.signature or ''" />
</t>
</div>
</field>
<field name="lang">{{ object.partner_id.lang }}</field>
<field name="auto_delete" eval="True" />
</record>
</odoo>
23 changes: 23 additions & 0 deletions account_move_substate/demo/account_move_substate_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<!-- Account Move Substate -->
<record id="base_substate_to_verify_account_move" model="base.substate">
<field name="name">To Verify</field>
<field name="sequence">1</field>
<field name="target_state_value_id" ref="target_state_value_draft" />
</record>
<record id="base_substate_checked_account_move" model="base.substate">
<field name="name">Checked</field>
<field name="sequence">2</field>
<field name="target_state_value_id" ref="target_state_value_draft" />
</record>
<record id="base_substate_verified_account_move" model="base.substate">
<field name="name">Verified</field>
<field name="sequence">3</field>
<field name="target_state_value_id" ref="target_state_value_posted" />
<field
name="mail_template_id"
ref="account_move_substate.mail_template_data_account_move_substate_verified"
/>
</record>
</odoo>
3 changes: 3 additions & 0 deletions account_move_substate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import account_move
36 changes: 36 additions & 0 deletions account_move_substate/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2021 Ecosoft (<http://ecosoft.co.th>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class BaseSubstateType(models.Model):
_inherit = "base.substate.type"

model = fields.Selection(
selection_add=[("account.move", "Account Move")],
ondelete={"account.move": "cascade"},
)


class AccountMove(models.Model):
_inherit = ["account.move", "base.substate.mixin"]
_name = "account.move"
_state_field = "state"

def _track_template(self, changes):
res = super(AccountMove, self)._track_template(changes)
track = self[0]
if "substate_id" in changes and track.substate_id.mail_template_id:
res["substate_id"] = (
track.substate_id.mail_template_id,
{
"composition_mode": "comment",
"auto_delete_message": True,
"subtype_id": self.env["ir.model.data"]._xmlid_to_res_id(
"mail.mt_note"
),
"email_layout_xmlid": "mail.mail_notification_light",
},
)
return res
7 changes: 7 additions & 0 deletions account_move_substate/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
* `Ecosoft <http://ecosoft.co.th>`__:

* Pimolnat Suntian <[email protected]>

* `360ERP <https://360ERP.com>`__:

* Bosd <bosd>
3 changes: 3 additions & 0 deletions account_move_substate/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module allows you to add a substate to a journal entry.
For each journal entry state you can define a substate.
With this module, you can define substates which allow you to extend the accounting workflow.
6 changes: 6 additions & 0 deletions account_move_substate/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#. Go to ** Settings > Technical > Substate Configuration > Base Substate ** and add a "Base substate".
If necessary you can add "target State values" (ex define a substate for "cancel"
state).
Substate sequence is very important.
#. Create a journal entry and check if the substate are displayed on the header of
form view. Check if you can't set substate defined for journal entry if state is a draft.
Binary file added account_move_substate/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e94d186

Please sign in to comment.