summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-06-26 12:08:12 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-06-26 12:08:12 +0700
commit215dffae18b05fd3ab6df25b5d414f302f986b65 (patch)
treed10da611a6d0d10eddcc21adfe9ae512c15f03a4
parent3b6b3a2f7a161a08fa3995906f92019cc5ea4d17 (diff)
parent4a628d1644da21870706951c4601a5b007993cd8 (diff)
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into tukar_guling
-rw-r--r--indoteknik_custom/models/commision.py21
-rw-r--r--indoteknik_custom/models/coretax_fatur.py5
-rw-r--r--indoteknik_custom/models/purchase_order_sales_match.py2
-rw-r--r--indoteknik_custom/models/res_partner.py26
-rwxr-xr-xindoteknik_custom/models/sale_order.py4
-rw-r--r--indoteknik_custom/models/stock_picking.py2
-rw-r--r--indoteknik_custom/views/account_move.xml2
-rw-r--r--indoteknik_custom/views/customer_commision.xml1
8 files changed, 43 insertions, 20 deletions
diff --git a/indoteknik_custom/models/commision.py b/indoteknik_custom/models/commision.py
index 199aa106..97184cdb 100644
--- a/indoteknik_custom/models/commision.py
+++ b/indoteknik_custom/models/commision.py
@@ -178,10 +178,10 @@ class CustomerCommision(models.Model):
], string='Status')
# commision_percent = fields.Float(string='Commision %', tracking=3)
- commision_percent = fields.Float(string='Cashback %', tracking=3)
+ commision_percent = fields.Float(string='Persentase (%)', tracking=3)
# commision_amt = fields.Float(string='Commision Amount', tracking=3)
- commision_amt = fields.Float(string='Cashback', tracking=3)
+ commision_amt = fields.Float(string='Amount', tracking=3)
# cashback = fields.Float(string='Cashback', compute="compute_cashback")
cashback = fields.Float(string='PPh Cashback', compute="compute_cashback")
@@ -190,7 +190,8 @@ class CustomerCommision(models.Model):
total_commision = fields.Float(string='Cashback yang dibayarkan', compute="compute_cashback")
total_cashback = fields.Float(string='Total Cashback')
- commision_amt_text = fields.Char(string='Commision Amount Text', compute='compute_delivery_amt_text')
+ commision_amt_text = fields.Char(string='Amount Text', compute='compute_delivery_amt_text')
+ total_cashback_text = fields.Char(string='Cashback 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.total_cashback_text = f"{res} Rupiah" if res else ""
+ except Exception as e:
+ record.total_cashback_text = ""
+ _logger.error("Error computing cashback text: %s", str(e))
+
def _compute_grouped_numbers(self):
for rec in self:
so_numbers = set()
diff --git a/indoteknik_custom/models/coretax_fatur.py b/indoteknik_custom/models/coretax_fatur.py
index 54eb0f8e..9b1544d3 100644
--- a/indoteknik_custom/models/coretax_fatur.py
+++ b/indoteknik_custom/models/coretax_fatur.py
@@ -148,13 +148,16 @@ class CoretaxFaktur(models.Model):
otherTaxBase = round(subtotal * (11 / 12), 2) if subtotal else 0
vat_amount = round(otherTaxBase * 0.12, 2)
+ price_per_unit = round(subtotal / quantity, 2) if quantity else 0
+
# Create the line in XML
good_service = ET.SubElement(list_of_good_service, 'GoodService')
ET.SubElement(good_service, 'Opt').text = 'A'
ET.SubElement(good_service, 'Code').text = '000000'
ET.SubElement(good_service, 'Name').text = line_name
ET.SubElement(good_service, 'Unit').text = 'UM.0018'
- ET.SubElement(good_service, 'Price').text = str(round(line_price_unit, 2)) if line_price_unit else '0'
+ # ET.SubElement(good_service, 'Price').text = str(round(line_price_unit, 2)) if line_price_unit else '0'
+ ET.SubElement(good_service, 'Price').text = str(price_per_unit)
ET.SubElement(good_service, 'Qty').text = str(quantity)
ET.SubElement(good_service, 'TotalDiscount').text = str(total_discount)
ET.SubElement(good_service, 'TaxBase').text = str(round(subtotal)) if subtotal else '0'
diff --git a/indoteknik_custom/models/purchase_order_sales_match.py b/indoteknik_custom/models/purchase_order_sales_match.py
index 2ea89dab..b18864f3 100644
--- a/indoteknik_custom/models/purchase_order_sales_match.py
+++ b/indoteknik_custom/models/purchase_order_sales_match.py
@@ -41,7 +41,7 @@ class PurchaseOrderSalesMatch(models.Model):
if stock_move:
rec.bu_pick = stock_move.picking_id.id
else:
- rec.bu_pick = ''
+ rec.bu_pick = None
def _compute_purchase_line_id(self):
for line in self:
diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py
index d439c7a8..f5347bea 100644
--- a/indoteknik_custom/models/res_partner.py
+++ b/indoteknik_custom/models/res_partner.py
@@ -165,21 +165,21 @@ class ResPartner(models.Model):
"this feature", tracking=3)
telegram_id = fields.Char(string="Telegram")
avg_aging= fields.Float(string='Average Aging')
- payment_difficulty = fields.Selection([('bermasalah', 'Bermasalah'),('sulit', 'Sulit'),('agak_sulit', 'Agak Sulit'),('normal', 'Normal')], string='Payment Difficulty', tracking=3)
+ payment_difficulty = fields.Selection([('bermasalah', 'Bermasalah'),('sulit', 'Sulit'),('agak_sulit', 'Agak Sulit'),('normal', 'Normal')], string='Payment Difficulty', compute="_compute_payment_difficulty", inverse = "_inverse_payment_difficulty", tracking=3)
payment_history_url = fields.Text(string='Payment History URL')
- # @api.depends('parent_id.payment_difficulty')
- # def _compute_payment_difficulty(self):
- # for partner in self:
- # if partner.parent_id:
- # partner.payment_difficulty = partner.parent_id.payment_difficulty
-
- # def _inverse_payment_difficulty(self):
- # for partner in self:
- # if not partner.parent_id:
- # partner.child_ids.write({
- # 'payment_difficulty': partner.payment_difficulty
- # })
+ @api.depends('parent_id.payment_difficulty')
+ def _compute_payment_difficulty(self):
+ for partner in self:
+ if partner.parent_id:
+ partner.payment_difficulty = partner.parent_id.payment_difficulty
+
+ def _inverse_payment_difficulty(self):
+ for partner in self:
+ if not partner.parent_id:
+ partner.child_ids.write({
+ 'payment_difficulty': partner.payment_difficulty
+ })
@api.model
def _default_payment_term(self):
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index 85228901..109771e9 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -1994,9 +1994,9 @@ class SaleOrder(models.Model):
confirmed_bom = search_bom.filtered(lambda x: x.state == 'confirmed' or x.state == 'done')
if not confirmed_bom:
raise UserError(
- "Product BOM belum dikonfirmasi di Manufacturing Orders. Silakan hubungi MD.")
+ "Product BOM belum dikonfirmasi di Manufacturing Orders. Silakan hubungi Purchasing.")
else:
- raise UserError("Product BOM tidak di temukan di manufacturing orders, silahkan hubungi MD")
+ raise UserError("Product BOM tidak di temukan di manufacturing orders, silahkan hubungi Purchasing")
def check_duplicate_product(self):
for order in self:
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index 06f873a5..6d868db4 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -1364,6 +1364,8 @@ class StockPicking(models.Model):
])
for line in po.order_sales_match_line:
+ if not line.bu_pick:
+ continue
line.bu_pick.action_assign()
def check_invoice_date(self):
diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml
index e8061862..ad52a74a 100644
--- a/indoteknik_custom/views/account_move.xml
+++ b/indoteknik_custom/views/account_move.xml
@@ -37,6 +37,8 @@
</field>
<field name="ref" position="after">
<field name="sale_id" readonly="1" attrs="{'invisible': [('move_type', '!=', 'entry')]}"/>
+ </field>
+ <field name="reklas_misc_id" position="after">
<field name="purchase_order_id" context="{'form_view_ref': 'purchase.purchase_order_form'}" options="{'no_create': True}"/>
<field name="bill_id" readonly="1"/>
</field>
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"/>