diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-24 13:04:15 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-24 13:04:15 +0700 |
| commit | 4d87e7317448dd7cc46d01e32ac2c953f02d72b1 (patch) | |
| tree | 3f837c7505f23e81b0ceebacf323ccb7e63b23fe | |
| parent | dbe66f04df0fa1809ed015b7a6993697b482106d (diff) | |
| parent | d8c9133eeee42458e579e5f537e54136032e3f6f (diff) | |
<miqdad> merge w/ odoo-backup
| -rwxr-xr-x | indoteknik_custom/__manifest__.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/models/refund_sale_order.py | 31 | ||||
| -rw-r--r-- | indoteknik_custom/models/tukar_guling_po.py | 6 | ||||
| -rw-r--r-- | indoteknik_custom/views/account_move.xml | 6 | ||||
| -rw-r--r-- | indoteknik_custom/views/refund_sale_order.xml | 4 | ||||
| -rwxr-xr-x | indoteknik_custom/views/sale_order.xml | 14 |
6 files changed, 30 insertions, 33 deletions
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index b79391d8..2a4db273 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -173,7 +173,7 @@ 'views/tukar_guling.xml', # 'views/tukar_guling_return_views.xml' 'views/tukar_guling_po.xml', - 'views/refund_sale_order.xml', + # 'views/refund_sale_order.xml', ], 'demo': [], 'css': [], diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index 559ca07a..11bfd07f 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -17,7 +17,7 @@ class RefundSaleOrder(models.Model): note_refund = fields.Text(string='Note Refund') sale_order_ids = fields.Many2many('sale.order', string='Sales Order Numbers') uang_masuk = fields.Float(string='Uang Masuk', required=True) - total_invoice = fields.Float(string='Total Invoice', compute='_compute_total_invoice', readonly=True) + total_invoice = fields.Float(string='Total Invoice') ongkir = fields.Float(string='Ongkir', required=True, default=0.0) amount_refund = fields.Float(string='Total Refund', required=True) amount_refund_text = fields.Char(string='Total Refund Text', compute='_compute_refund_text') @@ -105,6 +105,10 @@ class RefundSaleOrder(models.Model): ) is_locked = fields.Boolean(string="Locked", compute="_compute_is_locked") + sale_order_names_jasper = fields.Char(string='Sales Order List', compute='_compute_order_invoice_names') + invoice_names_jasper = fields.Char(string='Invoice List', compute='_compute_order_invoice_names') + + @api.depends('refund_type') def _compute_refund_type_display(self): @@ -147,10 +151,10 @@ class RefundSaleOrder(models.Model): invoice_ids_data = vals.get('invoice_ids', []) invoice_ids = invoice_ids_data[0][2] if invoice_ids_data and invoice_ids_data[0][0] == 6 else [] - if invoice_ids and refund_type and refund_type not in ['uang', 'barang_kosong_sebagian', 'retur_half']: + if invoice_ids and refund_type and refund_type not in ['uang', 'barang_kosong_sebagian', 'barang_kosong', 'retur_half']: raise UserError("Refund type Hanya Bisa Lebih Bayar, Barang Kosong Sebagian, atau Retur Sebagian jika ada invoice") - if not invoice_ids and refund_type and refund_type in ['uang', 'barang_kosong_sebagian', 'retur_half']: + if not invoice_ids and refund_type and refund_type in ['uang', 'barang_kosong_sebagian', 'barang_kosong', 'retur_half']: raise UserError("Refund type Lebih Bayar, Barang Kosong Sebagian, atau Retur Sebagian Hanya Bisa dipilih Jika Ada Invoice") @@ -241,10 +245,10 @@ class RefundSaleOrder(models.Model): else: invoice_ids = rec.invoice_ids.ids - if invoice_ids and vals.get('refund_type', rec.refund_type) not in ['uang', 'barang_kosong_sebagian', 'retur_half']: + if invoice_ids and vals.get('refund_type', rec.refund_type) not in ['uang', 'barang_kosong_sebagian', 'barang_kosong', 'retur_half']: raise UserError("Refund type Hanya Bisa Lebih Bayar, Barang Kosong Sebagian, atau Retur Sebagian jika ada invoice") - if not invoice_ids and vals.get('refund_type', rec.refund_type) in ['uang', 'barang_kosong_sebagian', 'retur_half']: + if not invoice_ids and vals.get('refund_type', rec.refund_type) in ['uang', 'barang_kosong_sebagian', 'barang_kosong', 'retur_half']: raise UserError("Refund type Lebih Bayar, Barang Kosong Sebagian, atau Retur Sebagian Hanya Bisa dipilih Jika Ada Invoice") if refund_type in ['retur', 'retur_half'] and so_ids: @@ -279,11 +283,12 @@ class RefundSaleOrder(models.Model): def _compute_is_locked(self): for rec in self: rec.is_locked = rec.status_payment in ['done', 'reject'] - - @api.depends('invoice_ids.amount_total') - def _compute_total_invoice(self): + + @api.depends('sale_order_ids.name', 'invoice_ids.name') + def _compute_order_invoice_names(self): for rec in self: - rec.total_invoice = sum(inv.amount_total for inv in rec.invoice_ids) + rec.sale_order_names_jasper = ', '.join(rec.sale_order_ids.mapped('name')) or '' + rec.invoice_names_jasper = ', '.join(rec.invoice_ids.mapped('name')) or '' @api.depends('sale_order_ids') def _compute_advance_move_names(self): @@ -428,14 +433,6 @@ class RefundSaleOrder(models.Model): pengurangan = rec.total_invoice + rec.ongkir refund = rec.uang_masuk - pengurangan rec.amount_refund = refund if refund > 0 else 0.0 - - if rec.uang_masuk and rec.uang_masuk <= pengurangan: - return { - 'warning': { - 'title': 'Uang Masuk Kurang', - 'message': 'Uang masuk harus lebih besar dari total invoice + ongkir untuk dapat melakukan refund.' - } - } @api.model def default_get(self, fields_list): diff --git a/indoteknik_custom/models/tukar_guling_po.py b/indoteknik_custom/models/tukar_guling_po.py index 20adcfef..b3279077 100644 --- a/indoteknik_custom/models/tukar_guling_po.py +++ b/indoteknik_custom/models/tukar_guling_po.py @@ -25,9 +25,9 @@ class TukarGulingPO(models.Model): ) name = fields.Char('Number', required=True, copy=False, readonly=True, default='New') date = fields.Datetime('Date', default=fields.Datetime.now, required=True) - date_purchase = fields.Datetime('Date Approve Purchase', required=True, readonly=True) - date_finance = fields.Datetime('Date Approve Finance', required=True, readonly=True) - date_logistic = fields.Datetime('Date Approve Logistic', required=True, readonly=True) + date_purchase = fields.Datetime('Date Approve Purchase', readonly=True) + date_finance = fields.Datetime('Date Approve Finance', readonly=True) + date_logistic = fields.Datetime('Date Approve Logistic', readonly=True) operations = fields.Many2one( 'stock.picking', string='Operations', diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml index ae944a4a..59e89210 100644 --- a/indoteknik_custom/views/account_move.xml +++ b/indoteknik_custom/views/account_move.xml @@ -36,9 +36,9 @@ <!-- <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'), ('has_refund_so', '=', True)]}"/> - <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 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> <field name="reklas_misc_id" position="after"> <field name="purchase_order_id" context="{'form_view_ref': 'purchase.purchase_order_form'}" options="{'no_create': True}"/> diff --git a/indoteknik_custom/views/refund_sale_order.xml b/indoteknik_custom/views/refund_sale_order.xml index 3b348730..4f791722 100644 --- a/indoteknik_custom/views/refund_sale_order.xml +++ b/indoteknik_custom/views/refund_sale_order.xml @@ -118,9 +118,9 @@ </group> <group> <field name="uang_masuk" attrs="{'readonly': [('is_locked', '=', True)]}"/> - <field name="total_invoice" readonly="1"/> + <field name="total_invoice" attrs="{'readonly': [('is_locked', '=', True)]}"/> <field name="ongkir" attrs="{'readonly': [('is_locked', '=', True)]}"/> - <field name="amount_refund" readonly="1"/> + <field name="amount_refund" attrs="{'readonly': [('is_locked', '=', True)]}"/> <field name="amount_refund_text" readonly="1"/> <field name="uang_masuk_type" required="1" attrs="{'readonly': [('is_locked', '=', True)]}"/> <field name="bukti_uang_masuk_image" widget="image" diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index b9ab3bdd..104806d2 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -35,13 +35,13 @@ string="UangMuka" type="action" attrs="{'invisible': [('approval_status', '!=', 'approved')]}"/> </button> - <xpath expr="//header" position="inside"> + <!-- <xpath expr="//header" position="inside"> <button name="button_refund" type="object" string="Refund" class="btn-primary" attrs="{'invisible': ['|', ('state', 'not in', ['sale', 'done']), ('has_refund', '=', True)]}" /> - </xpath> + </xpath> --> <div class="oe_button_box" name="button_box"> <button name="action_open_advance_payment_move" type="object" @@ -52,13 +52,13 @@ <field name="advance_payment_move_id" string="Journal Uang Muka" widget="statinfo"/> </button> - <button type="object" + <!-- <button type="object" name="action_view_related_refunds" class="oe_stat_button" icon="fa-refresh" attrs="{'invisible': [('refund_count', '=', 0)]}"> <field name="refund_count" widget="statinfo" string="Refund"/> - </button> + </button> --> </div> <field name="payment_term_id" position="after"> <field name="create_uid" invisible="1"/> @@ -176,7 +176,7 @@ <field name="expected_ready_to_ship"/> <field name="eta_date_start"/> <field name="eta_date" readonly="1"/> - <field name="has_refund" readonly="1"/> + <!-- <field name="has_refund" readonly="1"/> --> </group> <group string="Return Doc"> <field name="ccm_id" readonly="1"/> @@ -661,7 +661,7 @@ </record> </data> - <data> + <!-- <data> <record id="sale_order_multi_create_refund_ir_actions_server" model="ir.actions.server"> <field name="name">Refund</field> <field name="model_id" ref="sale.model_sale_order"/> @@ -669,7 +669,7 @@ <field name="state">code</field> <field name="code">action = records.open_form_multi_create_refund()</field> </record> - </data> + </data> --> <data> <record id="mail_template_sale_order_notification_to_salesperson" model="mail.template"> |
