-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.0.1.2.0][l10n_id_djbc_kite_lap_pemasukan_hasil_produksi]
- Loading branch information
Showing
9 changed files
with
258 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
132 changes: 132 additions & 0 deletions
132
...ite_lap_pemasukan_hasil_produksi/reports/djbc_kite_lap_pemasukan_hasil_produksi_subkon.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(), | ||
)) |
99 changes: 99 additions & 0 deletions
99
...kite_lap_pemasukan_hasil_produksi/reports/djbc_kite_lap_pemasukan_hasil_produksi_union.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(), | ||
)) |
2 changes: 2 additions & 0 deletions
2
l10n_id_djbc_kite_lap_pemasukan_hasil_produksi/security/ir.model.access.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters