diff --git a/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/__openerp__.py b/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/__openerp__.py
index 7115453..65995cc 100644
--- a/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/__openerp__.py
+++ b/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/__openerp__.py
@@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Indonesia - Laporan Pemakaian Bahan Baku for KITE",
- "version": "8.0.1.1.0",
+ "version": "8.0.1.2.0",
"category": "localization",
"website": "https://opensynergy-indonesia.com",
"author": "OpenSynergy Indonesia",
diff --git a/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/data/djbc_kite_movement_type_data.xml b/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/data/djbc_kite_movement_type_data.xml
index a8219e1..5bc60c3 100644
--- a/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/data/djbc_kite_movement_type_data.xml
+++ b/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/data/djbc_kite_movement_type_data.xml
@@ -9,5 +9,10 @@
KITE-PMKBB
+
+ Pemakaian Bahan Baku Subkontrak
+ KITE-PMKBB-SUB
+
+
diff --git a/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/reports/__init__.py b/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/reports/__init__.py
index 4235d52..4b534cf 100644
--- a/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/reports/__init__.py
+++ b/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/reports/__init__.py
@@ -2,4 +2,8 @@
# Copyright 2019 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-from . import djbc_kite_lap_pemakaian_bahan_baku
+from . import (
+ djbc_kite_lap_pemakaian_bahan_baku,
+ djbc_kite_lap_pemakaian_bahan_baku_subkon,
+ djbc_kite_lap_pemakaian_bahan_baku_union,
+)
diff --git a/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/reports/djbc_kite_lap_pemakaian_bahan_baku.py b/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/reports/djbc_kite_lap_pemakaian_bahan_baku.py
index f82c576..eadccd1 100644
--- a/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/reports/djbc_kite_lap_pemakaian_bahan_baku.py
+++ b/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/reports/djbc_kite_lap_pemakaian_bahan_baku.py
@@ -66,17 +66,9 @@ def _select(self):
c.name AS nama_barang,
b.default_code AS kode_barang,
a.product_uom AS satuan,
- CASE
- WHEN e.partner_id IS NULL
- THEN a.product_uom_qty
- ELSE 0.0
- END AS jumlah_digunakan,
- CASE
- WHEN e.partner_id IS NOT NULL
- THEN a.product_uom_qty
- ELSE 0.0
- END AS jumlah_disubkontrakkan,
- e.partner_id AS penerima_subkontrak,
+ a.product_uom_qty AS jumlah_digunakan,
+ 0.0 AS jumlah_disubkontrakkan,
+ 0 AS penerima_subkontrak,
d.warehouse_id AS gudang
"""
return select_str
diff --git a/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/reports/djbc_kite_lap_pemakaian_bahan_baku.xml b/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/reports/djbc_kite_lap_pemakaian_bahan_baku.xml
index 2cc6114..f2e6c84 100644
--- a/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/reports/djbc_kite_lap_pemakaian_bahan_baku.xml
+++ b/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/reports/djbc_kite_lap_pemakaian_bahan_baku.xml
@@ -4,9 +4,9 @@
-
- l10n_id.lap_kite_pemakaian_bahan_baku.tree
- l10n_id.lap_kite_pemakaian_bahan_baku
+
+ l10n_id.lap_kite_pemakaian_bahan_baku_union.tree
+ l10n_id.lap_kite_pemakaian_bahan_baku_union
@@ -21,9 +21,9 @@
-
- l10n_id.lap_kite_pemakaian_bahan_baku.search
- l10n_id.lap_kite_pemakaian_bahan_baku
+
+ l10n_id.lap_kite_pemakaian_bahan_baku_union.search
+ l10n_id.lap_kite_pemakaian_bahan_baku_union
@@ -31,6 +31,8 @@
+
+
@@ -45,14 +47,14 @@
-
+
Lap. Pemakaian Bahan Baku
ir.actions.act_window
- l10n_id.lap_kite_pemakaian_bahan_baku
+ l10n_id.lap_kite_pemakaian_bahan_baku_union
form
tree
-
-
+
+
current
diff --git a/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/reports/djbc_kite_lap_pemakaian_bahan_baku_subkon.py b/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/reports/djbc_kite_lap_pemakaian_bahan_baku_subkon.py
new file mode 100644
index 0000000..56f1423
--- /dev/null
+++ b/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/reports/djbc_kite_lap_pemakaian_bahan_baku_subkon.py
@@ -0,0 +1,137 @@
+# -*- coding: utf-8 -*-
+# Copyright 2017 OpenSynergy Indonesia
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from openerp import models, fields
+from openerp import tools
+
+
+class LapKitePemakaianBahanBakuSubkon(models.Model):
+ _name = "l10n_id.lap_kite_pemakaian_bahan_baku_subkon"
+ _description = "Laporan Pemakaian Bahan Baku Subkontrak KITE"
+ _auto = False
+
+ no_pengeluaran = fields.Many2one(
+ string="Nomor Pengeluaran",
+ comodel_name="stock.picking",
+ )
+ tgl_pengeluaran = fields.Datetime(
+ string="Tanggal Pengeluaran",
+ )
+ kode_barang = fields.Char(
+ string="Kode Barang",
+ )
+ nama_barang = fields.Char(
+ string="Nama Barang",
+ )
+ satuan = fields.Many2one(
+ string="Satuan",
+ comodel_name="product.uom",
+ )
+ jumlah_digunakan = fields.Float(
+ string="Jumlah Digunakan",
+ )
+ jumlah_disubkontrakkan = fields.Float(
+ string="Jumlah Disubkontrakan",
+ )
+ penerima_subkontrak = fields.Many2one(
+ string="Penerima Subkontrak",
+ comodel_name="res.partner",
+ )
+ gudang = fields.Many2one(
+ string="Gudang",
+ comodel_name="stock.warehouse"
+ )
+
+ def _get_movement_type(self, cr):
+ query = """
+ SELECT res_id
+ FROM ir_model_data
+ WHERE
+ module = 'l10n_id_djbc_kite_lap_pemakaian_bahan_baku' AND
+ name = 'djbc_kite_movement_type_pemakaian_bahan_baku_subkontrak'
+ """
+ cr.execute(query)
+ movement_type = cr.fetchone()
+ if movement_type:
+ return movement_type
+ else:
+ return 0
+
+ def _select(self):
+ select_str = """
+ SELECT a.id as id,
+ a.picking_id AS no_pengeluaran,
+ a.date AS tgl_pengeluaran,
+ c.name AS nama_barang,
+ b.default_code AS kode_barang,
+ a.product_uom AS satuan,
+ 0.0 AS jumlah_digunakan,
+ a.product_uom_qty AS jumlah_disubkontrakkan,
+ e.partner_id AS penerima_subkontrak,
+ d.warehouse_id AS gudang
+ """
+ return select_str
+
+ def _from(self):
+ from_str = """
+ FROM stock_move AS a
+ """
+ return from_str
+
+ def _join(self):
+ join_str = """
+ JOIN product_product AS b ON a.product_id = b.id
+ JOIN product_template AS c ON b.product_tmpl_id = c.id
+ JOIN stock_picking_type AS d ON a.picking_type_id = d.id
+ LEFT JOIN stock_picking AS e ON a.picking_id = e.id
+ JOIN product_categ_rel AS f ON
+ c.id = f.product_id
+ JOIN product_category AS g ON
+ f.categ_id = g.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 h ON
+ g.id = h.res_id
+ """
+ return join_str
+
+ def _where(self, movement_type_id):
+ where_str = """
+ WHERE
+ a.state = 'done' AND
+ a.djbc_custom IS TRUE AND
+ d.djbc_kite_scrap IS FALSE AND
+ d.djbc_kite_movement_type_id=%s
+ """ % (movement_type_id)
+ return where_str
+
+ def _order_by(self):
+ join_str = """
+ ORDER BY a.date, a.id
+ """
+ return join_str
+
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, self._table)
+ # pylint: disable=locally-disabled, sql-injection
+ movement_type_id =\
+ self._get_movement_type(cr)
+ cr.execute("""CREATE or REPLACE VIEW %s as (
+ %s
+ %s
+ %s
+ %s
+ %s
+ )""" % (
+ self._table,
+ self._select(),
+ self._from(),
+ self._join(),
+ self._where(movement_type_id),
+ self._order_by()
+ ))
diff --git a/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/reports/djbc_kite_lap_pemakaian_bahan_baku_union.py b/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/reports/djbc_kite_lap_pemakaian_bahan_baku_union.py
new file mode 100644
index 0000000..e201a83
--- /dev/null
+++ b/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/reports/djbc_kite_lap_pemakaian_bahan_baku_union.py
@@ -0,0 +1,105 @@
+# -*- coding: utf-8 -*-
+# Copyright 2017 OpenSynergy Indonesia
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from openerp import models, fields
+from openerp import tools
+
+
+class LapKitePemakaianBahanBakuUnion(models.Model):
+ _name = "l10n_id.lap_kite_pemakaian_bahan_baku_union"
+ _description = "Laporan Pemakaian Bahan Baku Union KITE"
+ _auto = False
+
+ no_pengeluaran = fields.Many2one(
+ string="Nomor Pengeluaran",
+ comodel_name="stock.picking",
+ )
+ tgl_pengeluaran = fields.Datetime(
+ string="Tanggal Pengeluaran",
+ )
+ kode_barang = fields.Char(
+ string="Kode Barang",
+ )
+ nama_barang = fields.Char(
+ string="Nama Barang",
+ )
+ satuan = fields.Many2one(
+ string="Satuan",
+ comodel_name="product.uom",
+ )
+ jumlah_digunakan = fields.Float(
+ string="Jumlah Digunakan",
+ )
+ jumlah_disubkontrakkan = fields.Float(
+ string="Jumlah Disubkontrakan",
+ )
+ penerima_subkontrak = fields.Many2one(
+ string="Penerima Subkontrak",
+ comodel_name="res.partner",
+ )
+ gudang = fields.Many2one(
+ string="Gudang",
+ comodel_name="stock.warehouse"
+ )
+
+ # Object: l10n_id.lap_kite_pemakaian_bahan_baku
+ def _select_1(self):
+ select_str = """
+ SELECT id,
+ no_pengeluaran,
+ tgl_pengeluaran,
+ nama_barang,
+ kode_barang,
+ satuan,
+ jumlah_digunakan,
+ jumlah_disubkontrakkan,
+ penerima_subkontrak,
+ gudang
+ """
+ return select_str
+
+ def _from_1(self):
+ from_str = """
+ FROM l10n_id_lap_kite_pemakaian_bahan_baku
+ """
+ return from_str
+
+ # Object: l10n_id.lap_kite_pemakaian_bahan_baku_subkon
+ def _select_2(self):
+ select_str = """
+ SELECT id,
+ no_pengeluaran,
+ tgl_pengeluaran,
+ nama_barang,
+ kode_barang,
+ satuan,
+ jumlah_digunakan,
+ jumlah_disubkontrakkan,
+ penerima_subkontrak,
+ gudang
+ """
+ return select_str
+
+ def _from_2(self):
+ from_str = """
+ FROM l10n_id_lap_kite_pemakaian_bahan_baku_subkon
+ """
+ return from_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
+ UNION
+ %s
+ %s
+ )""" % (
+ self._table,
+ self._select_1(),
+ self._from_1(),
+ self._select_2(),
+ self._from_2(),
+ ))
diff --git a/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/security/ir.model.access.csv b/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/security/ir.model.access.csv
index 42d9f82..7ba011e 100644
--- a/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/security/ir.model.access.csv
+++ b/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/security/ir.model.access.csv
@@ -1,2 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_all_djbc_lap_kite_pemakaian_bahan_baku,all user l10n_id.lap_kite_pemakaian_bahan_baku,model_l10n_id_lap_kite_pemakaian_bahan_baku,,1,0,0,0
+access_all_djbc_lap_kite_pemakaian_bahan_baku_subkon,all user l10n_id.lap_kite_pemakaian_bahan_baku_subkon,model_l10n_id_lap_kite_pemakaian_bahan_baku_subkon,,1,0,0,0
+access_all_djbc_lap_kite_pemakaian_bahan_baku_union,all user l10n_id.lap_kite_pemakaian_bahan_baku_union,model_l10n_id_lap_kite_pemakaian_bahan_baku_union,,1,0,0,0
diff --git a/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/wizards/date_range_selector.py b/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/wizards/date_range_selector.py
index ad56712..5cd6299 100644
--- a/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/wizards/date_range_selector.py
+++ b/l10n_id_djbc_kite_lap_pemakaian_bahan_baku/wizards/date_range_selector.py
@@ -23,7 +23,7 @@ class KitePemakaianBahanBakuWizard(models.TransientModel):
def action_print_sreen(self):
waction = self.env.ref(
"l10n_id_djbc_kite_lap_pemakaian_bahan_baku."
- "lap_kite_pemakaian_bahan_baku_action")
+ "lap_kite_pemakaian_bahan_baku_union_action")
criteria = [
("tgl_pengeluaran", ">=", self.date_start),
("tgl_pengeluaran", "<=", self.date_end),
diff --git a/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/__openerp__.py b/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/__openerp__.py
index a90a832..0cf8edc 100644
--- a/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/__openerp__.py
+++ b/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/__openerp__.py
@@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Indonesia - Laporan Pemasukan Hasil Produksi for KITE",
- "version": "8.0.1.1.0",
+ "version": "8.0.1.2.0",
"category": "localization",
"website": "https://opensynergy-indonesia.com",
"author": "OpenSynergy Indonesia",
diff --git a/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/data/djbc_kite_movement_type_data.xml b/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/data/djbc_kite_movement_type_data.xml
index bd629d4..17e307c 100644
--- a/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/data/djbc_kite_movement_type_data.xml
+++ b/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/data/djbc_kite_movement_type_data.xml
@@ -9,5 +9,10 @@
KITE-PMHP
+
+ Pemasukan Hasil Produksi Subkontrak
+ KITE-PMHP-SUB
+
+
diff --git a/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/reports/__init__.py b/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/reports/__init__.py
index 629f012..8bbfc50 100644
--- a/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/reports/__init__.py
+++ b/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/reports/__init__.py
@@ -2,4 +2,8 @@
# Copyright 2019 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-from . import djbc_kite_lap_pemasukan_hasil_produksi
+from . import (
+ djbc_kite_lap_pemasukan_hasil_produksi,
+ djbc_kite_lap_pemasukan_hasil_produksi_subkon,
+ djbc_kite_lap_pemasukan_hasil_produksi_union,
+)
diff --git a/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/reports/djbc_kite_lap_pemasukan_hasil_produksi.py b/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/reports/djbc_kite_lap_pemasukan_hasil_produksi.py
index 252f245..d75b007 100644
--- a/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/reports/djbc_kite_lap_pemasukan_hasil_produksi.py
+++ b/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/reports/djbc_kite_lap_pemasukan_hasil_produksi.py
@@ -62,16 +62,8 @@ def _select(self):
c.name AS nama_barang,
b.default_code AS kode_barang,
a.product_uom AS satuan,
- CASE
- WHEN e.partner_id IS NULL
- THEN a.product_uom_qty
- ELSE 0.0
- END AS jumlah_produksi,
- CASE
- WHEN e.partner_id IS NOT NULL
- THEN a.product_uom_qty
- ELSE 0.0
- END AS jumlah_disubkontrakkan,
+ a.product_uom_qty AS jumlah_produksi,
+ 0.0 AS jumlah_disubkontrakkan,
d.warehouse_id AS gudang
"""
return select_str
diff --git a/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/reports/djbc_kite_lap_pemasukan_hasil_produksi.xml b/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/reports/djbc_kite_lap_pemasukan_hasil_produksi.xml
index ecae981..79b0e8c 100644
--- a/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/reports/djbc_kite_lap_pemasukan_hasil_produksi.xml
+++ b/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/reports/djbc_kite_lap_pemasukan_hasil_produksi.xml
@@ -4,9 +4,9 @@
-
- l10n_id.lap_kite_pemasukan_hasil_produksi.tree
- l10n_id.lap_kite_pemasukan_hasil_produksi
+
+ l10n_id.lap_kite_pemasukan_hasil_produksi_union.tree
+ l10n_id.lap_kite_pemasukan_hasil_produksi_union
@@ -20,9 +20,9 @@
-
- l10n_id.lap_kite_pemasukan_hasil_produksi.search
- l10n_id.lap_kite_pemasukan_hasil_produksi
+
+ l10n_id.lap_kite_pemasukan_hasil_produksi_union.search
+ l10n_id.lap_kite_pemasukan_hasil_produksi_union
@@ -41,14 +41,14 @@
-
- Lap. Pemasukan Bahan Baku
+
+ Lap. Pemasukan Hasil Produksi
ir.actions.act_window
- l10n_id.lap_kite_pemasukan_hasil_produksi
+ l10n_id.lap_kite_pemasukan_hasil_produksi_union
form
tree
-
-
+
+
current
diff --git a/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/reports/djbc_kite_lap_pemasukan_hasil_produksi_subkon.py b/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/reports/djbc_kite_lap_pemasukan_hasil_produksi_subkon.py
new file mode 100644
index 0000000..a287880
--- /dev/null
+++ b/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/reports/djbc_kite_lap_pemasukan_hasil_produksi_subkon.py
@@ -0,0 +1,132 @@
+# -*- 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 LapKitePemasukanHasilProduksiSubkon(models.Model):
+ _name = "l10n_id.lap_kite_pemasukan_hasil_produksi_subkon"
+ _description = "Laporan Pemasukan Hasil Produksi Subkontrak KITE"
+ _auto = False
+
+ no_penerimaan = fields.Many2one(
+ string="Nomor Penerimaan",
+ comodel_name="stock.picking",
+ )
+ tgl_penerimaan = fields.Datetime(
+ string="Tanggal Penerimaan",
+ )
+ kode_barang = fields.Char(
+ string="Kode Barang",
+ )
+ nama_barang = fields.Char(
+ string="Nama Barang",
+ )
+ satuan = fields.Many2one(
+ string="Satuan",
+ comodel_name="product.uom",
+ )
+ jumlah_produksi = fields.Float(
+ string="Jumlah Dari Produksi",
+ )
+ jumlah_disubkontrakkan = fields.Float(
+ string="Jumlah Disubkontrakan",
+ )
+ gudang = fields.Many2one(
+ string="Gudang",
+ comodel_name="stock.warehouse"
+ )
+
+ def _get_movement_type(self, cr):
+ query = """
+ SELECT res_id
+ FROM ir_model_data
+ WHERE
+ module = 'l10n_id_djbc_kite_lap_pemasukan_hasil_produksi' AND
+ name = 'djbc_kite_movement_type_pemasukan_hasil_produksi_subkon'
+ """
+ cr.execute(query)
+ movement_type = cr.fetchone()
+ if movement_type:
+ return movement_type
+ else:
+ return 0
+
+ def _select(self):
+ select_str = """
+ SELECT a.id as id,
+ a.picking_id AS no_penerimaan,
+ a.date AS tgl_penerimaan,
+ c.name AS nama_barang,
+ b.default_code AS kode_barang,
+ a.product_uom AS satuan,
+ 0.0 AS jumlah_produksi,
+ a.product_uom_qty AS jumlah_disubkontrakkan,
+ d.warehouse_id AS gudang
+ """
+ return select_str
+
+ def _from(self):
+ from_str = """
+ FROM stock_move AS a
+ """
+ return from_str
+
+ def _where(self, movement_type_id):
+ where_str = """
+ WHERE
+ a.state = 'done' AND
+ a.djbc_custom IS TRUE AND
+ d.djbc_kite_scrap IS FALSE AND
+ d.djbc_kite_movement_type_id=%s
+ """ % (movement_type_id)
+ return where_str
+
+ def _join(self):
+ join_str = """
+ JOIN product_product AS b ON a.product_id = b.id
+ JOIN product_template AS c ON b.product_tmpl_id = c.id
+ JOIN stock_picking_type AS d ON a.picking_type_id = d.id
+ LEFT JOIN stock_picking AS e ON a.picking_id = e.id
+ JOIN product_categ_rel AS f ON
+ c.id = f.product_id
+ JOIN product_category AS g ON
+ f.categ_id = g.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_hasil_produksi')
+ ) as h ON
+ g.id = h.res_id
+ """
+ return join_str
+
+ def _order_by(self):
+ join_str = """
+ ORDER BY a.date, a.id
+ """
+ return join_str
+
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, self._table)
+ # pylint: disable=locally-disabled, sql-injection
+ movement_type_id =\
+ self._get_movement_type(cr)
+ cr.execute("""CREATE or REPLACE VIEW %s as (
+ %s
+ %s
+ %s
+ %s
+ %s
+ )""" % (
+ self._table,
+ self._select(),
+ self._from(),
+ self._join(),
+ self._where(movement_type_id),
+ self._order_by(),
+ ))
diff --git a/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/reports/djbc_kite_lap_pemasukan_hasil_produksi_union.py b/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/reports/djbc_kite_lap_pemasukan_hasil_produksi_union.py
new file mode 100644
index 0000000..ad03286
--- /dev/null
+++ b/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/reports/djbc_kite_lap_pemasukan_hasil_produksi_union.py
@@ -0,0 +1,99 @@
+# -*- coding: utf-8 -*-
+# Copyright 2017 OpenSynergy Indonesia
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from openerp import models, fields
+from openerp import tools
+
+
+class LapKitePemasukanHasilProduksiUnion(models.Model):
+ _name = "l10n_id.lap_kite_pemasukan_hasil_produksi_union"
+ _description = "Laporan Pemasukan Hasil Produksi Union KITE"
+ _auto = False
+
+ no_penerimaan = fields.Many2one(
+ string="Nomor Penerimaan",
+ comodel_name="stock.picking",
+ )
+ tgl_penerimaan = fields.Datetime(
+ string="Tanggal Penerimaan",
+ )
+ kode_barang = fields.Char(
+ string="Kode Barang",
+ )
+ nama_barang = fields.Char(
+ string="Nama Barang",
+ )
+ satuan = fields.Many2one(
+ string="Satuan",
+ comodel_name="product.uom",
+ )
+ jumlah_produksi = fields.Float(
+ string="Jumlah Dari Produksi",
+ )
+ jumlah_disubkontrakkan = fields.Float(
+ string="Jumlah Disubkontrakan",
+ )
+ gudang = fields.Many2one(
+ string="Gudang",
+ comodel_name="stock.warehouse"
+ )
+
+ # Object: l10n_id.lap_kite_pemasukan_hasil_produksi
+ def _select_1(self):
+ select_str = """
+ SELECT id,
+ no_penerimaan,
+ tgl_penerimaan,
+ nama_barang,
+ kode_barang,
+ satuan,
+ jumlah_produksi,
+ jumlah_disubkontrakkan,
+ gudang
+ """
+ return select_str
+
+ def _from_1(self):
+ from_str = """
+ FROM l10n_id_lap_kite_pemasukan_hasil_produksi
+ """
+ return from_str
+
+ # Object: l10n_id.lap_kite_pemasukan_hasil_produksi_subkon
+ def _select_2(self):
+ select_str = """
+ SELECT id,
+ no_penerimaan,
+ tgl_penerimaan,
+ nama_barang,
+ kode_barang,
+ satuan,
+ jumlah_produksi,
+ jumlah_disubkontrakkan,
+ gudang
+ """
+ return select_str
+
+ def _from_2(self):
+ from_str = """
+ FROM l10n_id_lap_kite_pemasukan_hasil_produksi_subkon
+ """
+ return from_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
+ UNION
+ %s
+ %s
+ )""" % (
+ self._table,
+ self._select_1(),
+ self._from_1(),
+ self._select_2(),
+ self._from_2(),
+ ))
diff --git a/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/security/ir.model.access.csv b/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/security/ir.model.access.csv
index a00ae33..9842fb6 100644
--- a/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/security/ir.model.access.csv
+++ b/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/security/ir.model.access.csv
@@ -1,2 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_all_djbc_lap_kite_pemasukan_hasil_produksi,all user l10n_id.lap_kite_pemasukan_hasil_produksi,model_l10n_id_lap_kite_pemasukan_hasil_produksi,,1,0,0,0
+access_all_djbc_lap_kite_pemasukan_hasil_produksi_subkon,all user l10n_id.lap_kite_pemasukan_hasil_produksi_subkon,model_l10n_id_lap_kite_pemasukan_hasil_produksi_subkon,,1,0,0,0
+access_all_djbc_lap_kite_pemasukan_hasil_produksi_union,all user l10n_id.lap_kite_pemasukan_hasil_produksi_union,model_l10n_id_lap_kite_pemasukan_hasil_produksi_union,,1,0,0,0
diff --git a/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/wizards/date_range_selector.py b/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/wizards/date_range_selector.py
index 4fa2492..30b3183 100644
--- a/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/wizards/date_range_selector.py
+++ b/l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/wizards/date_range_selector.py
@@ -23,7 +23,7 @@ class KitePemasukanHasilProduksiWizard(models.TransientModel):
def action_print_sreen(self):
waction = self.env.ref(
"l10n_id_djbc_kite_lap_pemasukan_hasil_produksi."
- "lap_kite_pemasukan_hasil_produksi_action")
+ "lap_kite_pemasukan_hasil_produksi_union_action")
criteria = [
("tgl_penerimaan", ">=", self.date_start),
("tgl_penerimaan", "<=", self.date_end),