Skip to content

Commit

Permalink
[8.0.1.0.0][l10n_id_djbc_plb_lap_pemasukan]
Browse files Browse the repository at this point in the history
  • Loading branch information
mikevhe18 committed Oct 24, 2018
1 parent b1d77ff commit b1cddda
Show file tree
Hide file tree
Showing 11 changed files with 347 additions and 0 deletions.
49 changes: 49 additions & 0 deletions l10n_id_djbc_plb_lap_pemasukan/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. Pemasukan for DJBC's Pusat Logistik Berikat
============================================================



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. Pemasukan for DJBC's Pusat Logistik Berikat*
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_plb_lap_pemasukan/__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_plb_lap_pemasukan/__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. Pemasukan for DJBC's "
"Pusat Logistik Berikat",
"version": "8.0.1.2.1",
"category": "localization",
"website": "https://opensynergy-indonesia.com",
"author": "OpenSynergy Indonesia",
"license": "AGPL-3",
"installable": True,
"depends": [
"l10n_id_djbc_plb_common"
],
"data": [
"security/ir.model.access.csv",
"wizards/date_range_selector_views.xml",
"reports/lap_plb_lap_pemasukan.xml"
],
}
5 changes: 5 additions & 0 deletions l10n_id_djbc_plb_lap_pemasukan/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_plb_lap_pemasukan
131 changes: 131 additions & 0 deletions l10n_id_djbc_plb_lap_pemasukan/reports/lap_plb_lap_pemasukan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# -*- 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 LapPlbLapPemasukan(models.Model):
_name = "l10n_id.djbc_plb_lap_pemasukan"
_description = "Laporan Pemasukan Barang Untuk Pusat Logistik 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_plb_movement_type='in' AND
E.djbc_plb_scrap IS FALSE AND
E.djbc_plb_adjustment IS FALSE
"""
return where_str

def _join(self):
join_str = """
LEFT 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)
# pylint: disable=locally-disabled, sql-injection
cr.execute("""CREATE or REPLACE VIEW %s as (
%s
%s
%s
%s
)""" % (
self._table,
self._select(),
self._from(),
self._join(),
self._where()
))
63 changes: 63 additions & 0 deletions l10n_id_djbc_plb_lap_pemasukan/reports/lap_plb_lap_pemasukan.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?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_plb_lap_pemasukan_common_view_tree" model="ir.ui.view">
<field name="name">l10n_id.djbc_plb_lap_mutasi_common Tree</field>
<field name="model">l10n_id.djbc_plb_lap_pemasukan</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_plb_lap_pemasukan_common_view_search" model="ir.ui.view">
<field name="name">l10n_id.djbc_plb_lap_pemasukan Tree</field>
<field name="model">l10n_id.djbc_plb_lap_pemasukan</field>
<field name="arch" type="xml">
<search>
<field name="jenis_dokumen"/>
<field name="no_dokumen"/>
<field name="no_penerimaan"/>
<field name="pengirim"/>
<field name="kode_barang"/>
<field name="nama_barang"/>
<field name="warehouse_id"/>
<group string="Group By">
<filter name="grp_jenis_dokumen" string="Jenis Dokumen" context="{'group_by':'jenis_dokumen'}"/>
<filter name="grp_no_dokumen" string="No. Dokumen" context="{'group_by':'no_dokumen'}"/>
<filter name="grp_no_penerimaan" string="No. Penerimaan" context="{'group_by':'no_penerimaan'}"/>
<filter name="grp_pengirim" string="Pengirim" context="{'group_by':'pengirim'}"/>
<filter name="grp_warehouse_id" string="Warehouse" context="{'group_by':'warehouse_id'}"/>
</group>
</search>
</field>
</record>

<record id="djbc_plb_lap_pemasukan_action" model="ir.actions.act_window">
<field name="name">Lap. Pemasukan Barang</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">l10n_id.djbc_plb_lap_pemasukan</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
<field name="view_id" ref="djbc_plb_lap_pemasukan_common_view_tree"/>
<field name="search_view_id" ref="djbc_plb_lap_pemasukan_common_view_search"/>
<field name="target">current</field>
</record>

</data>
</openerp>
2 changes: 2 additions & 0 deletions l10n_id_djbc_plb_lap_pemasukan/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_plb_lap_pemasukan,all user l10n_id.djbc_plb_lap_pemasukan,model_l10n_id_djbc_plb_lap_pemasukan,,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_plb_lap_pemasukan/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
30 changes: 30 additions & 0 deletions l10n_id_djbc_plb_lap_pemasukan/wizards/date_range_selector.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- 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 PLBLapPemasukanWizard(models.TransientModel):
_name = "l10n_id.plb_lap_pemasukan_wizard"
_inherit = ["l10n_id.date_range_selector"]

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

@api.multi
def action_print_sreen(self):
waction = self.env.ref(
"l10n_id_djbc_plb_lap_pemasukan.djbc_plb_lap_pemasukan_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="plb_lap_pemasukan_wizard_view_form" model="ir.ui.view">
<field name="name">l10n_id.plb_lap_pemasukan_wizard form</field>
<field name="model">l10n_id.plb_lap_pemasukan_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="plb_lap_pemasukan_wizard_action" model="ir.actions.act_window">
<field name="name">Pemasukan Barang</field>
<field name="res_model">l10n_id.plb_lap_pemasukan_wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="plb_lap_pemasukan_wizard_view_form"/>
<field name="target">new</field>
</record>

<menuitem
id="plb_lap_pemasukan_barang_menu"
name="Pemasukan Barang"
parent="l10n_id_djbc_plb_common.djbc_reporting_plb_menu"
action="plb_lap_pemasukan_wizard_action"
sequence="5"
/>
</data>
</openerp>

0 comments on commit b1cddda

Please sign in to comment.