diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2026-03-11 15:05:48 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2026-03-11 15:05:48 +0700 |
| commit | 38fe4570a429e711ed04b41a75f395a2d2d821a5 (patch) | |
| tree | fee24a504ba8231876bc79a19b9eea2e06073ef2 | |
| parent | 9e5744f9e219d284eebb2ee006a772ba78ad054d (diff) | |
| parent | a637972fca56a9f2e62636f7639cf27de033b248 (diff) | |
Merge branch 'odoo-backup' of bitbucket.org:altafixco/indoteknik-addons into odoo-backup
# Conflicts:
# indoteknik_custom/models/purchase_order.py
# indoteknik_custom/security/ir.model.access.csv
| -rw-r--r-- | indoteknik_custom/models/account_move.py | 46 | ||||
| -rw-r--r-- | indoteknik_custom/models/commision.py | 2 | ||||
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 3 | ||||
| -rw-r--r-- | indoteknik_custom/models/refund_sale_order.py | 14 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 44 | ||||
| -rwxr-xr-x | indoteknik_custom/security/ir.model.access.csv | 2 | ||||
| -rw-r--r-- | indoteknik_custom/views/account_move.xml | 42 | ||||
| -rw-r--r-- | indoteknik_custom/views/account_move_line.xml | 43 | ||||
| -rwxr-xr-x | indoteknik_custom/views/purchase_order.xml | 1 |
9 files changed, 175 insertions, 22 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index a317dccc..723f225c 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -786,6 +786,24 @@ class AccountMove(models.Model): if rec.statement_line_id and not rec.statement_line_id.statement_id.is_edit and rec.statement_line_id.statement_id.state == 'confirm': raise UserError('Bank Statement di Lock, Minta admin reconcile untuk unlock') return res + + def action_open_change_date_wizard(self): + if not self.env.user.is_accounting: + raise UserError('Hanya Accounting yang bisa edit tanggal journal entry') + non_draft = self.filtered(lambda m: m.state != 'draft') + if non_draft: + raise UserError('Hanya invoice dengan status draft yang bisa diubah tanggalnya. Mohon reset ke draft terlebih dahulu.') + return{ + 'name': 'Change Date Journal Entry', + 'type': 'ir.actions.act_window', + 'view_mode': 'form', + 'res_model': 'account.move.change.date.wizard', + 'target': 'new', + 'context':{ + 'active_ids': self.ids, + 'active_model': self._name, + } + } def action_post(self): if self._name != 'account.move': @@ -997,3 +1015,31 @@ class SyncPromiseDateWizardLine(models.TransientModel): date_terima_tukar_faktur = fields.Date(related="invoice_id.date_terima_tukar_faktur", string="Tanggal Terima Tukar Faktur", readonly=True) amount_total = fields.Monetary(related="invoice_id.amount_total", string="Total", readonly=True) currency_id = fields.Many2one(related="invoice_id.currency_id", readonly=True) + +class AccountMoveChangeDateWizard(models.TransientModel): + _name = "account.move.change.date.wizard" + _description = "Account Move Change Date Wizard" + + # move_id = fields.Many2one('account.move', string="Journal Entry", required=True) + new_date = fields.Date(string="New Date", required=True) + + def action_change_date(self): + if not self.env.user.is_accounting: + raise UserError('Hanya Accounting yang bisa ubah tanggal') + + active_ids = self.env.context.get('active_ids', []) + moves = self.env['account.move'].browse(active_ids) + + if not moves: + raise UserError("Tidak ada journal entry yang dipilih.") + + non_draft_moves = moves.filtered(lambda m: m.state != 'draft') + if non_draft_moves: + raise UserError("Hanya journal entry dengan status 'Draft' yang dapat diubah tanggalnya.") + + for move in moves: + move.write({'date': self.new_date}) + move.message_post(body="Tanggal berhasil diubah") + + return {'type': 'ir.actions.act_window_close'} +
\ No newline at end of file diff --git a/indoteknik_custom/models/commision.py b/indoteknik_custom/models/commision.py index 983c07fe..afd36bc7 100644 --- a/indoteknik_custom/models/commision.py +++ b/indoteknik_custom/models/commision.py @@ -443,7 +443,7 @@ class CustomerCommision(models.Model): self.approved_by = (self.approved_by + ', ' if self.approved_by else '') + self.env.user.name self.date_approved_pimpinan = now_naive self.position_pimpinan = 'Pimpinan' - elif self.status == 'pengajuan4' and (self.env.user.id == 1272 or self.env.user.has_group('indoteknik_custom.group_role_it')): + elif self.status == 'pengajuan4' and (self.env.user.id in [1272,14075,571] or self.env.user.has_group('indoteknik_custom.group_role_it')): for line in self.commision_lines: line.invoice_id.is_customer_commision = True if self.commision_type == 'fee': diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 427cc9fc..1c573371 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -1640,6 +1640,9 @@ class PurchaseOrder(models.Model): self._send_po_not_sync() send_email = True break + + # if self.partner_id.id == 5571 and not self.revisi_po: + # self.action_create_order_altama() if send_email: if self.is_local_env(): diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index 4c3ca52e..6acd0b59 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -680,6 +680,20 @@ class RefundSaleOrder(models.Model): ('journal_id', '=', 13), ('state', '=', 'posted'), ]) + if rec.sale_order_ids: + so_records = rec.sale_order_ids + so_names = so_records.mapped('name') + domain = [ + ('journal_id', '=', 13), + ('state', '=', 'posted'), + ('sale_id', '=', False), + ('ref', 'ilike', 'selisih'), + ] + domain += ['|'] * (len(so_names) - 1) + for name in so_names: + domain.append(('ref', 'ilike', name)) + + misc = self.env['account.move'].search(domain) moves_ongkir = self.env['account.move'] if rec.sale_order_ids: diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 19a22cec..2b064042 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -157,7 +157,7 @@ class SaleOrder(models.Model): total_margin_excl_third_party = fields.Float('Before Margin', help="Before Margin in Sales Order Header") approval_status = fields.Selection([ - ('pengajuan0', 'Approval Team Sales'), + ('pengajuan0', 'Approval Leader Team Sales'), ('pengajuan1', 'Approval Manager'), ('pengajuan2', 'Approval Pimpinan'), ('approved', 'Approved'), @@ -2627,12 +2627,15 @@ class SaleOrder(models.Model): self.check_credit_limit() self.check_limit_so_to_invoice() order.approval_status = 'pengajuan0' - order.message_post(body="Mengajukan approval ke Team Sales_") + order.message_post(body="Mengajukan approval ke Leader Team Sales_") + return self._create_approval_notification('Team Sales') + elif order._requires_approval_team_sales(): + self.check_product_bom() + self.check_credit_limit() + self.check_limit_so_to_invoice() + order.approval_status = 'pengajuan0' + order.message_post(body="Mengajukan approval ke Leader Team Sales") return self._create_approval_notification('Team Sales') - elif order._requires_approval_margin_leader(): - order.approval_status = 'pengajuan2' - order.message_post(body="Mengajukan approval ke Pimpinan") - return self._create_approval_notification('Pimpinan') elif order._requires_approval_margin_manager(): self.check_product_bom() self.check_credit_limit() @@ -2640,13 +2643,11 @@ class SaleOrder(models.Model): order.approval_status = 'pengajuan1' order.message_post(body="Mengajukan approval ke Sales Manager") return self._create_approval_notification('Sales Manager') - elif order._requires_approval_team_sales(): - self.check_product_bom() - self.check_credit_limit() - self.check_limit_so_to_invoice() - order.approval_status = 'pengajuan0' - order.message_post(body="Mengajukan approval ke Team Sales") - return self._create_approval_notification('Team Sales') + elif order._requires_approval_margin_leader(): + order.approval_status = 'pengajuan2' + order.message_post(body="Mengajukan approval ke Pimpinan") + return self._create_approval_notification('Pimpinan') + # elif value_trigger: # self.check_product_bom() # self.check_credit_limit() @@ -2921,18 +2922,19 @@ class SaleOrder(models.Model): value_trigger = order._requires_approval_by_value() if value_trigger: order.approval_status = 'pengajuan0' - order.message_post(body="Mengajukan approval ke Team Sales") + order.message_post(body="Mengajukan approval ke Leader Team Sales") return self._create_approval_notification('Team Sales') - elif order._requires_approval_margin_leader(): - order.approval_status = 'pengajuan2' - return self._create_approval_notification('Pimpinan') - elif order._requires_approval_margin_manager(): - order.approval_status = 'pengajuan1' - return self._create_approval_notification('Sales Manager') elif value_trigger or order._requires_approval_team_sales(): order.approval_status = 'pengajuan0' - order.message_post(body="Mengajukan approval ke Team Sales") + order.message_post(body="Mengajukan approval ke Leader Team Sales") return self._create_approval_notification('Team Sales') + elif order._requires_approval_margin_manager(): + order.approval_status = 'pengajuan1' + return self._create_approval_notification('Sales Manager') + elif order._requires_approval_margin_leader(): + order.approval_status = 'pengajuan2' + return self._create_approval_notification('Pimpinan') + # elif value_trigger: # order.approval_status = 'pengajuan0' # order.message_post(body="Mengajukan approval ke Team Sales (Total SO > 50jt)") diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index 315a0413..e869fff1 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -224,3 +224,5 @@ access_keywords,keywords,model_keywords,base.group_user,1,1,1,1 access_token_log,access.token.log,model_token_log,,1,1,1,1 access_purchase_order_forecast_line,access.purchase.order.forecast.line,model_purchase_order_forecast_line,,1,1,1,1 access_sale_forecast_coverage,access.sale.forecast.coverage,model_sale_forecast_coverage,,1,1,1,1 + +access_account_move_change_date_wizard,access.account.move.change.date.wizard,model_account_move_change_date_wizard,,1,1,1,1 diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml index c5f9580c..4b9f5316 100644 --- a/indoteknik_custom/views/account_move.xml +++ b/indoteknik_custom/views/account_move.xml @@ -218,6 +218,48 @@ <field name="code">action = records.export_faktur_to_xml()</field> </record> + <record id="action_set_to_draft_journal_entry" model="ir.actions.server"> + <field name="name">Set to Draft</field> + <field name="model_id" ref="account.model_account_move" /> + <field name="binding_model_id" ref="account.model_account_move" /> + <field name="state">code</field> + <field name="code">action = records.button_draft()</field> + </record> + + <!-- <record id="action_account_move_change_date_wizard" model="ir.actions.act_window"> + <field name="name">Change Date</field> + <field name="res_model">account.move.change.date.wizard</field> + <field name="view_mode">form</field> + <field name="target">new</field> + <field name="binding_model_id" ref="account.model_account_move"/> + <field name="binding_view_types">list</field> + </record> --> + + <record id="action_change_date" model="ir.actions.server"> + <field name="name">Change Date</field> + <field name="model_id" ref="account.model_account_move"/> + <field name="binding_model_id" ref="account.model_account_move"/> + <field name="state">code</field> + <field name="code">action = records.action_open_change_date_wizard()</field> + </record> + + <record id="view_account_move_change_date_wizard_form" model="ir.ui.view"> + <field name="name">account.move.change.date.wizard.form</field> + <field name="model">account.move.change.date.wizard</field> + <field name="arch" type="xml"> + <form string="Change Date"> + <p>Ubah tanggal journal yang dipilih, pastikan untuk memeriksa kembali tanggal yang akan diubah sebelum mengkonfirmasi perubahan.</p> + <group> + <field name="new_date"/> + </group> + <footer> + <button name="action_change_date" string="Confirm" type="object" class="btn-primary"/> + <button string="Cancel" class="btn-secondary" special="cancel"/> + </footer> + </form> + </field> + </record> + <record id="view_sync_promise_date_wizard_form" model="ir.ui.view"> <field name="name">sync.promise.date.wizard.form</field> <field name="model">sync.promise.date.wizard</field> diff --git a/indoteknik_custom/views/account_move_line.xml b/indoteknik_custom/views/account_move_line.xml index 346494f3..1e4b258e 100644 --- a/indoteknik_custom/views/account_move_line.xml +++ b/indoteknik_custom/views/account_move_line.xml @@ -24,6 +24,49 @@ </xpath> </field> </record> + <record id="view_move_line_tree_grouped_partner_inherit" model="ir.ui.view"> + <field name="name">account.move.line.tree.grouped.partner.inherit</field> + <field name="model">account.move.line</field> + <field name="inherit_id" ref="account.view_move_line_tree_grouped"/> + <field name="arch" type="xml"> + <xpath expr="//field[@name='analytic_tag_ids']" position="replace"> + <field name="analytic_tag_ids" + widget="many2many_tags" + optional="hide"/> + </xpath> + </field> + </record> + + <record id="view_account_move_line_filter_inherit" model="ir.ui.view"> + <field name="name">account.move.line.filter.inherit</field> + <field name="model">account.move.line</field> + <field name="inherit_id" ref="account.view_account_move_line_filter"/> + <field name="arch" type="xml"> + <xpath expr="//search" position="inside"> + <field name="analytic_tag_ids" + string="Analytic Tag" + filter_domain="[('analytic_tag_ids.name','ilike', self)]"/> + </xpath> + <!-- <xpath expr="//search" position="inside"> + <field name="analytic_account_id" + string="Analytic Account" + filter_domain="[('analytic_account_id.name','ilike', self)]"/> + + </xpath> + <xpath expr="//search/group" position="inside"> + <filter string="Analytic Tag" + name="group_by_analytic_tag" + domain="[]" + context="{'group_by': 'analytic_tag_ids'}"/> + </xpath> + <xpath expr="//search/group" position="inside"> + <filter string="Analytic Account" + name="group_by_analytic_account" + domain="[]" + context="{'group_by': 'analytic_account_id'}"/> + </xpath> --> + </field> + </record> </data> <data> <record id="action_gl_reconcile_server" model="ir.actions.server"> diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index 56e74d46..c2a45c7a 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -51,6 +51,7 @@ string="Create Order Altama" class="oe_highlight" icon="fa-cloud-upload" + confirm="Yakin ingin Membuat PO ini ke Altama?" attrs="{'invisible': [('partner_id', '!=', 5571)]}" /> <button name="action_get_order_altama" |
