Skip to content

Commit

Permalink
Merge 1b374d8 into fbedb92
Browse files Browse the repository at this point in the history
  • Loading branch information
mikevhe18 committed Oct 26, 2018
2 parents fbedb92 + 1b374d8 commit fb0df34
Show file tree
Hide file tree
Showing 19 changed files with 481 additions and 0 deletions.
49 changes: 49 additions & 0 deletions l10n_id_djbc_plb_common/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 - Common Feature for 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 - Common Feature for 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.
5 changes: 5 additions & 0 deletions l10n_id_djbc_plb_common/__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 models
20 changes: 20 additions & 0 deletions l10n_id_djbc_plb_common/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# pylint: disable=locally-disabled, manifest-required-author
{
"name": "Indonesia - Common Feature for Pusat Logistik Berikat",
"version": "8.0.1.4.3",
"category": "localization",
"website": "https://opensynergy-indonesia.com",
"author": "OpenSynergy Indonesia",
"license": "AGPL-3",
"installable": True,
"depends": [
"l10n_id_djbc_app"
],
"data": [
"menu.xml",
"views/stock_picking_type_views.xml"
],
}
11 changes: 11 additions & 0 deletions l10n_id_djbc_plb_common/menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<menuitem
id="djbc_reporting_plb_menu"
name="Pusat Logistik Berikat"
sequence="1"
parent="l10n_id_djbc_app.djbc_reporting_menu"
/>
</data>
</openerp>
5 changes: 5 additions & 0 deletions l10n_id_djbc_plb_common/models/__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 stock_picking_type
25 changes: 25 additions & 0 deletions l10n_id_djbc_plb_common/models/stock_picking_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import models, fields


class StockPickingType(models.Model):
_inherit = "stock.picking.type"

djbc_plb_movement_type = fields.Selection(
string="DJBC's PLB Movement Type",
selection=[
("in", "In"),
("out", "Out"),
],
)
djbc_plb_scrap = fields.Boolean(
string="DJBC's PLB Scrap?",
default=False,
)
djbc_plb_adjustment = fields.Boolean(
string="DJBC's PLB Adjustment?",
default=False,
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions l10n_id_djbc_plb_common/views/stock_picking_type_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="stock_picking_type_view_form" model="ir.ui.view">
<field name="name">stock.picking.type Form PLB</field>
<field name="model">stock.picking.type</field>
<field name="inherit_id" ref="stock.view_picking_type_form"/>
<field name="arch" type="xml">
<xpath expr="//group[last()]" position="after">
<group name="djbc_plb" colspan="4" col="2" string="DJBC's PLB Configuration">
<field name="djbc_plb_movement_type"/>
<field name="djbc_plb_scrap"/>
<field name="djbc_plb_adjustment"/>
</group>
</xpath>
</field>
</record>
</data>
</openerp>
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()
))
Loading

0 comments on commit fb0df34

Please sign in to comment.