diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2025-06-25 11:18:33 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2025-06-25 11:18:47 +0700 |
| commit | 8ca3394604d088a683fc4a3c69321ad65f093b7f (patch) | |
| tree | e8d67efae5c326afa444234ab14230e864b12ef1 | |
| parent | 79cf5002ddd85a57e3c2eb146bfbe612fdef8d3a (diff) | |
add terbilang total cashback customer commision
| -rw-r--r-- | indoteknik_custom/models/commision.py | 15 | ||||
| -rw-r--r-- | indoteknik_custom/views/customer_commision.xml | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/indoteknik_custom/models/commision.py b/indoteknik_custom/models/commision.py index 199aa106..997d4470 100644 --- a/indoteknik_custom/models/commision.py +++ b/indoteknik_custom/models/commision.py @@ -191,6 +191,7 @@ class CustomerCommision(models.Model): total_cashback = fields.Float(string='Total Cashback') commision_amt_text = fields.Char(string='Commision Amount Text', compute='compute_delivery_amt_text') + total_cashback_text = fields.Char(string='Commision Amount Text', compute='compute_total_cashback_text') total_dpp = fields.Float(string='Total DPP', compute='_compute_total_dpp') commision_type = fields.Selection([ ('fee', 'Fee'), @@ -281,6 +282,20 @@ class CustomerCommision(models.Model): except: record.commision_amt_text = res + def compute_total_cashback_text(self): + tb = Terbilang() + + for record in self: + res = '' + + try: + if record.total_commision > 0: + tb.parse(int(record.total_commision)) + res = tb.getresult().title() + record.commision_amt_text = res + ' Rupiah' + except: + record.commision_amt_text = res + def _compute_grouped_numbers(self): for rec in self: so_numbers = set() diff --git a/indoteknik_custom/views/customer_commision.xml b/indoteknik_custom/views/customer_commision.xml index d5fb1d70..1c17bf63 100644 --- a/indoteknik_custom/views/customer_commision.xml +++ b/indoteknik_custom/views/customer_commision.xml @@ -83,6 +83,7 @@ <field name="commision_amt_text"/> <field name="cashback" attrs="{'invisible': [('commision_type', 'not in', ['cashback'])]}"/> <field name="total_commision" attrs="{'invisible': [('commision_type', 'not in', ['cashback'])]}"/> + <field name="total_cashback_text" attrs="{'invisible': [('commision_type', 'not in', ['cashback'])]}"/> <field name="grouped_so_number" readonly="1"/> <field name="grouped_invoice_number" readonly="1"/> <field name="approved_by" readonly="1"/> |
