Skip to content
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

[ADD] ssi_stock_valuation_layer_recomputation #71

Merged
merged 2 commits into from
Aug 28, 2024
Merged
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
46 changes: 46 additions & 0 deletions ssi_stock_valuation_layer_recomputation/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

=========================================
Stock Valuation Layer Usage Recomputation
=========================================


Installation
============

To install this module, you need to:

1. Clone the branch 14.0 of the repository https://github.com/open-synergy/ssi-stock
2. Add the path to this repository in your configuration (addons-path)
3. Update the module list (Must be on developer mode)
4. Go to menu *Apps -> Apps -> Main Apps*
5. Search For *Stock Valuation Layer Usage Recomputation*
6. Install the module

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

Bugs are tracked on `GitHub Issues
<https://github.com/open-synergy/ssi-stock/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.


Credits
=======

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

* Andhitia Rama <[email protected]>

Maintainer
----------

.. image:: https://simetri-sinergi.id/logo.png
:alt: PT. Simetri Sinergi Indonesia
:target: https://simetri-sinergi.id.com

This module is maintained by the PT. Simetri Sinergi Indonesia.
7 changes: 7 additions & 0 deletions ssi_stock_valuation_layer_recomputation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2024 OpenSynergy Indonesia
# Copyright 2024 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import (
models,
)
39 changes: 39 additions & 0 deletions ssi_stock_valuation_layer_recomputation/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2024 OpenSynergy Indonesia
# Copyright 2024 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Stock Valuation Layer Usage Recomputation",
"version": "14.0.1.0.0",
"website": "https://simetri-sinergi.id",
"author": "PT. Simetri Sinergi Indonesia, OpenSynergy Indonesia",
"license": "AGPL-3",
"installable": True,
"depends": [
"ssi_stock_account",
"ssi_product",
"ssi_master_data_mixin",
"ssi_transaction_confirm_mixin",
"ssi_transaction_queue_done_mixin",
"ssi_transaction_queue_cancel_mixin",
"ssi_m2o_configurator_mixin",
"base_automation",
],
"data": [
"security/ir_module_category_data.xml",
"security/res_group_data.xml",
"security/ir.model.access.csv",
"security/ir_rule_data.xml",
"data/ir_sequence_data.xml",
"data/sequence_template_data.xml",
"data/policy_template_data.xml",
"data/approval_template_data.xml",
"data/ir_actions_server_data.xml",
"data/base_automation_data.xml",
"menu.xml",
"views/svl_recomputation_type_views.xml",
"views/svl_recomputation_views.xml",
],
"demo": [],
"images": [],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2024 OpenSynergy Indonesia
Copyright 2024 PT. Simetri Sinergi Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<data noupdate="1">
<record id="svl_recomputation_approval_template" model="approval.template">
<field name="name">Standard</field>
<field name="model_id" ref="model_svl_recomputation" />
<field name="sequence" eval="100" />
<field name="computation_method">use_python</field>
<field name="python_code">result = True</field>
<field name="validate_sequence" eval="1" />
</record>
<record
id="svl_recomputation_approval_template_detail"
model="approval.template_detail"
>
<field name="template_id" ref="svl_recomputation_approval_template" />
<field name="approver_selection_method">use_group</field>
<field
name="approver_group_ids"
eval="[(6,0,[ref('svl_recomputation_validator_group')])]"
/>
</record>
</data>
</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<odoo>
<!-- Copyright 2022 OpenSynergy Indonesia
Copyright 2022 PT. Simetri Sinergi Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<data>
<record id="svl_recomputation_done" model="base.automation">
<field
name="action_server_id"
ref="svl_recomputation_action_recompute_queue_done_result"
/>
<field name="trigger">on_write</field>
<field name="filter_pre_domain">[]</field>
<field name="filter_domain">[('done_queue_job_batch_state','=','finished')]</field>
</record>

<record id="svl_recomputation_cancel" model="base.automation">
<field
name="action_server_id"
ref="svl_recomputation_action_recompute_queue_cancel_result"
/>
<field name="trigger">on_write</field>
<field name="filter_pre_domain">[]</field>
<field
name="filter_domain"
>[('cancel_queue_job_batch_state','=','finished')]</field>
</record>
</data>
</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<odoo>
<!-- Copyright 2024 OpenSynergy Indonesia
Copyright 2024 PT. Simetri Sinergi Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<data>
<record
id="svl_recomputation_action_recompute_queue_done_result"
model="ir.actions.server"
>
<field name="name">Action Recompute Queue Done Result</field>
<field name="model_id" ref="model_svl_recomputation" />
<field name="state">code</field>
<field name="code">records.action_recompute_queue_done_result()</field>
</record>

<record
id="svl_recomputation_action_recompute_queue_cancel_result"
model="ir.actions.server"
>
<field name="name">Action Recompute Queue Cancel Result</field>
<field name="model_id" ref="model_svl_recomputation" />
<field name="state">code</field>
<field name="code">records.action_recompute_queue_cancel_result()</field>
</record>
</data>
</odoo>
18 changes: 18 additions & 0 deletions ssi_stock_valuation_layer_recomputation/data/ir_sequence_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2024 OpenSynergy Indonesia
Copyright 2024 PT. Simetri Sinergi Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<data noupdate="1">
<record id="svl_recomputation_sequence" model="ir.sequence">
<field name="name">SVL Recomputation</field>
<field name="code">svl_recomputation</field>
<field name="prefix">SVL/%(range_year)s/</field>
<field eval="1" name="number_next" />
<field eval="1" name="number_increment" />
<field name="padding" eval="6" />
<field name="use_date_range" eval="1" />
<field eval="False" name="company_id" />
</record>
</data>
</odoo>
173 changes: 173 additions & 0 deletions ssi_stock_valuation_layer_recomputation/data/policy_template_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2024 OpenSynergy Indonesia
Copyright 2024 PT. Simetri Sinergi Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<data noupdate="0">
<record id="svl_recomputation_policy_template" model="policy.template">
<field name="name">Standard</field>
<field name="model_id" ref="model_svl_recomputation" />
<field
name="state_field_id"
search="[('model_id.model','=','svl_recomputation'),('name','=','state')]"
/>
<field name="sequence" eval="100" />
<field name="python_code">result=True</field>
</record>

<!-- confirm -->
<record
id="svl_recomputation_policy_template_detail_confirm"
model="policy.template_detail"
>
<field name="template_id" ref="svl_recomputation_policy_template" />
<field
name="field_id"
search="[('model_id.model','=','svl_recomputation'),('name','=','confirm_ok')]"
/>
<field name="restrict_state" eval="1" />
<field
name="state_ids"
search="[('field_id.model_id.model','=','svl_recomputation'),('value','=','draft')]"
/>
<field name="restrict_user" eval="1" />
<field name="computation_method">use_group</field>
<field name="group_ids" eval="[(6,0,[ref('svl_recomputation_user_group')])]" />
<field name="restrict_additional" eval="0" />
</record>

<!-- approve -->
<record
id="svl_recomputation_policy_template_detail_approve"
model="policy.template_detail"
>
<field name="template_id" ref="svl_recomputation_policy_template" />
<field
name="field_id"
search="[('model_id.model','=','svl_recomputation'),('name','=','approve_ok')]"
/>
<field name="restrict_state" eval="1" />
<field
name="state_ids"
search="[('field_id.model_id.model','=','svl_recomputation'),('value','=','confirm')]"
/>
<field name="restrict_user" eval="0" />
<field name="restrict_additional" eval="1" />
<field name="additional_python_code">result = False
if env.user.id in document.active_approver_user_ids.ids:
result = True
</field>
</record>

<!-- reject -->
<record
id="svl_recomputation_policy_template_detail_reject"
model="policy.template_detail"
>
<field name="template_id" ref="svl_recomputation_policy_template" />
<field
name="field_id"
search="[('model_id.model','=','svl_recomputation'),('name','=','reject_ok')]"
/>
<field name="restrict_state" eval="1" />
<field
name="state_ids"
search="[('field_id.model_id.model','=','svl_recomputation'),('value','=','confirm')]"
/>
<field name="restrict_user" eval="0" />
<field name="restrict_additional" eval="1" />
<field name="additional_python_code">result = False
if env.user.id in document.active_approver_user_ids.ids:
result = True
</field>
</record>

<!-- restart approval -->
<record
id="svl_recomputation_policy_template_detail_restart_approval"
model="policy.template_detail"
>
<field name="template_id" ref="svl_recomputation_policy_template" />
<field
name="field_id"
search="[('model_id.model','=','svl_recomputation'),('name','=','restart_approval_ok')]"
/>
<field name="restrict_state" eval="1" />
<field
name="state_ids"
search="[('field_id.model_id.model','=','svl_recomputation'),('value','=','confirm')]"
/>
<field name="restrict_user" eval="1" />
<field name="computation_method">use_group</field>
<field name="group_ids" eval="[(6,0,[ref('svl_recomputation_validator_group')])]" />
<field name="restrict_additional" eval="1" />
<field name="additional_python_code">result = False
if not document.approval_template_id:
result = True
</field>
</record>

<!-- cancel -->
<record
id="svl_recomputation_policy_template_detail_cancel"
model="policy.template_detail"
>
<field name="template_id" ref="svl_recomputation_policy_template" />
<field
name="field_id"
search="[('model_id.model','=','svl_recomputation'),('name','=','cancel_ok')]"
/>
<field name="restrict_state" eval="1" />
<field
name="state_ids"
search="[('field_id.model_id.model','=','svl_recomputation'),('value','in',['draft','confirm','done'])]"
/>
<field name="restrict_user" eval="1" />
<field name="computation_method">use_group</field>
<field name="group_ids" eval="[(6,0,[ref('svl_recomputation_validator_group')])]" />
<field name="restrict_additional" eval="0" />
</record>

<!-- restart -->
<record
id="svl_recomputation_policy_template_detail_restart"
model="policy.template_detail"
>
<field name="template_id" ref="svl_recomputation_policy_template" />
<field
name="field_id"
search="[('model_id.model','=','svl_recomputation'),('name','=','restart_ok')]"
/>
<field name="restrict_state" eval="1" />
<field
name="state_ids"
search="[('field_id.model_id.model','=','svl_recomputation'),('value','in',['cancel','reject'])]"
/>
<field name="restrict_user" eval="1" />
<field name="computation_method">use_group</field>
<field name="group_ids" eval="[(6,0,[ref('svl_recomputation_validator_group')])]" />
<field name="restrict_additional" eval="0" />
</record>

<!-- manual number -->
<record
id="svl_recomputation_policy_template_detail_manual_number"
model="policy.template_detail"
>
<field name="template_id" ref="svl_recomputation_policy_template" />
<field
name="field_id"
search="[('model_id.model','=','svl_recomputation'),('name','=','manual_number_ok')]"
/>
<field name="restrict_state" eval="1" />
<field
name="state_ids"
search="[('field_id.model_id.model','=','svl_recomputation'),('value','=','draft')]"
/>
<field name="restrict_user" eval="1" />
<field name="computation_method">use_group</field>
<field name="group_ids" eval="[(6,0,[ref('svl_recomputation_validator_group')])]" />
<field name="restrict_additional" eval="0" />
</record>
</data>
</odoo>
Loading
Loading