summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIndoteknik . <it@fixcomart.co.id>2025-08-27 13:42:03 +0700
committerIndoteknik . <it@fixcomart.co.id>2025-08-27 13:42:03 +0700
commit71bda6165a9439979b862fb9f9cb31b741477a87 (patch)
tree18f4c1edb4318945b103aed5becfd25bb9a43c43
parent43049cea86883ffcfb6ae988dc46b74ad38def85 (diff)
parent2103a438acc24ad44965b869a28a15424838c9b5 (diff)
fix
-rw-r--r--indoteknik_custom/models/account_move.py9
-rw-r--r--indoteknik_custom/models/account_move_due_extension.py15
-rw-r--r--indoteknik_custom/models/res_partner.py3
-rw-r--r--indoteknik_custom/views/account_move_views.xml3
-rw-r--r--indoteknik_custom/views/customer_commision.xml1
-rw-r--r--indoteknik_custom/views/dunning_run.xml2
6 files changed, 25 insertions, 8 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index f5dd5a39..d9d15764 100644
--- a/indoteknik_custom/models/account_move.py
+++ b/indoteknik_custom/models/account_move.py
@@ -179,9 +179,8 @@ class AccountMove(models.Model):
('state', '=', 'posted'),
('payment_state', 'not in', ['paid', 'in_payment', 'reversed']),
('invoice_date_due', 'in', target_dates),
- ('date_terima_tukar_faktur', '!=', False),
- ('partner_id', 'in', [88813, 80163])
- ])
+ ('date_terima_tukar_faktur', '!=', False)
+ ], limit=5)
_logger.info(f"Invoices: {invoices}")
invoices = invoices.filtered(
@@ -409,8 +408,8 @@ class AccountMove(models.Model):
# 'reply_to': 'finance@indoteknik.co.id',
}
- template.send_mail(invs[0].id, force_send=True, email_values=values)
- # _logger.info(f"Mengirim email ke: {values['email_to']} > email CC: {values['email_cc']}")
+ # template.send_mail(invs[0].id, force_send=True, email_values=values)
+ _logger.info(f"Mengirim email ke: {values['email_to']} > email CC: {values['email_cc']}")
_logger.info(f"Reminder terkirim ke {partner.name} ({values['email_to']}) → {len(invs)} invoice (dtd = {dtd})")
# flag
invs.write({'reminder_sent_date': today})
diff --git a/indoteknik_custom/models/account_move_due_extension.py b/indoteknik_custom/models/account_move_due_extension.py
index d354e3e3..40059bd9 100644
--- a/indoteknik_custom/models/account_move_due_extension.py
+++ b/indoteknik_custom/models/account_move_due_extension.py
@@ -14,6 +14,16 @@ class DueExtension(models.Model):
number = fields.Char(string='Document No', index=True, copy=False, readonly=True, tracking=True)
partner_id = fields.Many2one('res.partner', string="Customer", readonly=True)
order_id = fields.Many2one('sale.order', string="SO", readonly=True)
+ amount_total = fields.Monetary(
+ string="Amount Total SO",
+ compute="_compute_amount_total",
+ readonly=True
+ )
+ currency_id = fields.Many2one(
+ 'res.currency',
+ related="order_id.currency_id",
+ readonly=True
+ )
invoice_id = fields.Many2one('account.move', related='due_line.invoice_id', string='Invoice', readonly=False)
due_line = fields.One2many('due.extension.line', 'due_id', string='Due Extension Lines', auto_join=True)
old_due = fields.Date(string="Old Due")
@@ -34,6 +44,11 @@ class DueExtension(models.Model):
approve_by = fields.Many2one('res.users', string="Approve By", readonly=True)
date_approve = fields.Datetime(string="Date Approve", readonly=True)
+ @api.depends('order_id')
+ def _compute_amount_total(self):
+ for rec in self:
+ rec.amount_total = rec.order_id.amount_total if rec.order_id else 0.0
+
def _compute_counter(self):
for due in self:
due.counter = due.partner_id.counter
diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py
index 1dba200a..7a714ea7 100644
--- a/indoteknik_custom/models/res_partner.py
+++ b/indoteknik_custom/models/res_partner.py
@@ -279,11 +279,12 @@ class ResPartner(models.Model):
if record.name:
existing_partner = self.env['res.partner'].search([
('id', '!=', record.id),
+ '|',
('name', '=', record.name),
('email', '=', record.email)
], limit=1)
- if existing_partner:
+ if existing_partner and not record.parent_id:
raise ValidationError(f"Nama '{record.name}' dengan email '{record.email}' sudah digunakan oleh partner lain!")
@api.constrains('npwp')
diff --git a/indoteknik_custom/views/account_move_views.xml b/indoteknik_custom/views/account_move_views.xml
index 0fd7c9cd..7c1f8913 100644
--- a/indoteknik_custom/views/account_move_views.xml
+++ b/indoteknik_custom/views/account_move_views.xml
@@ -33,7 +33,7 @@
<field name="efaktur_id"/>
<field name="reference"/>
<field name="total_amt"/>
- <field name="open_amt"/>
+ <field name="open_amt" sum="Grand Total Open Amount"/>
</tree>
</field>
</record>
@@ -68,6 +68,7 @@
<field name="partner_id" readonly="1"/>
<field name="day_extension" attrs="{'readonly': [('is_approve', '=', True)]}"/>
<field name="order_id" readonly="1"/>
+ <field name="amount_total" readonly="1"/>
</group>
<group>
<field name="is_approve" readonly="1"/>
diff --git a/indoteknik_custom/views/customer_commision.xml b/indoteknik_custom/views/customer_commision.xml
index 514e6284..7c72d86a 100644
--- a/indoteknik_custom/views/customer_commision.xml
+++ b/indoteknik_custom/views/customer_commision.xml
@@ -164,6 +164,7 @@
<field name="priority" eval="15"/>
<field name="arch" type="xml">
<search string="Search Customer Commision">
+ <field name="number" string="Document Number"/>
<field name="partner_ids"/>
<group expand="0" string="Group By">
<filter string="Partner" name="group_partner"
diff --git a/indoteknik_custom/views/dunning_run.xml b/indoteknik_custom/views/dunning_run.xml
index 2117a7bb..210f7917 100644
--- a/indoteknik_custom/views/dunning_run.xml
+++ b/indoteknik_custom/views/dunning_run.xml
@@ -29,7 +29,7 @@
<field name="date_invoice"/>
<field name="efaktur_id"/>
<field name="reference"/>
- <field name="total_amt"/>
+ <field name="total_amt" sum="Grand Total Amount"/>
<field name="open_amt"/>
<field name="due_date"/>
</tree>