Skip to content

Commit

Permalink
Merge PR #81 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by andhit-r
  • Loading branch information
ssi-bot committed May 6, 2024
2 parents a8b2489 + cfc734b commit fa3375e
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 1 deletion.
17 changes: 17 additions & 0 deletions ssi_l10n_id_taxform_faktur_pajak/models/faktur_pajak_keluaran.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,15 @@ class FakturPajakKeluaran(models.Model):
],
},
)
efaktur_mode = fields.Selection(
string="E-Faktur Mode",
selection=[
("header", "Header"),
("detail", "Detail"),
],
required=True,
default="header",
)
efaktur_kd_jenis_transaksi = fields.Char(
string="KD_JENIS_TRANSAKSI",
compute="_compute_efaktur_kd_jenis_transaksi",
Expand Down Expand Up @@ -661,6 +670,14 @@ def _compute_taxform_year(self):
if fp.taxform_period_id:
fp.taxform_year_id = fp.taxform_period_id.year_id.id

@api.onchange(
"type_id",
)
def onchange_efaktur_mode(self):
self.efaktur_mode = False
if self.type_id:
self.efaktur_mode = self.type_id.efaktur_mode

@api.onchange(
"type_id",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright 2023 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models
from odoo import api, fields, models


class FakturPajakKeluaranDetail(models.Model):
Expand All @@ -16,3 +16,92 @@ class FakturPajakKeluaranDetail(models.Model):
required=True,
ondelete="cascade",
)

@api.depends(
"name",
)
def _compute_efaktur_of_name(self):
for record in self:
result = "-"
if record.name:
result = record.name
record.efaktur_of_name = result

efaktur_of_name = fields.Char(
string="OF_NAMA",
compute="_compute_efaktur_of_name",
store=False,
compute_sudo=True,
)

@api.depends("price_unit")
def _compute_efaktur_of_harga_satuan(self):
for record in self:
record.efaktur_of_harga_satuan = str(record.price_unit)

efaktur_of_harga_satuan = fields.Char(
string="OF_HARGA_SATUAN",
compute="_compute_efaktur_of_harga_satuan",
store=False,
compute_sudo=True,
)

@api.depends("uom_quantity")
def _compute_efaktur_of_jumlah_barang(self):
for record in self:
record.efaktur_of_jumlah_barang = str(record.uom_quantity)

efaktur_of_jumlah_barang = fields.Char(
string="OF_JUMLAH_BARANG",
compute="_compute_efaktur_of_jumlah_barang",
store=False,
compute_sudo=True,
)

@api.depends("price_subtotal")
def _compute_efaktur_of_harga_total(self):
for record in self:
record.efaktur_of_harga_total = str(record.price_subtotal)

efaktur_of_harga_total = fields.Char(
string="OF_HARGA_TOTAL",
compute="_compute_efaktur_of_harga_total",
store=False,
compute_sudo=True,
)

@api.depends("price_subtotal")
def _compute_efaktur_of_diskon(self):
for record in self:
record.efaktur_of_diskon = 0

efaktur_of_diskon = fields.Char(
string="OF_DISKON",
compute="_compute_efaktur_of_diskon",
store=False,
compute_sudo=True,
)

@api.depends("price_subtotal")
def _compute_efaktur_of_dpp(self):
for record in self:
record.efaktur_of_dpp = str(record.price_subtotal)

efaktur_of_dpp = fields.Char(
string="OF_DPP",
compute="_compute_efaktur_of_dpp",
store=False,
compute_sudo=True,
)

@api.depends("price_tax")
def _compute_efaktur_of_ppn(self):
for record in self:
record.efaktur_of_ppn = str(int(record.price_tax))

efaktur_of_ppn = fields.Char(
string="OF_PPN",
compute="_compute_efaktur_of_ppn",
store=False,
compute_sudo=True,
)
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ class FakturPajakTransactionType(models.Model):
]
_description = "Type of Faktur Pajak Transaction"

efaktur_mode = fields.Selection(
string="E-Faktur Mode",
selection=[
("header", "Header"),
("detail", "Detail"),
],
required=True,
default="header",
)
fpk_journal_selection_method = fields.Selection(
default="domain",
selection=[("manual", "Manual"), ("domain", "Domain"), ("code", "Python Code")],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,51 @@
<field name="tax_ids" widget="many2many_tags" />
<field name="price_subtotal" string="Subtotal" />
</tree>
<form>
<group name="detail_form_1" colspan="4" col="2">
<group name="detail_form_1_1" colspan="1" col="2">
<field name="product_id" />
<field name="name" />
</group>
<group name="detail_form_1_2" colspan="1" col="2">
<label for="uom_quantity" />
<div>
<field name="uom_quantity" />
<field name="uom_id" />
</div>
<field name="price_unit" />
<field name="price_subtotal" />
<field name="tax_ids" widget="many2many_tag" />
<field name="price_tax" />
<field name="price_total" />
</group>
</group>
<notebook>
<page name="ol" string="OL">
<group name="ol_1" colspan="4" col="2">
<field name="efaktur_of_name" string="NAME" />
<field
name="efaktur_of_harga_satuan"
string="HARGA_SATUAN"
/>
<field
name="efaktur_of_jumlah_barang"
string="HARGA_SATUAN"
/>
<field
name="efaktur_of_harga_total"
string="HARGA_TOTAL"
/>
<field
name="efaktur_of_diskon"
string="DISKON"
/>
<field name="efaktur_of_dpp" string="DPP" />
<field name="efaktur_of_ppn" string="PPN" />
</group>
</page>
</notebook>
</form>
</field>
<field name="tax_ids">
<tree editable="top">
Expand Down Expand Up @@ -202,6 +247,9 @@
</group>
</page>
<page name="efaktur" string="E-Faktur">
<group name="efaktur_2" colspan="4" col="2">
<field name="efaktur_mode" />
</group>
<group name="efaktur_1" string="FK" colspan="4" col="2">
<field name="efaktur_kd_jenis_transaksi" />
<field name="efaktur_fg_pengganti" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<data>
<xpath expr="//field[@name='active']" position="after">
<field name="tax_id" />
<field name="efaktur_mode" />
</xpath>
<xpath expr="//page[1]" position="before">
<page name="fpk" string="Faktur Pajak Keluaran">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def _create_fpk(self):
"enofa_number_id": self._get_enofa_number().id,
"tax_id": self.type_id.tax_id.id,
"move_ids": [(6, 0, [am.id])],
"efaktur_mode": self.type_id.efaktur_mode,
}
fpk = FPK.create(data)
fpk.action_reload_detail()
Expand Down

0 comments on commit fa3375e

Please sign in to comment.