Skip to content

Commit

Permalink
[ADD] ssi_account_journal_m2o_configurator_mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
andhit-r committed Nov 3, 2023
1 parent 73c022c commit 88ede1f
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 0 deletions.
46 changes: 46 additions & 0 deletions ssi_account_journal_m2o_configurator_mixin/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

===========================================
account.journal Many2one Configurator Mixin
===========================================


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

To install this module, you need to:

1. Clone the branch 14.0 of the repository https://github.com/open-synergy/ssi-financial-accounting
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 *account.journal Many2one Configurator Mixin*
6. Install the module

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

Bugs are tracked on `GitHub Issues
<https://github.com/open-synergy/ssi-financial-accounting/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 <andhitia.r@gmail.com>

Maintainer
----------

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

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

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

{
"name": "account.journal Many2one Configurator Mixin",
"version": "14.0.1.0.0",
"website": "https://simetri-sinergi.id",
"author": "OpenSynergy Indonesia, PT. Simetri Sinergi Indonesia",
"license": "AGPL-3",
"installable": True,
"depends": ["account", "ssi_decorator"],
"data": [
"templates/account_journal_m2_configurator_templates.xml",
],
}
7 changes: 7 additions & 0 deletions ssi_account_journal_m2o_configurator_mixin/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2022 OpenSynergy Indonesia
# Copyright 2022 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import (
mixin_account_journal_m2o_configurator,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2022 OpenSynergy Indonesia
# Copyright 2022 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models

from odoo.addons.ssi_decorator import ssi_decorator


class MixinAccountJournalM2OConfigurator(models.AbstractModel):
_name = "mixin.account_journal_m2o_configurator"
_inherit = [
"mixin.decorator",
]
_description = "account.journal Many2one Configurator Mixin"

_account_journal_m2o_configurator_insert_form_element_ok = False
_account_journal_m2o_configurator_form_xpath = False

journal_selection_method = fields.Selection(
default="domain",
selection=[("manual", "Manual"), ("domain", "Domain"), ("code", "Python Code")],
string="Journal Selection Method",
required=True,
)
journal_ids = fields.Many2many(
comodel_name="account.journal",
string="Journals",
)
journal_domain = fields.Text(default="[]", string="Journal Domain")
journal_python_code = fields.Text(
default="result = []", string="Journal Python Code"
)

@ssi_decorator.insert_on_form_view()
def _account_journal_m2o_configurator_insert_form_element(self, view_arch):
# TODO
template_xml = "ssi_account_journal_m2o_configurator_mixin."
template_xml += "account_journal_m2o_configurator_template"
if self._account_journal_m2o_configurator_insert_form_element_ok:
view_arch = self._add_view_element(
view_arch=view_arch,
qweb_template_xml_id=template_xml,
xpath=self._account_journal_m2o_configurator_form_xpath,
position="inside",
)
return view_arch
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<template id="account_journal_m2o_configurator_template">
<group name="journal_1" col="2" colspan="4" string="Journal">
<field name="journal_selection_method" />
<field
name="journal_ids"
attrs="{'invisible':[('journal_selection_method','!=','manual')]}"
/>
<field
name="journal_domain"
widget="domain"
options="{'model': 'account.journal', 'in_dialog': True}"
attrs="{'invisible':[('journal_selection_method','!=','domain')]}"
/>
<field
name="journal_python_code"
widget="ace"
attrs="{'invisible':[('journal_selection_method','!=','code')]}"
/>
</group>
</template>
</odoo>

0 comments on commit 88ede1f

Please sign in to comment.