summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-07-24 17:35:50 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-07-24 17:35:50 +0700
commit7b6feef2cf80a3c6e2f4ed8e1a68c81170df72eb (patch)
tree9717b2e9019a184249500f4c3c4c3c03c0b574d9
parentb8efc85091fe0af596872bffeb3cf6c78fe2beed (diff)
parent19ac8961c8163322f759f9eb021df368a8950010 (diff)
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into tukar_guling
-rwxr-xr-xindoteknik_custom/models/purchase_order.py2
-rwxr-xr-xindoteknik_custom/models/sale_order.py42
-rw-r--r--indoteknik_custom/views/account_move.xml2
-rwxr-xr-xindoteknik_custom/views/sale_order.xml8
4 files changed, 44 insertions, 10 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index d157dc30..45134939 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -1048,7 +1048,7 @@ class PurchaseOrder(models.Model):
for line in self.order_line:
if line.taxes_id != reference_taxes:
- raise UserError("PPN harus sama untuk semua baris pada line.")
+ raise UserError(f"PPN harus sama untuk semua baris pada line {line.product_id.name}")
def check_data_vendor(self):
vendor = self.partner_id
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index 618036bb..7be0e8ff 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -365,6 +365,17 @@ class SaleOrder(models.Model):
compute='_compute_advance_payment_move',
string='Advance Payment Move',
)
+ advance_payment_move_ids = fields.Many2many(
+ 'account.move',
+ compute='_compute_advance_payment_moves',
+ string='All Advance Payment Moves',
+ )
+
+ advance_payment_move_count = fields.Integer(
+ string='Jumlah Jurnal Uang Muka',
+ compute='_compute_advance_payment_moves',
+ store=False
+ )
def _has_ccm(self):
if self.id:
@@ -3196,15 +3207,38 @@ class SaleOrder(models.Model):
('state', '=', 'posted'),
], limit=1, order="id desc")
order.advance_payment_move_id = move
+
+ @api.depends('invoice_ids')
+ def _compute_advance_payment_moves(self):
+ for order in self:
+ moves = self.env['account.move'].search([
+ ('sale_id', '=', order.id),
+ ('journal_id', '=', 11),
+ ('state', '=', 'posted'),
+ ])
+ order.advance_payment_move_ids = moves
+
+ @api.depends('invoice_ids')
+ def _compute_advance_payment_moves(self):
+ for order in self:
+ moves = self.env['account.move'].search([
+ ('sale_id', '=', order.id),
+ ('journal_id', '=', 11),
+ ('state', '=', 'posted'),
+ ])
+ order.advance_payment_move_ids = moves
+ order.advance_payment_move_count = len(moves)
- def action_open_advance_payment_move(self):
+ def action_open_advance_payment_moves(self):
self.ensure_one()
- if not self.advance_payment_move_id:
+ moves = self.advance_payment_move_ids
+ if not moves:
return
return {
'type': 'ir.actions.act_window',
+ 'name': 'Journals Sales Order',
'res_model': 'account.move',
- 'res_id': self.advance_payment_move_id.id,
- 'view_mode': 'form',
+ 'view_mode': 'tree,form',
+ 'domain': [('id', 'in', moves.ids)],
'target': 'current',
} \ No newline at end of file
diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml
index 59e89210..9b1c791b 100644
--- a/indoteknik_custom/views/account_move.xml
+++ b/indoteknik_custom/views/account_move.xml
@@ -36,7 +36,7 @@
<!-- <field name="purchase_order_id" readonly="1" attrs="{'invisible': [('move_type', '!=', 'in_invoice')]}"/> -->
</field>
<field name="ref" position="after">
- <field name="sale_id" readonly="1" attrs="{'invisible': ['|', ('move_type', '!=', 'entry')]}"/>
+ <field name="sale_id" readonly="1" attrs="{'invisible': [('move_type', '!=', 'entry')]}"/>
<!-- <field name="refund_so_links" readonly="1" widget="html" attrs="{'invisible': ['|', ('move_type', '!=', 'entry'), ('has_refund_so', '=', False)]}"/>
<field name="has_refund_so" invisible="1"/> -->
</field>
diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml
index 104806d2..c1f1fe61 100755
--- a/indoteknik_custom/views/sale_order.xml
+++ b/indoteknik_custom/views/sale_order.xml
@@ -43,13 +43,13 @@
attrs="{'invisible': ['|', ('state', 'not in', ['sale', 'done']), ('has_refund', '=', True)]}" />
</xpath> -->
<div class="oe_button_box" name="button_box">
- <button name="action_open_advance_payment_move"
+ <field name="advance_payment_move_ids" invisible="1"/>
+ <button name="action_open_advance_payment_moves"
type="object"
class="oe_stat_button"
icon="fa-book"
- width="250px"
- attrs="{'invisible': [('advance_payment_move_id','=',False)]}">
- <field name="advance_payment_move_id" string="Journal Uang Muka" widget="statinfo"/>
+ attrs="{'invisible': [('advance_payment_move_ids', '=', [])]}">
+ <field name="advance_payment_move_count" widget="statinfo" string="Journals"/>
</button>
<!-- <button type="object"