Skip to content

Commit

Permalink
Merge d35a11f into 65ec3cb
Browse files Browse the repository at this point in the history
  • Loading branch information
andhit-r committed Mar 20, 2017
2 parents 65ec3cb + d35a11f commit 70cba85
Show file tree
Hide file tree
Showing 18 changed files with 618 additions and 0 deletions.
50 changes: 50 additions & 0 deletions l10n_id_djbc_app/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.. 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

===========================================
Indonesia - IT Inventory for DJBC Reporting
===========================================

Core application for IT Inventory


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

To install this module, you need to:

1. Clone the branch 8.0 of the repository https://github.com/open-synergy/opnsynid-l10n-indonesia
2. Add the path to this repository in your configuration (addons-path)
3. Update the module list
4. Go to menu *Setting -> Modules -> Local Modules*
5. Search For *Indonesia - IT Inventory for DJBC Reporting*
6. Install the module

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

Bugs are tracked on `GitHub Issues
<https://github.com/open-synergy/opnsynid-l10n-indonesia/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.


Credits
=======

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

* Michael Viriyananda <viriyananda.michael@gmail.com>
* Andhitia Rama <andhitia.r@gmail.com>

Maintainer
----------

.. image:: https://opensynergy-indonesia.com/logo.png
:alt: OpenSynergy Indonesia
:target: https://opensynergy-indonesia.com

This module is maintained by the OpenSynergy Indonesia.
5 changes: 5 additions & 0 deletions l10n_id_djbc_app/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2017 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
26 changes: 26 additions & 0 deletions l10n_id_djbc_app/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Copyright 2017 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Indonesia - IT Inventory for DJBC Reporting",
"version": "8.0.1.0.0",
"category": "localization",
"website": "https://opensynergy-indonesia.com",
"author": "OpenSynergy Indonesia",
"license": "AGPL-3",
"installable": True,
"application": True,
"depends": [
"stock",
],
"data": [
"security/res_groups.xml",
"security/ir.model.access.csv",
"menu.xml",
"views/djbc_report_period_views.xml",
"views/djbc_document_type_views.xml",
"views/djbc_custom_document_views.xml",
"views/stock_move_views.xml",
"views/stock_quant_views.xml",
],
}
57 changes: 57 additions & 0 deletions l10n_id_djbc_app/menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 OpenSynergy Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<openerp>
<data>

<menuitem
id="djbc_main_menu"
name="IT Inventory"
sequence="20"
/>

<menuitem
id="djbc_custom_document_menu"
name="Custom Documents"
sequence="1"
parent="djbc_main_menu"
/>

<menuitem
id="djbc_traceability_menu"
name="Traceability"
sequence="2"
parent="djbc_main_menu"
/>

<menuitem
id="djbc_stock_move_menu"
name="Stock Moves"
sequence="1"
parent="djbc_traceability_menu"
/>

<menuitem
id="djbc_quant_menu"
name="Quants"
sequence="1"
parent="djbc_traceability_menu"
/>

<menuitem
id="djbc_reporting_menu"
name="Reporting"
sequence="99"
parent="djbc_main_menu"
/>

<menuitem
id="djbc_configuration_menu"
name="Configuration"
sequence="100"
parent="djbc_main_menu"
/>

</data>
</openerp>
9 changes: 9 additions & 0 deletions l10n_id_djbc_app/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright 2017 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import djbc_report_period
from . import djbc_document_type
from . import djbc_custom_document
from . import stock_move
from . import stock_quant
25 changes: 25 additions & 0 deletions l10n_id_djbc_app/models/djbc_custom_document.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Copyright 2017 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, fields


class CustomDocument(models.Model):
_name = "l10n_id.djbc_custom_document"
_description = "Custom Document"

name = fields.Char(
string="# Document",
required=True,
)
date = fields.Date(
string="Date",
required=True,
)
type_id = fields.Many2one(
string="Type",
comodel_name="l10n_id.djbc_document_type",
required=True,
ondelete="restrict",
)
25 changes: 25 additions & 0 deletions l10n_id_djbc_app/models/djbc_document_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Copyright 2017 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, fields


class DocumentType(models.Model):
_name = "l10n_id.djbc_document_type"
_description = "Document Type"

name = fields.Char(
string="Document Type",
required=True,
)
code = fields.Char(
string="Code",
required=True,
)
active = fields.Boolean(
string="Active",
)
description = fields.Text(
string="Description",
)
73 changes: 73 additions & 0 deletions l10n_id_djbc_app/models/djbc_report_period.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# -*- coding: utf-8 -*-
# Copyright 2017 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, fields, api
from openerp.tools.translate import _
from datetime import datetime


class ReportPeriod(models.Model):
_name = "l10n_id.djbc_report_period"
_description = "DJBC Report Period"
_order = "date_start asc, id"

name = fields.Char(
string="Period",
required=True,
)
code = fields.Char(
string="Code",
required=True,
)
date_start = fields.Date(
string="Date Start",
required=True,
)
date_end = fields.Date(
string="Date End",
required=True,
)

@api.constrains("date_start", "date_end")
def _check_range(self):
if self.date_end <= self.date_start:
strWarning = _("The start date must precede it's end date")
raise models.ValidationError(strWarning)

@api.multi
def _next_period(self, step):
self.ensure_one()
criteria = [
("date_start", ">", self.date_start)
]
results = self.search(criteria)
if results:
return results[step - 1]
return False

@api.multi
def _previous_period(self, step):
self.ensure_one()
criteria = [
("date_start", "<", self.date_start)
]
results = self.search(criteria, order="date_start desc")
if results:
return results[step - 1]
return False

@api.model
def _find_period(self, dt=None):
if not dt:
dt = datetime.now().strftime("%Y-%m-%d")
criteria = [
("date_start", "<=", dt),
("date_end", ">=", dt),
]
results = self.search(criteria)
if not results:
strWarning = _("No DJBC report period configured for %s" % dt)
raise models.ValidationError(strWarning)
result = results[0]
return result
34 changes: 34 additions & 0 deletions l10n_id_djbc_app/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
# Copyright 2017 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, fields, api


class StockMove(models.Model):
_inherit = "stock.move"

@api.depends(
"quant_ids",
"quant_ids.djbc_custom",
)
@api.multi
def _compute_djbc(self):
for move in self:
move.djbc_custom = False
for quant in move.quant_ids:
move.djbc_custom = True
if not quant.djbc_custom:
move.djbc_custom = False

djbc_custom_document_id = fields.Many2one(
string="DJBC Custom Document",
comodel_name="l10n_id.djbc_custom_document",
ondelete="restrict",
)
djbc_custom = fields.Boolean(
string="DJBC Marking",
compute="_compute_djbc",
store=True,
readonly=True,
)
24 changes: 24 additions & 0 deletions l10n_id_djbc_app/models/stock_quant.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Copyright 2017 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, fields, api


class StockQuant(models.Model):
_inherit = "stock.quant"

djbc_custom = fields.Boolean(
string="DJBC Marking",
)

@api.model
def _quant_create(self, qty, move, lot_id=False, owner_id=False,
src_package_id=False, dest_package_id=False,
force_location_from=False, force_location_to=False,
):
quant = super(StockQuant, self)._quant_create(
qty, move, lot_id, owner_id, src_package_id, dest_package_id,
force_location_from, force_location_to)
if move.djbc_custom_document_id:
quant.write({"djbc_custom": True})
7 changes: 7 additions & 0 deletions l10n_id_djbc_app/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_all_djbc_report_period,all user l10n_id.djbc_report_period,model_l10n_id_djbc_report_period,,1,0,0,0
access_all_djbc_document_type,all user l10n_id.djbc_document_type,model_l10n_id_djbc_document_type,,1,0,0,0
access_all_djbc_custom_document,all user l10n_id.djbc_custom_document,model_l10n_id_djbc_custom_document,,1,0,0,0
access_user_djbc_report_period,all user l10n_id.djbc_report_period,model_l10n_id_djbc_report_period,l10n_id_djbc_app.group_djbc_user,1,1,1,1
access_user_djbc_document_type,all user l10n_id.djbc_document_type,model_l10n_id_djbc_document_type,l10n_id_djbc_app.group_djbc_user,1,1,1,1
access_user_djbc_custom_document,all user l10n_id.djbc_custom_document,model_l10n_id_djbc_custom_document,l10n_id_djbc_app.group_djbc_user,1,1,1,1
25 changes: 25 additions & 0 deletions l10n_id_djbc_app/security/res_groups.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2016 OpenSynergy Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<openerp>
<data>

<record id="module_category_djbc" model="ir.module.category">
<field name="name">DJBC IT Inventory</field>
</record>

<record id="group_djbc_user" model="res.groups">
<field name="name">User</field>
<field name="category_id" ref="module_category_djbc"/>
</record>

<record id="group_djbc_manager" model="res.groups">
<field name="name">Manager</field>
<field name="category_id" ref="module_category_djbc"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
<field name="implied_ids" eval="(4, ref('group_djbc_user'))"/>
</record>

</data>
</openerp>
Binary file added l10n_id_djbc_app/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 70cba85

Please sign in to comment.