Skip to content

Commit

Permalink
Merge 18dd0be into 5337d4a
Browse files Browse the repository at this point in the history
  • Loading branch information
mikevhe18 committed Sep 13, 2019
2 parents 5337d4a + 18dd0be commit 252ca52
Show file tree
Hide file tree
Showing 47 changed files with 846 additions and 29 deletions.
6 changes: 4 additions & 2 deletions l10n_id_djbc_kite_common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
# Copyright 2019 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
# from . import reports
from . import (
models,
reports,
)
3 changes: 2 additions & 1 deletion l10n_id_djbc_kite_common/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# pylint: disable=locally-disabled, manifest-required-author
{
"name": "Indonesia - Common Feature for KITE",
"version": "8.0.1.0.0",
"version": "8.0.1.1.0",
"category": "localization",
"website": "https://opensynergy-indonesia.com",
"author": "OpenSynergy Indonesia",
Expand All @@ -19,6 +19,7 @@
"security/ir.model.access.csv",
"data/product_category_data.xml",
"menu.xml",
"reports/lap_kite_mutasi_common_views.xml",
"views/djbc_kite_movement_type_views.xml",
"views/stock_picking_type_views.xml",
"views/product_category_views.xml",
Expand Down
43 changes: 30 additions & 13 deletions l10n_id_djbc_kite_common/reports/lap_kite_mutasi_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,31 @@ def _qty_from(self):

@api.multi
def _qty_where(
self, date_start, date_end, movement_type="in",
scrap=False, adjustment=False
self, date_start, date_end,
code, scrap=False, adjustment=False
):
self.ensure_one()
str_where = """
WHERE
a.product_id = %s AND
b.warehouse_id = %s AND
b.djbc_kb_movement_type = '%s' AND
b.djbc_kb_scrap %s AND
b.djbc_kite_scrap %s AND
a.djbc_custom IS TRUE AND
a.state = 'done' AND
""" % (
self.product_id.id,
self.warehouse_id.id,
movement_type,
scrap and 'IS TRUE' or 'IS FALSE',
)
if code == "incoming":
str_where += """
b.code = 'incoming' AND
"""
if code == "outgoing":
str_where += """
b.code = 'outgoing' AND
"""

if date_start:
str_where += """
a.date >= '%s' AND
Expand Down Expand Up @@ -91,22 +99,31 @@ def _compute_qty(self):
("date", ">=", date_start),
("date", "<=", date_end),
("state", "=", "done"),
("djbc", "=", True),
("location_id.id", "child_of", view_root_id),
]
invs = obj_inv.search(criteria1, order="date desc", limit=1)
if invs:
inv = invs[0]

saldo_awal_pemasukan = lap._get_qty(
False, date_start, "in", False, False)
False, date_start, "incoming", False, False)
saldo_awal_pengeluaran = lap._get_qty(
False, date_start, "out", False, False)
False, date_start, "outgoing", False, False)
saldo_awal = saldo_awal_pemasukan - saldo_awal_pengeluaran
pemasukan = lap._get_qty(
date_start, date_end, "in", False, inv and inv.id or False)
date_start,
date_end,
"incoming",
False,
inv and inv.id or False
)
pengeluaran = lap._get_qty(
date_start, date_end, "out", False, inv and inv.id or False)
date_start,
date_end,
"outgoing",
False,
inv and inv.id or False
)

if inv:
criteria = [
Expand Down Expand Up @@ -138,7 +155,7 @@ def _compute_qty(self):
lap.keterangan = keterangan

@api.multi
def _get_qty(self, date_start, date_end, movement_type, scrap, adjustment):
def _get_qty(self, date_start, date_end, code, scrap, adjustment):
self.ensure_one()
result = 0.0
# pylint: disable=locally-disabled, sql-injection
Expand All @@ -152,7 +169,7 @@ def _get_qty(self, date_start, date_end, movement_type, scrap, adjustment):
self._qty_where(
date_start,
date_end,
movement_type,
code,
scrap,
adjustment
)
Expand Down Expand Up @@ -252,7 +269,7 @@ def _from(self):

def _where(self):
where_str = """
WHERE b.djbc_kb_ok = TRUE
WHERE b.djbc_kite_ok = TRUE
"""
return where_str

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 OpenSynergy Indonesia
<!-- Copyright 2019 OpenSynergy Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<openerp>
<data>
<record id="djbc_lap_kb_mutasi_common_view_tree" model="ir.ui.view">
<field name="name">tree l10n_id.djbc_kb_lap_mutasi_common</field>
<field name="model">l10n_id.djbc_kb_lap_mutasi_common</field>
<record id="djbc_kite_lap_mutasi_common_view_tree" model="ir.ui.view">
<field name="name">l10n_id.djbc_kite_lap_mutasi_common.tree</field>
<field name="model">l10n_id.djbc_kite_lap_mutasi_common</field>
<field name="arch" type="xml">
<tree create="false" edit="false" delete="false">
<field name="kode_barang"/>
Expand All @@ -15,8 +15,6 @@
<field name="saldo_awal"/>
<field name="pemasukan"/>
<field name="pengeluaran"/>
<field name="penyesuaian"/>
<field name="stock_opname"/>
<field name="saldo_akhir"/>
<field name="selisih"/>
<field name="keterangan"/>
Expand All @@ -25,9 +23,9 @@
</field>
</record>

<record id="djbc_lap_kb_mutasi_common_view_search" model="ir.ui.view">
<field name="name">search l10n_id.djbc_kb_lap_mutasi_common</field>
<field name="model">l10n_id.djbc_kb_lap_mutasi_common</field>
<record id="djbc_kite_lap_mutasi_common_view_search" model="ir.ui.view">
<field name="name">l10n_id.djbc_kite_lap_mutasi_common.search</field>
<field name="model">l10n_id.djbc_kite_lap_mutasi_common</field>
<field name="arch" type="xml">
<search>
</search>
Expand Down
49 changes: 49 additions & 0 deletions l10n_id_djbc_kite_lap_mutasi_bahan_baku/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
.. 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 - Lap. Mutasi Bahan Baku for KITE
============================================

Indonesia - Lap. Mutasi Bahan Baku for KITE

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 - Lap. Mutasi Bahan Baku for KITE*
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_kite_lap_mutasi_bahan_baku/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import reports, wizards
21 changes: 21 additions & 0 deletions l10n_id_djbc_kite_lap_mutasi_bahan_baku/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright 2019 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# pylint: disable=locally-disabled, manifest-required-author
{
"name": "Indonesia - Lap. Mutasi Bahan Baku for KITE",
"version": "8.0.1.0.0",
"category": "localization",
"website": "https://opensynergy-indonesia.com",
"author": "OpenSynergy Indonesia",
"license": "AGPL-3",
"installable": True,
"depends": [
"l10n_id_djbc_kite_common",
],
"data": [
"security/ir.model.access.csv",
"wizards/date_range_selector_views.xml",
"reports/lap_kite_mutasi_bahan_baku_views.xml",
],
}
5 changes: 5 additions & 0 deletions l10n_id_djbc_kite_lap_mutasi_bahan_baku/reports/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2019 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import lap_kite_mutasi_bahan_baku
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Copyright 2019 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models


class LapKiteMutasiBahanBaku(models.Model):
_name = "l10n_id.djbc_kite_lap_mutasi_bahan_baku"
_inherit = "l10n_id.djbc_kite_lap_mutasi_common"
_description = "Laporan Mutasi Bahan Baku Untuk KITE"
_auto = False

def _join(self):
_super = super(LapKiteMutasiBahanBaku, self)
join_str = _super._join() + """
JOIN product_categ_rel AS c ON
b.id = c.product_id
JOIN product_category AS d ON
c.categ_id = d.id
JOIN (
SELECT res_id
FROM ir_model_data AS e1
WHERE
e1.module = 'l10n_id_djbc_kite_common' AND
(e1.name = 'product_categ_kite_bahan_baku')
) as e ON
d.id = e.res_id
"""
return join_str
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 OpenSynergy Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<openerp>
<data>
<record id="djbc_kite_lap_mutasi_bahan_baku_view_tree" model="ir.ui.view">
<field name="name">l10n_id.djbc_kite_lap_mutasi_bahan_baku.tree</field>
<field name="model">l10n_id.djbc_kite_lap_mutasi_bahan_baku</field>
<field name="inherit_id" ref="l10n_id_djbc_kite_common.djbc_kite_lap_mutasi_common_view_tree"/>
<field name="arch" type="xml">
<data>
</data>
</field>
</record>

<record id="djbc_kite_lap_mutasi_bahan_baku_view_search" model="ir.ui.view">
<field name="name">l10n_id.djbc_kite_lap_mutasi_bahan_baku.search</field>
<field name="model">l10n_id.djbc_kite_lap_mutasi_bahan_baku</field>
<field name="inherit_id" ref="l10n_id_djbc_kite_common.djbc_kite_lap_mutasi_common_view_search"/>
<field name="arch" type="xml">
<data>
</data>
</field>
</record>

<record id="djbc_kite_lap_mutasi_bahan_baku_action" model="ir.actions.act_window">
<field name="name">Lap. Mutasi Bahan Baku</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">l10n_id.djbc_kite_lap_mutasi_bahan_baku</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
<field name="view_id" ref="djbc_kite_lap_mutasi_bahan_baku_view_tree"/>
</record>
</data>
</openerp>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_all_djbc_kite_lap_mutasi_bahan_baku,all user l10n_id.djbc_kite_lap_mutasi_bahan_baku,model_l10n_id_djbc_kite_lap_mutasi_bahan_baku,,1,0,0,0
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions l10n_id_djbc_kite_lap_mutasi_bahan_baku/wizards/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2019 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import date_range_selector
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import api, models, fields


class KiteLapMutasiBahanBakuWizard(models.TransientModel):
_name = "l10n_id.kite_lap_mutasi_bahan_baku_wizard"
_inherit = ["l10n_id.date_range_selector"]

warehouse_ids = fields.Many2many(
string="Warehouse",
comodel_name="stock.warehouse",
relation="rel_kite_mutasi_bb_2_warehouse",
column1="wizard_id",
column2="warehouse_id"
)

@api.multi
def action_print_sreen(self):
waction = self.env.ref(
"l10n_id_djbc_kite_lap_mutasi_bahan_baku."
"djbc_kite_lap_mutasi_bahan_baku_action")
context = {
"date_start": self.date_start,
"date_end": self.date_end,
}
domain = [("warehouse_id", "in", self.warehouse_ids.ids)]
result = waction.read()[0]
result.update({"context": context, "domain": domain})
return result
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 OpenSynergy Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<openerp>
<data>
<record id="kite_lap_mutasi_bahan_baku_wizard_view_form" model="ir.ui.view">
<field name="name">l10n_id.kite_lap_mutasi_bahan_baku_wizard.form</field>
<field name="model">l10n_id.kite_lap_mutasi_bahan_baku_wizard</field>
<field name="inherit_id" ref="l10n_id_djbc_app.date_range_selector_view_form"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<data>
</data>
</field>
</record>

<record id="kite_lap_mutasi_bahan_baku_wizard_action" model="ir.actions.act_window">
<field name="name">Mutasi Bahan Baku</field>
<field name="res_model">l10n_id.kite_lap_mutasi_bahan_baku_wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="kite_lap_mutasi_bahan_baku_wizard_view_form"/>
<field name="target">new</field>
</record>

<menuitem
id="kite_lap_mutasi_bahan_baku_wizard_menu"
name="Mutasi Bahan Baku/Penolong"
parent="l10n_id_djbc_kite_common.djbc_reporting_kite_menu"
action="kite_lap_mutasi_bahan_baku_wizard_action"
sequence="10"
/>
</data>
</openerp>

0 comments on commit 252ca52

Please sign in to comment.