Skip to content

Commit

Permalink
[8.0.1.0.0][l10n_id_djbc_kb_lap_pengeluaran]
Browse files Browse the repository at this point in the history
[8.0.1.0.0][l10n_id_djbc_kb_lap_pengeluaran] Adding Access Right
  • Loading branch information
mikevhe18 committed Jun 27, 2018
1 parent 54e1d2e commit 2321709
Show file tree
Hide file tree
Showing 13 changed files with 372 additions and 0 deletions.
49 changes: 49 additions & 0 deletions l10n_id_djbc_kb_lap_pengeluaran/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. Pengeluaran for DJBC's Kawasan Berikat Reporting
=================================================================



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. Pengeluaran for DJBC's Kawasan Berikat 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.
6 changes: 6 additions & 0 deletions l10n_id_djbc_kb_lap_pengeluaran/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import wizards
from . import reports
21 changes: 21 additions & 0 deletions l10n_id_djbc_kb_lap_pengeluaran/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Indonesia - Lap. Pengeluaran "
"for DJBC's Kawasan Berikat Reporting",
"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_kb_lap_common"
],
"data": [
"security/ir.model.access.csv",
"wizards/date_range_selector_views.xml",
"reports/lap_kb_lap_pengeluaran.xml"
],
}
5 changes: 5 additions & 0 deletions l10n_id_djbc_kb_lap_pengeluaran/reports/__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 lap_kb_lap_pengeluaran
130 changes: 130 additions & 0 deletions l10n_id_djbc_kb_lap_pengeluaran/reports/lap_kb_lap_pengeluaran.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, fields
from openerp import tools


class LapKbLapPengeluaran(models.Model):
_name = "l10n_id.djbc_kb_lap_pengeluaran"
_description = "Laporan Pengeluaran Barang Untuk Kawasan Berikat"
_auto = False

jenis_dokumen = fields.Many2one(
string="Jenis Dokumen",
comodel_name="l10n_id.djbc_document_type"
)

no_dokumen = fields.Char(
string="No. Dokumen"
)

tgl_dokumen = fields.Date(
string="Tanggal Dokumen"
)

no_penerimaan = fields.Char(
string="Nomor Penerimaan"
)

tgl_penerimaan = fields.Char(
string="Tanggal Penerimaan"
)

pengirim = fields.Many2one(
string="Pengirim Barang",
comodel_name="res.partner"
)

kode_barang = fields.Char(
string="Kode Barang"
)

nama_barang = fields.Many2one(
string="Nama Barang",
comodel_name="product.product"
)

jumlah = fields.Float(
string="Jumlah"
)

satuan = fields.Many2one(
string="Satuan",
comodel_name="product.uom"
)

nilai = fields.Float(
string="Nilai"
)

warehouse_id = fields.Many2one(
string="Warehouse",
comodel_name="stock.warehouse"
)

def _select(self):
select_str = """
SELECT a.id as id,
C.type_id as jenis_dokumen,
C.name as no_dokumen,
C.date as tgl_dokumen,
B.name as no_penerimaan,
A.date as tgl_penerimaan,
B.partner_id as pengirim,
D.default_code as kode_barang,
A.product_id as nama_barang,
A.product_qty as jumlah,
A.product_uom as satuan,
F.nilai as nilai,
E.warehouse_id AS warehouse_id
"""
return select_str

def _from(self):
from_str = """
FROM stock_move AS A
"""
return from_str

def _where(self):
where_str = """
WHERE E.djbc_kb_movement_type='out' AND
E.djbc_kb_scrap IS FALSE AND
E.djbc_kb_adjustment IS FALSE
"""
return where_str

def _join(self):
join_str = """
JOIN stock_picking AS B ON A.picking_id=B.id
JOIN l10n_id_djbc_custom_document AS C
ON A.djbc_custom_document_id=C.id
JOIN product_product AS D ON A.product_id=D.id
JOIN stock_picking_type AS E ON A.picking_type_id=E.id
JOIN
(
SELECT F1.move_id,
SUM(G1.qty*G1.cost) AS nilai
FROM stock_quant_move_rel AS F1
JOIN stock_quant AS G1 ON F1.quant_id=G1.id
GROUP BY F1.move_id
) AS F ON F.move_id=A.id
"""
return join_str

def init(self, cr):
tools.drop_view_if_exists(cr, self._table)
cr.execute("""CREATE or REPLACE VIEW %s as (
%s
%s
%s
%s
)""" % (
self._table,
self._select(),
self._from(),
self._join(),
self._where()
))
38 changes: 38 additions & 0 deletions l10n_id_djbc_kb_lap_pengeluaran/reports/lap_kb_lap_pengeluaran.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 OpenSynergy Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<openerp>
<data>
<record id="djbc_lap_pengeluaran_common_view_tree" model="ir.ui.view">
<field name="name">l10n_id.djbc_kb_lap_mutasi_common Tree</field>
<field name="model">l10n_id.djbc_kb_lap_pengeluaran</field>
<field name="arch" type="xml">
<tree create="false" edit="false" delete="false">
<field name="jenis_dokumen"/>
<field name="no_dokumen"/>
<field name="tgl_dokumen"/>
<field name="no_penerimaan"/>
<field name="tgl_penerimaan"/>
<field name="pengirim"/>
<field name="kode_barang"/>
<field name="nama_barang"/>
<field name="jumlah"/>
<field name="satuan"/>
<field name="nilai"/>
<field name="warehouse_id"/>
</tree>
</field>
</record>

<record id="djbc_kb_lap_pengeluaran_action" model="ir.actions.act_window">
<field name="name">Lap. Pengeluaran Barang</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">l10n_id.djbc_kb_lap_pengeluaran</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
<field name="view_id" ref="djbc_lap_pengeluaran_common_view_tree"/>
</record>

</data>
</openerp>
Binary file not shown.
59 changes: 59 additions & 0 deletions l10n_id_djbc_kb_lap_pengeluaran/reports/report_lap_pengeluaran.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

import time
from openerp.report import report_sxw


class Parser(report_sxw.rml_parse):

def __init__(self, cr, uid, name, context):
super(Parser, self).__init__(cr, uid, name, context)
self.list_config = []
self.localcontext.update({
"time": time,
"get_data": self._get_data,
})

def set_context(self, objects, data, ids, report_type=None):
self.form = data["form"]
self.date_start = self.form["date_start"]
self.date_end = self.form["date_end"]
self.warehouse_ids = self.form["warehouse_ids"]
return super(Parser, self).set_context(objects, data, ids, report_type)

def _get_data(self):
data = []
obj_data = self.pool.get(
"l10n_id.djbc_kb_lap_pengeluaran")
no = 1

criteria = [
("tgl_penerimaan", ">=", self.date_start),
("tgl_penerimaan", "<=", self.date_end),
("warehouse_id", "in", self.warehouse_ids)
]

data_ids = obj_data.search(self.cr, self.uid, criteria)

if data_ids:
for data_id in obj_data.browse(self.cr, self.uid, data_ids):
res = {
"no": no,
"jenis_dokumen": data_id.jenis_dokumen,
"no_dokumen": data_id.no_dokumen,
"tgl_dokumen": data_id.tgl_dokumen,
"no_penerimaan": data_id.no_penerimaan,
"tgl_penerimaan": data_id.tgl_penerimaan,
"pengirim": data_id.pengirim,
"kode_barang": data_id.kode_barang,
"nama_barang": data_id.nama_barang,
"jumlah": data_id.jumlah,
"satuan": data_id.satuan,
"nilai": data_id.nilai
}
data.append(res)
no += 1

return data
2 changes: 2 additions & 0 deletions l10n_id_djbc_kb_lap_pengeluaran/security/ir.model.access.csv
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_kb_lap_pengeluaran,all user l10n_id.djbc_kb_lap_pengeluaran,model_l10n_id_djbc_kb_lap_pengeluaran,,1,0,0,0
Loading
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_kb_lap_pengeluaran/wizards/__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 date_range_selector
22 changes: 22 additions & 0 deletions l10n_id_djbc_kb_lap_pengeluaran/wizards/date_range_selector.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import api, models


class KBLapPengeluaranWizard(models.TransientModel):
_name = "l10n_id.kb_lap_pengeluaran_wizard"
_inherit = ["l10n_id.date_range_selector"]

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

<openerp>
<data>
<record id="kb_lap_pengeluaran_wizard_view_form" model="ir.ui.view">
<field name="name">l10n_id.kb_lap_pengeluaran_wizard form</field>
<field name="model">l10n_id.kb_lap_pengeluaran_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="kb_lap_pengeluaran_wizard_action" model="ir.actions.act_window">
<field name="name">Pengeluaran Barang</field>
<field name="res_model">l10n_id.kb_lap_pengeluaran_wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="kb_lap_pengeluaran_wizard_view_form"/>
<field name="target">new</field>
</record>

<menuitem
id="kb_lap_pengeluaran_barang_menu"
name="Pengeluaran Barang"
parent="l10n_id_djbc_kb_lap_common.djbc_reporting_kb_menu"
action="kb_lap_pengeluaran_wizard_action"
sequence="5"
/>
</data>
</openerp>

0 comments on commit 2321709

Please sign in to comment.