diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-06-20 18:00:42 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-06-20 18:00:42 +0700 |
| commit | 837228a2b4b799de182e52096f638ee5f491137a (patch) | |
| tree | ec6885ea4ae9c52cdd34871c79d4f770defda5a7 | |
| parent | 7b5e3a665220ebdc1f4c680df2202dc4eb12f4e3 (diff) | |
fix code receipt approval
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 11 | ||||
| -rw-r--r-- | indoteknik_custom/views/stock_picking.xml | 24 |
2 files changed, 24 insertions, 11 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 74fd0356..d8c24e10 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -57,7 +57,7 @@ class StockPicking(models.Model): approval_receipt_status = fields.Selection([ ('pengajuan1', 'Approval Logistic'), ('approved', 'Approved'), - ], string='Approval Status', readonly=True, copy=False, index=True, tracking=3, help="Approval Status untuk Receipt") + ], string='Approval Receipt Status', readonly=True, copy=False, index=True, tracking=3, help="Approval Status untuk Receipt") approval_return_status = fields.Selection([ ('pengajuan1', 'Approval Finance'), @@ -211,6 +211,12 @@ class StockPicking(models.Model): raise UserError("Qty tidak boleh 0") pick.approval_status = 'pengajuan1' + def ask_receipt_approval(self): + if self.env.user.is_logistic_approver: + raise UserError('Bisa langsung validate tanpa Ask Receipt') + else: + self.approval_receipt_status = 'pengajuan1' + def ask_return_approval(self): for pick in self: if self.env.user.is_accounting: @@ -270,9 +276,8 @@ class StockPicking(models.Model): if self.is_internal_use and not self.env.user.is_accounting: raise UserError("Harus di Approve oleh Accounting") - print(self.picking_type_id.id) if self.picking_type_id.id == 28 and not self.env.user.is_logistic_approver: - raise UserError("Harus di Approve oleh Eplin") + raise UserError("Harus di Approve oleh Logistik") if self.group_id.sale_id: if self.group_id.sale_id.payment_link_midtrans: diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index 02003e05..f95db854 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -27,6 +27,11 @@ type="object" attrs="{'invisible': [('is_internal_use', '=', False)]}" /> + <button name="ask_receipt_approval" + string="Ask Receipt" + type="object" + attrs="{'invisible': ['|', ('state', 'in', ['done']), ('approval_receipt_status', '=', 'pengajuan1')]}" + /> <button name="ask_return_approval" string="Ask Return/Acc" type="object" @@ -39,12 +44,6 @@ /> </button> <field name="backorder_id" position="after"> - <field name="is_internal_use" - string="Internal Use" - type="object" - attrs="{'readonly': True}" - force_save="1" - /> <field name="summary_qty_detail"/> <field name="count_line_detail"/> </field> @@ -53,8 +52,6 @@ </field> <field name="origin" position="after"> <field name="date_doc_kirim"/> - <field name="approval_status" attrs="{'invisible': [('is_internal_use', '=', False)]}"/> - <field name="approval_return_status" attrs="{'invisible': [('approval_return_status', '=', False)]}"/> <field name="summary_qty_operation"/> <field name="count_line_operation"/> <field name="account_id" @@ -65,6 +62,17 @@ }" /> </field> + <field name="group_id" position="before"> + <field name="is_internal_use" + string="Internal Use" + type="object" + attrs="{'readonly': True}" + force_save="1" + /> + <field name="approval_status"/> + <field name="approval_receipt_status"/> + <field name="approval_return_status"/> + </field> <field name="product_id" position="before"> <field name="line_no" attrs="{'readonly': 1}"/> </field> |
