summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMqdd <ahmadmiqdad27@gmail.com>2025-11-25 08:59:41 +0700
committerMqdd <ahmadmiqdad27@gmail.com>2025-11-25 08:59:41 +0700
commit1e10f5149dcd753018b919aa9fac5e54c81a533c (patch)
tree4e561a147c6250b7d4eb41bb8bce500eee0014bd
parentbb2be920076aabc49b4f9fdd896d14e096e633eb (diff)
parent61aabd2a7be015a19d9a16d8e160f5a3c3c6efaf (diff)
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into locator_mqddlocator_mqdd
merge
-rw-r--r--indoteknik_custom/models/account_move_due_extension.py6
-rw-r--r--indoteknik_custom/models/advance_payment_request.py8
-rw-r--r--indoteknik_custom/models/coretax_fatur.py10
-rw-r--r--indoteknik_custom/models/partial_delivery.py20
-rw-r--r--indoteknik_custom/models/refund_sale_order.py48
-rw-r--r--indoteknik_custom/models/stock_picking_return.py15
-rw-r--r--indoteknik_custom/models/tukar_guling.py20
-rw-r--r--indoteknik_custom/report/purchase_report.xml17
-rw-r--r--indoteknik_custom/views/account_move_line.xml3
-rw-r--r--indoteknik_custom/views/account_move_views.xml2
-rw-r--r--indoteknik_custom/views/advance_payment_request.xml1
-rw-r--r--indoteknik_custom/views/advance_payment_settlement.xml1
12 files changed, 94 insertions, 57 deletions
diff --git a/indoteknik_custom/models/account_move_due_extension.py b/indoteknik_custom/models/account_move_due_extension.py
index 352200e0..828be824 100644
--- a/indoteknik_custom/models/account_move_due_extension.py
+++ b/indoteknik_custom/models/account_move_due_extension.py
@@ -129,7 +129,7 @@ class DueExtension(models.Model):
self.date_approve = datetime.utcnow()
# self.order_id.message_post("Due Extension telah di approve")
- self.order_id.message_post(f"Due Extension {self.number} telah di approve")
+ self.order_id.message_post(body="Due Extension telah di approve")
template = self.env.ref('indoteknik_custom.mail_template_due_extension_approve')
template.send_mail(self.id, force_send=True)
return {
@@ -195,6 +195,7 @@ class DueExtensionLine(models.Model):
invoice_id = fields.Many2one('account.move', string='Invoice')
date_invoice = fields.Date(string='Invoice Date')
efaktur_id = fields.Many2one('vit.efaktur', string='Faktur Pajak')
+ user_id = fields.Many2one('res.users', string='Salesperson', related='invoice_id.invoice_user_id')
reference = fields.Char(string='Reference')
total_amt = fields.Float(string='Total Amount')
open_amt = fields.Float(string='Open Amount')
@@ -215,7 +216,8 @@ class DueExtensionLine(models.Model):
def _compute_day_to_due(self):
for line in self:
- line.day_to_due = line.invoice_id.invoice_day_to_due
+ # line.day_to_due = line.invoice_id.invoice_day_to_due
+ line.day_to_due = line.invoice_id.new_invoice_day_to_due
def _compute_due_date(self):
for line in self:
diff --git a/indoteknik_custom/models/advance_payment_request.py b/indoteknik_custom/models/advance_payment_request.py
index ec23de63..06807fb8 100644
--- a/indoteknik_custom/models/advance_payment_request.py
+++ b/indoteknik_custom/models/advance_payment_request.py
@@ -823,6 +823,9 @@ class AdvancePaymentUsageLine(models.Model):
_name = 'advance.payment.usage.line'
_description = 'Advance Payment Usage Line'
+ _order = 'sequence, id'
+ sequence = fields.Integer(string='Sequence', default=10)
+
realization_id = fields.Many2one('advance.payment.settlement', string='Realization')
date = fields.Date(string='Tanggal', required=True, default=fields.Date.today)
description = fields.Text(string='Description', required=True)
@@ -903,7 +906,10 @@ class AdvancePaymentUsageLine(models.Model):
class ReimburseLine(models.Model):
_name = 'reimburse.line'
- _description = 'Reimburse Line'
+ _description = 'Reimburse Line'
+
+ _order = 'sequence, id'
+ sequence = fields.Integer(string='Sequence', default=10)
request_id = fields.Many2one('advance.payment.request', string='Request')
date = fields.Date(string='Tanggal', required=True, default=fields.Date.today)
diff --git a/indoteknik_custom/models/coretax_fatur.py b/indoteknik_custom/models/coretax_fatur.py
index cabcd5d6..755c5cc3 100644
--- a/indoteknik_custom/models/coretax_fatur.py
+++ b/indoteknik_custom/models/coretax_fatur.py
@@ -147,7 +147,15 @@ class CoretaxFaktur(models.Model):
subtotal = line_price_subtotal
quantity = line_quantity
total_discount = round(line_discount, 2)
- coretax_id = line.product_uom_id.coretax_id
+ if isinstance(line, dict):
+ product = line.get('product_id')
+ uom = product.uom_id if product else False
+ else:
+ uom = line.product_uom_id
+
+ coretax_id = uom.coretax_id if uom else ''
+
+ # coretax_id = line.product_uom_id.coretax_id
# Calculate other tax values
otherTaxBase = round(subtotal * (11 / 12), 2) if subtotal else 0
vat_amount = round(otherTaxBase * 0.12, 2)
diff --git a/indoteknik_custom/models/partial_delivery.py b/indoteknik_custom/models/partial_delivery.py
index 519f505c..4e8ddbda 100644
--- a/indoteknik_custom/models/partial_delivery.py
+++ b/indoteknik_custom/models/partial_delivery.py
@@ -213,14 +213,22 @@ class PartialDeliveryWizard(models.TransientModel):
new_picking.action_assign()
picking.action_assign()
- existing_partials = self.env['stock.picking'].search([
- ('origin', '=', picking.origin),
- ('state_reserve', '=', 'partial'),
+ origin_name = picking.name
+
+ existing_siblings = self.env['stock.picking'].search([
+ ('name', 'like', f"{origin_name}/%"),
('id', '!=', new_picking.id),
- ], order='name asc')
+ ])
+
+ suffixes = []
+ for p in existing_siblings:
+ match = re.search(r'/(\d+)$', p.name)
+ if match:
+ suffixes.append(int(match.group(1)))
+
+ next_suffix = max(suffixes) + 1 if suffixes else 1
- suffix_number = len(existing_partials) + 1
- new_picking.name = f"{picking.name}/{suffix_number}"
+ new_picking.name = f"{origin_name}/{next_suffix}"
if picking.origin:
sale_order = self.env['sale.order'].search([('name', '=', picking.origin)], limit=1)
diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py
index cbc0b717..38ab69fa 100644
--- a/indoteknik_custom/models/refund_sale_order.py
+++ b/indoteknik_custom/models/refund_sale_order.py
@@ -331,6 +331,7 @@ class RefundSaleOrder(models.Model):
so_names = self.env['sale.order'].browse(so_ids).mapped('name')
domain = [
('journal_id', '=', 11),
+ ('sale_id', '=', False),
('state', '=', 'posted'),
('ref', 'ilike', 'uang muka penjualan'),
('ref', 'not ilike', 'reklas'),
@@ -351,30 +352,23 @@ class RefundSaleOrder(models.Model):
has_settlement = any(so.payment_status == 'settlement' for so in ssos)
sisa_uang_masuk = 0.0
- amounts = []
- if has_moves and has_settlement:
- amounts.append(sum(moves.mapped('amount_total_signed')))
- amounts.append(sum(ssos.mapped('gross_amount')))
- else:
- if has_moves:
- amounts.append(sum(moves.mapped('amount_total_signed')))
- if has_settlement:
- amounts.append(sum(ssos.mapped('gross_amount')))
+ has_journal = has_moves or has_moves2 or has_moves3 or has_piutangbca or has_piutangmdr or has_misc
- # sisanya bisa dijumlahkan tanpa konflik
+ if has_moves:
+ sisa_uang_masuk += sum(moves.mapped('amount_total_signed'))
if has_moves2:
- amounts.append(sum(moves2.mapped('amount_total_signed')))
+ sisa_uang_masuk += sum(moves2.mapped('amount_total_signed'))
if has_moves3:
- amounts.append(sum(moves3.mapped('amount_total_signed')))
+ sisa_uang_masuk += sum(moves3.mapped('amount_total_signed'))
if has_piutangbca:
- amounts.append(sum(piutangbca.mapped('amount_total_signed')))
+ sisa_uang_masuk += sum(piutangbca.mapped('amount_total_signed'))
if has_piutangmdr:
- amounts.append(sum(piutangmdr.mapped('amount_total_signed')))
+ sisa_uang_masuk += sum(piutangmdr.mapped('amount_total_signed'))
if has_misc:
- amounts.append(sum(misc.mapped('amount_total_signed')))
-
- sisa_uang_masuk = sum(amounts)
+ sisa_uang_masuk += sum(misc.mapped('amount_total_signed'))
+ if has_settlement and not has_journal:
+ sisa_uang_masuk += sum(ssos.mapped('gross_amount'))
if not sisa_uang_masuk:
raise UserError(
@@ -696,6 +690,7 @@ class RefundSaleOrder(models.Model):
domain = [
('journal_id', '=', 11),
+ ('sale_id', '=', False),
('state', '=', 'posted'),
('ref', 'ilike', 'uang muka penjualan'),
('ref', 'not ilike', 'reklas'),
@@ -717,24 +712,23 @@ class RefundSaleOrder(models.Model):
sisa_uang_masuk = 0.0
- amounts = []
+ has_journal = has_moves or has_moves2 or has_moves3 or has_piutangbca or has_piutangmdr or has_misc
if has_moves:
- amounts.append(sum(moves.mapped('amount_total_signed')))
+ sisa_uang_masuk += sum(moves.mapped('amount_total_signed'))
if has_moves2:
- amounts.append(sum(moves2.mapped('amount_total_signed')))
+ sisa_uang_masuk += sum(moves2.mapped('amount_total_signed'))
if has_moves3:
- amounts.append(sum(moves3.mapped('amount_total_signed')))
+ sisa_uang_masuk += sum(moves3.mapped('amount_total_signed'))
if has_piutangbca:
- amounts.append(sum(piutangbca.mapped('amount_total_signed')))
+ sisa_uang_masuk += sum(piutangbca.mapped('amount_total_signed'))
if has_piutangmdr:
- amounts.append(sum(piutangmdr.mapped('amount_total_signed')))
+ sisa_uang_masuk += sum(piutangmdr.mapped('amount_total_signed'))
if has_misc:
- amounts.append(sum(misc.mapped('amount_total_signed')))
- if has_settlement:
- amounts.append(sum(ssos.mapped('gross_amount')))
+ sisa_uang_masuk += sum(misc.mapped('amount_total_signed'))
- sisa_uang_masuk = sum(amounts)
+ if has_settlement and not has_journal:
+ sisa_uang_masuk += sum(ssos.mapped('gross_amount'))
self.uang_masuk = sisa_uang_masuk - amount_refund_before
diff --git a/indoteknik_custom/models/stock_picking_return.py b/indoteknik_custom/models/stock_picking_return.py
index 53a85f67..9cf017f9 100644
--- a/indoteknik_custom/models/stock_picking_return.py
+++ b/indoteknik_custom/models/stock_picking_return.py
@@ -120,8 +120,19 @@ class ReturnPicking(models.TransientModel):
'target': 'current',
'context': context,
}
- if picking.sale_id or 'SO' in (picking.origin or ''):
- _logger.info("This picking is NOT from a PO, fallback to SO.")
+ # if picking.sale_id or 'SO' in (picking.origin or ''):
+ # _logger.info("This picking is NOT from a PO, fallback to SO.")
+ # return {
+ # 'name': _('Tukar Guling SO'),
+ # 'type': 'ir.actions.act_window',
+ # 'res_model': 'tukar.guling',
+ # 'view_mode': 'form',
+ # 'target': 'current',
+ # 'context': context,
+ # }
+
+ if picking.name and any(k in picking.name.upper() for k in ('PICK', 'OUT')):
+ _logger.info("Redirect ke Tukar Guling SO via sale_id / origin")
return {
'name': _('Tukar Guling SO'),
'type': 'ir.actions.act_window',
diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py
index aa116ce3..99a74505 100644
--- a/indoteknik_custom/models/tukar_guling.py
+++ b/indoteknik_custom/models/tukar_guling.py
@@ -737,18 +737,14 @@ class TukarGuling(models.Model):
if mapping_koli and record.operations.picking_type_id.id == 29:
for prod in mapping_koli.mapped('product_id'):
qty_total = sum(mk.qty_return for mk in mapping_koli.filtered(lambda m: m.product_id == prod))
-
- move_lines = bu_out.move_line_ids.filtered(
- lambda ml: ml.product_id == prod and ml.qty_done > 0 and not ml.package_id
- )
-
- for ml in move_lines:
- srt_return_lines.append((0, 0, {
- 'product_id': ml.product_id.id,
- 'quantity': ml.qty_done,
- 'move_id': ml.move_id.id,
- }))
-
+ move = bu_out.move_lines.filtered(lambda m: m.product_id == prod)
+ if not move:
+ raise UserError(f"Move BU/OUT tidak ditemukan untuk produk {prod.display_name}")
+ srt_return_lines.append((0, 0, {
+ 'product_id': prod.id,
+ 'quantity': qty_total,
+ 'move_id': move.id,
+ }))
_logger.info(f"📟 SRT line: {prod.display_name} | qty={qty_total}")
elif not mapping_koli and record.operations.picking_type_id.id == 29:
diff --git a/indoteknik_custom/report/purchase_report.xml b/indoteknik_custom/report/purchase_report.xml
index 208e6472..c51ddc96 100644
--- a/indoteknik_custom/report/purchase_report.xml
+++ b/indoteknik_custom/report/purchase_report.xml
@@ -61,9 +61,10 @@
<td style="width:50%; border:1px solid #ccc; border-radius:8px; padding:10px; background:#fcfcfc; vertical-align:top;">
<strong style="color:#d32f2f;">Alamat Pengiriman</strong><br/>
PT. Indoteknik Dotcom Gemilang<br/>
- Jl. Bandengan Utara Komp A 8 B
- RT. Penjaringan, Kec. Penjaringan, Jakarta
- (BELAKANG INDOMARET)<br/>
+ Jl. Bandengan Utara Komp A 8 B RT.
+ Penjaringan, Kec. Penjaringan, Jakarta
+ (BELAKANG INDOMARET)
+ <br/>
Daerah Khusus Ibukota Jakarta 14440
</td>
<td style="width:50%; border:1px solid #ccc; border-radius:8px; padding:10px; background:#fcfcfc; vertical-align:top;">
@@ -97,10 +98,16 @@
<!-- TEKS -->
<div style="display:flex; flex-direction:column; flex:1;">
<span style="font-weight:bold; margin-bottom:2px;">
- <t t-esc="line_index + 1"/>. <t t-esc="line.name"/>
- <!-- <t t-esc="line_index + 1"/>. <t t-esc="line.product_id.display_name"/> -->
+ <t t-esc="line_index + 1"/>.
+ <t t-if="line.product_id.id == 114360">
+ <t t-esc="line.name"/>
+ </t>
+ <t t-else="">
+ <t t-esc="line.product_id.display_name"/>
+ </t>
</span>
</div>
+
</td>
<td style="border:1px solid #ccc; padding:6px; text-align:center;">
diff --git a/indoteknik_custom/views/account_move_line.xml b/indoteknik_custom/views/account_move_line.xml
index 3a20388e..cb24a0f0 100644
--- a/indoteknik_custom/views/account_move_line.xml
+++ b/indoteknik_custom/views/account_move_line.xml
@@ -16,6 +16,9 @@
<attribute name="groups"/>
<attribute name="options">{'no_create': True}</attribute>
</xpath>
+ <xpath expr="//field[@name='line_ids']/tree/field[@name='partner_id']" position="attributes">
+ <attribute name="options">{'no_create': True, 'no_open': True}</attribute>
+ </xpath>
</field>
</record>
</data>
diff --git a/indoteknik_custom/views/account_move_views.xml b/indoteknik_custom/views/account_move_views.xml
index 08b93f1f..b226460c 100644
--- a/indoteknik_custom/views/account_move_views.xml
+++ b/indoteknik_custom/views/account_move_views.xml
@@ -30,7 +30,7 @@
<field name="date_invoice"/>
<field name="due_date"/>
<field name="day_to_due"/>
- <field name="efaktur_id"/>
+ <field name="user_id" widget="many2one_avatar_user"/>
<field name="reference"/>
<field name="total_amt"/>
<field name="open_amt" sum="Grand Total Open Amount"/>
diff --git a/indoteknik_custom/views/advance_payment_request.xml b/indoteknik_custom/views/advance_payment_request.xml
index 4e73bb28..60042554 100644
--- a/indoteknik_custom/views/advance_payment_request.xml
+++ b/indoteknik_custom/views/advance_payment_request.xml
@@ -130,6 +130,7 @@
<page string="Rincian Reimburse">
<field name="reimburse_line_ids">
<tree>
+ <field name="sequence" widget="handle"/>
<field name="date"/>
<field name="description"/>
<field name="account_id"/>
diff --git a/indoteknik_custom/views/advance_payment_settlement.xml b/indoteknik_custom/views/advance_payment_settlement.xml
index 050e3933..a77baffe 100644
--- a/indoteknik_custom/views/advance_payment_settlement.xml
+++ b/indoteknik_custom/views/advance_payment_settlement.xml
@@ -74,6 +74,7 @@
<page string="Rincian Penggunaan">
<field name="penggunaan_line_ids" nolabel="1">
<tree>
+ <field name="sequence" widget="handle"/>
<field name="date"/>
<field name="description"/>
<field name="nominal" sum="Total Penggunaan"/>