-
-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[15.0][MIG] hr_expense_substate #143
base: 15.0
Are you sure you want to change the base?
Changes from 9 commits
b2e08a7
dc6a1c1
77b02ea
dbd84e8
650305d
4a8d031
50a7858
d6b8f19
fc6ee33
af892c4
5843e5f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
======================== | ||
Expense Report Sub State | ||
======================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:3a6399e3cc32fd585364d03e868abca9577218a017d7ccaf63675086dec82a30 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
||
.. |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%2Fhr--expense-lightgray.png?logo=github | ||
:target: https://github.com/OCA/hr-expense/tree/15.0/hr_expense_substate | ||
:alt: OCA/hr-expense | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/hr-expense-15-0/hr-expense-15-0-hr_expense_substate | ||
: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/hr-expense&target_branch=15.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows to add a substate to an expense report. | ||
For each expense report state you can define a substate. | ||
We this module you can define substate which allow you to extend expense report workflow. | ||
For example, you can add substate "To Verify" if | ||
the order can not be approved without document checked and verified | ||
|
||
**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 expense report and check if the substate are displayed on the header of | ||
form view. Check if you can't set substate defined for expense report if sate is a To be approved. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/hr-expense/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/hr-expense/issues/new?body=module:%20hr_expense_substate%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 | ||
~~~~~~~~~~~~ | ||
|
||
* Pimolnat Suntian <pimolnats@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. | ||
|
||
This module is part of the `OCA/hr-expense <https://github.com/OCA/hr-expense/tree/15.0/hr_expense_substate>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2021 Ecosoft (<http://ecosoft.co.th>) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Expense Report Sub State", | ||
"version": "15.0.1.0.0", | ||
"category": "Human Resources", | ||
"author": "Ecosoft,Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/hr-expense", | ||
"license": "AGPL-3", | ||
"depends": ["base_substate", "hr_expense"], | ||
"data": [ | ||
"views/hr_expense_views.xml", | ||
"data/hr_expense_substate_mail_template_data.xml", | ||
"data/hr_expense_substate_data.xml", | ||
], | ||
"demo": ["demo/hr_expense_substate_demo.xml"], | ||
"installable": True, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="base_substate_type_hr_expense_sheet" model="base.substate.type"> | ||
<field name="name">Expense Report Substate</field> | ||
<field name="model">hr.expense.sheet</field> | ||
<field name="target_state_field">state</field> | ||
</record> | ||
<!-- Expense Report related substate to state (draft, approved) --> | ||
<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_hr_expense_sheet" /> | ||
<field name="target_state_value">draft</field> | ||
</record> | ||
<record id="target_state_value_submit" model="target.state.value"> | ||
<field name="name">Submitted</field> | ||
<field name="base_substate_type_id" ref="base_substate_type_hr_expense_sheet" /> | ||
<field name="target_state_value">submit</field> | ||
</record> | ||
<record id="target_state_value_approve" model="target.state.value"> | ||
<field name="name">Approved</field> | ||
<field name="base_substate_type_id" ref="base_substate_type_hr_expense_sheet" /> | ||
<field name="target_state_value">approve</field> | ||
</record> | ||
<record id="target_state_value_post" model="target.state.value"> | ||
<field name="name">Posted</field> | ||
<field name="base_substate_type_id" ref="base_substate_type_hr_expense_sheet" /> | ||
<field name="target_state_value">post</field> | ||
</record> | ||
<record id="target_state_value_done" model="target.state.value"> | ||
<field name="name">Paid</field> | ||
<field name="base_substate_type_id" ref="base_substate_type_hr_expense_sheet" /> | ||
<field name="target_state_value">done</field> | ||
</record> | ||
<record id="target_state_value_cancel" model="target.state.value"> | ||
<field name="name">Refused</field> | ||
<field name="base_substate_type_id" ref="base_substate_type_hr_expense_sheet" /> | ||
<field name="target_state_value">cancel</field> | ||
</record> | ||
</odoo> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo noupdate="1"> | ||
<record id="mail_template_data_hr_expense_substate_verified" model="mail.template"> | ||
<field name="name">Verified</field> | ||
<field name="model_id" ref="hr_expense.model_hr_expense_sheet" /> | ||
<field name="subject">Your expense report {{ object.name }} is verified</field> | ||
<field name="use_default_to" eval="True" /> | ||
<field name="body_html" type="html"> | ||
<div> | ||
Dear <t t-out="object.employee_id.name or 'Requester'" />,<br /> | ||
This email is to inform that your expense report <t | ||
t-out="object.name" | ||
/> was verified by approver team. | ||
<br /><br /> | ||
Thank you, | ||
<br /> | ||
</div> | ||
</field> | ||
<field name="auto_delete" eval="True" /> | ||
</record> | ||
</odoo> |
Saran440 marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo noupdate="1"> | ||
<!-- to_approve --> | ||
<record id="base_substate_to_verify" model="base.substate"> | ||
<field name="name">To Verify</field> | ||
<field name="sequence">1</field> | ||
<field name="target_state_value_id" ref="target_state_value_submit" /> | ||
</record> | ||
<record id="base_substate_checked" model="base.substate"> | ||
<field name="name">Checked</field> | ||
<field name="sequence">2</field> | ||
<field name="target_state_value_id" ref="target_state_value_submit" /> | ||
</record> | ||
<record id="base_substate_verified" model="base.substate"> | ||
<field name="name">Verified</field> | ||
<field name="sequence">3</field> | ||
<field name="target_state_value_id" ref="target_state_value_submit" /> | ||
<field | ||
name="mail_template_id" | ||
ref="hr_expense_substate.mail_template_data_hr_expense_substate_verified" | ||
/> | ||
</record> | ||
</odoo> |
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: | ||
# * hr_expense_substate | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \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: hr_expense_substate | ||
#: model:mail.template,body_html:hr_expense_substate.mail_template_data_hr_expense_substate_verified | ||
msgid "" | ||
"<div>\n" | ||
" Dear ${object.employee_id.name or 'requester'},<br/>\n" | ||
" This email is to inform that your expense report ${object.name} was verified by approver team.\n" | ||
" <br/><br/>\n" | ||
" Thank you,\n" | ||
" <br/>\n" | ||
"</div>\n" | ||
" " | ||
msgstr "" | ||
|
||
#. module: hr_expense_substate | ||
#: model:ir.model.fields,field_description:hr_expense_substate.field_base_substate_type__model | ||
msgid "Apply on" | ||
msgstr "" | ||
|
||
#. module: hr_expense_substate | ||
#: model:target.state.value,name:hr_expense_substate.target_state_value_approve | ||
msgid "Approved" | ||
msgstr "" | ||
|
||
#. module: hr_expense_substate | ||
#: model:ir.model,name:hr_expense_substate.model_base_substate_type | ||
msgid "Base Substate Type" | ||
msgstr "" | ||
|
||
#. module: hr_expense_substate | ||
#: model:base.substate,name:hr_expense_substate.base_substate_checked | ||
msgid "Checked" | ||
msgstr "" | ||
|
||
#. module: hr_expense_substate | ||
#: model:ir.model.fields,field_description:hr_expense_substate.field_base_substate_type__display_name | ||
#: model:ir.model.fields,field_description:hr_expense_substate.field_hr_expense_sheet__display_name | ||
msgid "Display Name" | ||
msgstr "" | ||
|
||
#. module: hr_expense_substate | ||
#: model:target.state.value,name:hr_expense_substate.target_state_value_draft | ||
msgid "Draft" | ||
msgstr "" | ||
|
||
#. module: hr_expense_substate | ||
#: model:ir.model,name:hr_expense_substate.model_hr_expense_sheet | ||
#: model:ir.model.fields.selection,name:hr_expense_substate.selection__base_substate_type__model__hr_expense_sheet | ||
msgid "Expense Report" | ||
msgstr "" | ||
|
||
#. module: hr_expense_substate | ||
#: model:base.substate.type,name:hr_expense_substate.base_substate_type_hr_expense_sheet | ||
msgid "Expense Report Substate" | ||
msgstr "" | ||
|
||
#. module: hr_expense_substate | ||
#: model:ir.model.fields,field_description:hr_expense_substate.field_base_substate_type__id | ||
#: model:ir.model.fields,field_description:hr_expense_substate.field_hr_expense_sheet__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: hr_expense_substate | ||
#: model:ir.model.fields,field_description:hr_expense_substate.field_base_substate_type____last_update | ||
#: model:ir.model.fields,field_description:hr_expense_substate.field_hr_expense_sheet____last_update | ||
msgid "Last Modified on" | ||
msgstr "" | ||
|
||
#. module: hr_expense_substate | ||
#: model:target.state.value,name:hr_expense_substate.target_state_value_done | ||
msgid "Paid" | ||
msgstr "" | ||
|
||
#. module: hr_expense_substate | ||
#: model:target.state.value,name:hr_expense_substate.target_state_value_post | ||
msgid "Posted" | ||
msgstr "" | ||
|
||
#. module: hr_expense_substate | ||
#: model:target.state.value,name:hr_expense_substate.target_state_value_cancel | ||
msgid "Refused" | ||
msgstr "" | ||
|
||
#. module: hr_expense_substate | ||
#: model:ir.model.fields,field_description:hr_expense_substate.field_hr_expense_sheet__substate_id | ||
#: model_terms:ir.ui.view,arch_db:hr_expense_substate.hr_expense_sheet_view_search | ||
msgid "Sub State" | ||
msgstr "" | ||
|
||
#. module: hr_expense_substate | ||
#: model:target.state.value,name:hr_expense_substate.target_state_value_submit | ||
msgid "Submitted" | ||
msgstr "" | ||
|
||
#. module: hr_expense_substate | ||
#: model:base.substate,name:hr_expense_substate.base_substate_to_verify | ||
msgid "To Verify" | ||
msgstr "" | ||
|
||
#. module: hr_expense_substate | ||
#: model:base.substate,name:hr_expense_substate.base_substate_verified | ||
msgid "Verified" | ||
msgstr "" | ||
|
||
#. module: hr_expense_substate | ||
#: model:mail.template,subject:hr_expense_substate.mail_template_data_hr_expense_substate_verified | ||
msgid "Your expense report ${object.name} is verified" | ||
msgstr "" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import hr_expense |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# 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=[("hr.expense.sheet", "Expense Report")], | ||
ondelete={"hr.expense.sheet": "cascade"}, | ||
) | ||
|
||
|
||
class HrExpenseSheet(models.Model): | ||
_name = "hr.expense.sheet" | ||
_inherit = ["hr.expense.sheet", "base.substate.mixin"] | ||
_state_field = "state" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* Pimolnat Suntian <pimolnats@ecosoft.co.th> | ||
* Saran Lim. <saranl@ecosoft.co.th> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
This module allows to add a substate to an expense report. | ||
For each expense report state you can define a substate. | ||
We this module you can define substate which allow you to extend expense report workflow. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this line can be deleted. The improved one is already above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This description for explain this module. I think it okay to use this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Saran440 Going to review this one now. Can you please attend to my earlier comment. |
||
For example, you can add substate "To Verify" if | ||
the order can not be approved without document checked and verified |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#. 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). | ||
Saran440 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Substate sequence is very important. | ||
#. Create a expense report and check if the substate are displayed on the header of | ||
form view. Check if you can't set substate defined for expense report if sate is a To be approved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you migrate this mail template to V15.
https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-15.0
On runboat I didn't see this mail template being attached to an substate.
propably because the demo data is not correctly loaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is a bug of module
base_substate
.Now i fixed it here OCA/server-ux#735
Can you help review please?