diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-26 14:33:16 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-07-26 14:33:16 +0700 |
| commit | 7cea5aa18bea9b80ace297bfc36eec8db1adef6e (patch) | |
| tree | ff6036ab08fdc4f3997149eb228a2a01ce2924e4 | |
| parent | ae201ad5ac392a75da087a5e1215f9b8fcd50dba (diff) | |
| parent | 83c6a567c1e2f1b8c281ea405732a286cb20a8c9 (diff) | |
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into is_discweb_so_line
Merge
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 25 | ||||
| -rw-r--r-- | indoteknik_custom/models/tukar_guling_po.py | 25 | ||||
| -rwxr-xr-x | indoteknik_custom/security/ir.model.access.csv | 3 | ||||
| -rw-r--r-- | indoteknik_custom/views/refund_sale_order.xml | 199 |
4 files changed, 35 insertions, 217 deletions
diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index 43bc156e..26b98e32 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -386,14 +386,23 @@ class TukarGuling(models.Model): def action_view_picking(self): self.ensure_one() - action = self.env.ref('stock.action_picking_tree_all').read()[0] - pickings = self.picking_ids - if len(pickings) > 1: - action['domain'] = [('id', 'in', pickings.ids)] - elif pickings: - action['views'] = [(self.env.ref('stock.view_picking_form').id, 'form')] - action['res_id'] = pickings.id - return action + + # picking_origin = f"Return of {self.operations.name}" + returs = self.env['stock.picking'].search([ + ('tukar_guling_id', '=', self.id), + ]) + + if not returs: + raise UserError("Doc Retrun Not Found") + + return { + 'type': 'ir.actions.act_window', + 'name': 'Delivery Pengajuan Retur SO', + 'res_model': 'stock.picking', + 'view_mode': 'tree,form', + 'domain': [('id', 'in', returs.ids)], + 'target': 'current', + } def action_draft(self): """Reset to draft state""" diff --git a/indoteknik_custom/models/tukar_guling_po.py b/indoteknik_custom/models/tukar_guling_po.py index 14f2cc96..fced7fdb 100644 --- a/indoteknik_custom/models/tukar_guling_po.py +++ b/indoteknik_custom/models/tukar_guling_po.py @@ -320,14 +320,23 @@ class TukarGulingPO(models.Model): def action_view_picking(self): self.ensure_one() - action = self.env.ref('stock.action_picking_tree_all').read()[0] - pickings = self.po_picking_ids - if len(pickings) > 1: - action['domain'] = [('id', 'in', pickings.ids)] - elif pickings: - action['views'] = [(self.env.ref('stock.view_picking_form').id, 'form')] - action['res_id'] = pickings.id - return action + + # picking_origin = f"Return of {self.operations.name}" + returs = self.env['stock.picking'].search([ + ('tukar_guling_po_id', '=', self.id), + ]) + + if not returs: + raise UserError("Doc Retrun Not Found") + + return { + 'type': 'ir.actions.act_window', + 'name': 'Delivery Pengajuan Retur PO', + 'res_model': 'stock.picking', + 'view_mode': 'tree,form', + 'domain': [('id', 'in', returs.ids)], + 'target': 'current', + } def action_draft(self): """Reset to draft state""" diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index 0ac3e86c..015b257c 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -183,8 +183,7 @@ access_production_purchase_match,access.production.purchase.match,model_producti access_image_carousel,access.image.carousel,model_image_carousel,,1,1,1,1 access_v_sale_notin_matchpo,access.v.sale.notin.matchpo,model_v_sale_notin_matchpo,,1,1,1,1 access_approval_payment_term,access.approval.payment.term,model_approval_payment_term,,1,1,1,1 -access_refund_sale_order,access.refund.sale.order,model_refund_sale_order,base.group_user,1,1,1,1 -access_refund_sale_order_line,access.refund.sale.order.line,model_refund_sale_order_line,base.group_user,1,1,1,1 + access_purchasing_job_seen,purchasing.job.seen,model_purchasing_job_seen,,1,1,1,1 access_tukar_guling_all_users,tukar.guling.all.users,model_tukar_guling,base.group_user,1,1,1,1 diff --git a/indoteknik_custom/views/refund_sale_order.xml b/indoteknik_custom/views/refund_sale_order.xml deleted file mode 100644 index 4f791722..00000000 --- a/indoteknik_custom/views/refund_sale_order.xml +++ /dev/null @@ -1,199 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<odoo> - <!-- Tree View --> - <record id="view_refund_sale_order_tree" model="ir.ui.view"> - <field name="name">refund.sale.order.tree</field> - <field name="model">refund.sale.order</field> - <field name="arch" type="xml"> - <tree string="Refund Sales Orders"> - <field name="name" readonly="1"/> - <field name="created_date" readonly="1"/> - <field name="partner_id" readonly="1"/> - <field name="sale_order_ids" widget="many2many_tags" readonly="1"/> - <field name="uang_masuk" readonly="1"/> - <field name="ongkir" readonly="1"/> - <field name="total_invoice" readonly="1"/> - <field name="amount_refund" readonly="1"/> - <field name="status" - decoration-info="status == 'draft'" - decoration-danger="status == 'reject'" - decoration-success="status == 'refund'" - decoration-warning="status == 'pengajuan1' or status == 'pengajuan2' or status == 'pengajuan3'" - widget="badge" - readonly="1"/> - <field name="status_payment" - decoration-info="status_payment == 'pending'" - decoration-danger="status_payment == 'reject'" - decoration-success="status_payment == 'done'" - widget="badge" - readonly="1"/> - <field name="refund_date" readonly="1"/> - <field name="amount_refund_text" readonly="1" optional="hide"/> - <field name="invoice_ids" readonly="1" optional="hide"/> - <field name="refund_type" readonly="1" optional="hide"/> - <field name="user_ids" readonly="1" optional="hide"/> - </tree> - </field> - </record> - - <!-- Form View --> - <record id="view_refund_sale_order_form" model="ir.ui.view"> - <field name="name">refund.sale.order.form</field> - <field name="model">refund.sale.order</field> - <field name="arch" type="xml"> - <form string="Refund Sales Order"> - <header> - <button name="action_ask_approval" - type="object" - string="Ask Approval" - attrs="{'invisible': [('status', '!=', 'draft')]}"/> - - <button name="action_approve_flow" - type="object" - string="Approve" - class="oe_highlight" - attrs="{'invisible': [('status', 'in', ['refund', 'reject', 'draft'])]}"/> - <button name="action_trigger_cancel" - type="object" - string="Cancel" - attrs="{'invisible': ['|', ('status_payment', '!=', 'pending'), ('status', '=', 'reject')]}" /> - <button name="action_confirm_refund" - type="object" - string="Confirm Refund" - class="btn-primary" - attrs="{'invisible': ['|', ('status', 'not in', ['pengajuan3','refund']), ('status_payment', '!=', 'pending')]}"/> - <button name="action_create_journal_refund" - string="Journal Refund" - type="object" - class="oe_highlight" - attrs="{'invisible': ['|', ('status', 'not in', ['pengajuan3','refund']), ('journal_refund_state', '=', 'posted')]}"/> - - <field name="status" - widget="statusbar" - statusbar_visible="draft,pengajuan1,pengajuan2,pengajuan3,reject" - attrs="{'invisible': [('status', '!=', 'reject')]}" /> - - <field name="status" - widget="statusbar" - statusbar_visible="draft,pengajuan1,pengajuan2,pengajuan3,refund" - attrs="{'invisible': [('status', '=', 'reject')]}" /> - </header> - <sheet> - <div class="oe_button_box" name="button_box"> - <button name="action_open_journal_refund" - type="object" - class="oe_stat_button" - icon="fa-book" - width="250px" - attrs="{'invisible': ['|', ('journal_refund_move_id', '=', False), ('journal_refund_state', '!=', 'posted')]}"> - <field name="journal_refund_move_id" string="Journal Refund" widget="statinfo"/> - </button> - </div> - <widget name="web_ribbon" - title="PAID" - bg_color="bg-success" - attrs="{'invisible': [('status_payment', '!=', 'done')]}"/> - - <widget name="web_ribbon" - title="CANCEL" - bg_color="bg-danger" - attrs="{'invisible': [('status_payment', '!=', 'reject')]}"/> - <h1> - <field name="name" readonly="1"/> - </h1> - <group col="2"> - <group> - <field name="is_locked" invisible="1"/> - <field name="status_payment" invisible="1"/> - <field name="journal_refund_state" invisible="1"/> - - <field name="partner_id" attrs="{'readonly': [('is_locked', '=', True)]}"/> - <field name="sale_order_ids" widget="many2many_tags" attrs="{'readonly': [('is_locked', '=', True)]}"/> - <field name="invoice_ids" widget="many2many_tags" readonly="1"/> - <field name="invoice_names" widget="html" readonly="1"/> - <field name="so_names" widget="html" readonly="1"/> - <field name="advance_move_names" widget="html" readonly="1"/> - <field name="refund_type" attrs="{'readonly': [('is_locked', '=', True)]}"/> - <field name="note_refund" attrs="{'readonly': [('is_locked', '=', True)]}"/> - </group> - <group> - <field name="uang_masuk" attrs="{'readonly': [('is_locked', '=', True)]}"/> - <field name="total_invoice" attrs="{'readonly': [('is_locked', '=', True)]}"/> - <field name="ongkir" attrs="{'readonly': [('is_locked', '=', True)]}"/> - <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" - attrs="{'invisible': [('uang_masuk_type', '=', 'pdf')], 'readonly': [('is_locked', '=', True)]}"/> - <field name="bukti_uang_masuk_pdf" widget="pdf_viewer" - attrs="{'invisible': [('uang_masuk_type', '=', 'image')], 'readonly': [('is_locked', '=', True)]}"/> - </group> - </group> - - <notebook> - <page string="Produk Line"> - <field name="line_ids" attrs="{'readonly': [('is_locked', '=', True)]}"> - <tree editable="bottom"> - <field name="product_id"/> - <field name="quantity"/> - <field name="reason"/> - </tree> - </field> - </page> - - <page string="Other Info"> - <group col="2"> - <group> - <field name="user_ids" widget="many2many_tags" readonly="1"/> - <field name="created_date" readonly="1"/> - <field name="refund_date" attrs="{'readonly': [('status', 'not in', ['pengajuan3','refund'])]}"/> - </group> - <group> - <field name="bank" attrs="{'readonly': [('is_locked', '=', True)]}"/> - <field name="account_name" attrs="{'readonly': [('is_locked', '=', True)]}"/> - <field name="account_no" attrs="{'readonly': [('is_locked', '=', True)]}"/> - </group> - </group> - </page> - - <page string="Finance Note"> - <group col="2"> - <group> - <field name="finance_note" attrs="{'readonly': [('is_locked', '=', True)]}"/> - </group> - <group> - <field name="bukti_refund_type" reqiured="1" attrs="{'readonly': [('is_locked', '=', True)]}"/> - <field name="bukti_transfer_refund_pdf" widget="pdf_viewer" attrs="{'invisible': [('bukti_refund_type', '=', 'image')]}"/> - <field name="bukti_transfer_refund_image" widget="image" attrs="{'invisible': [('bukti_refund_type', '=', 'pdf')]}"/> - </group> - </group> - </page> - - <page string="Cancel Reason" attrs="{'invisible': [('status', '=', 'refund')]}"> - <group> - <field name="reason_reject"/> - </group> - </page> - </notebook> - </sheet> - <div class="oe_chatter"> - <field name="message_follower_ids" widget="mail_followers"/> - <field name="message_ids" widget="mail_thread"/> - </div> - </form> - </field> - </record> - <!-- Action --> - <record id="action_refund_sale_order" model="ir.actions.act_window"> - <field name="name">Refund Sales Order</field> - <field name="res_model">refund.sale.order</field> - <field name="view_mode">tree,form</field> - </record> - - <!-- Menu --> - <menuitem id="menu_refund_sale_order" - name="Refund" - parent="sale.sale_order_menu" - sequence="10" - action="action_refund_sale_order"/> -</odoo> |
