diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-08-22 11:25:33 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-08-22 11:25:33 +0700 |
| commit | 4988c230b5796c029047e62d6d603e3aecf5c052 (patch) | |
| tree | 12b78f9a9db0ffd78bb83427dd082b63fb5f3e39 | |
| parent | 9907f33408582ea68e11bd0b1b2bc8608c6c1c1e (diff) | |
temporary comment sales approval
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 91 | ||||
| -rwxr-xr-x | indoteknik_custom/views/sale_order.xml | 8 |
2 files changed, 49 insertions, 50 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 44eeae60..50e6baa3 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -12,40 +12,39 @@ class SaleOrder(models.Model): total_percent_margin = fields.Float( 'Total Percent Margin', compute='compute_total_margin', help="Total % Margin in Sales Order Header") - # approval_status = fields.Integer('Approval Status', copy=False) approval_status = fields.Selection([ ('pengajuan1', 'Approval Adela'), ('pengajuan2', 'Approval Tyas'), ('approved', 'Approved'), ], string='Approval Status', readonly=True, copy=False, index=True, tracking=3) - def sale_order_approve(self): - for order in self: - if order.state == 'cancel' or order.state == 'done' or order.state == 'sale': - raise UserError("Status harus draft atau sent") - approval1 = approval2 = 0 - for line in order.order_line: - if not line.product_id: - continue - if (line.item_percent_margin <= 15 or line.item_percent_margin == 100) and ( - self.env.user.id != 6 and self.env.user.id != 7): - approval2 += 1 - # order.approval_status = "pengajuan2" - # break - elif line.item_percent_margin <= 40 and (self.env.user.id != 8 and self.env.user.id != 6 and self.env.user.id != 7): - approval1 += 1 - # order.approval_status = 'pengajuan1' - # break - if approval2 > 0: - order.approval_status = 'pengajuan2' - elif approval1 > 0: - order.approval_status = 'pengajuan1' - else: - raise UserError("Bisa langsung Confirm") + # def sale_order_approve(self): + # for order in self: + # if order.state == 'cancel' or order.state == 'done' or order.state == 'sale': + # raise UserError("Status harus draft atau sent") + # approval1 = approval2 = 0 + # for line in order.order_line: + # if not line.product_id: + # continue + # if (line.item_percent_margin <= 15 or line.item_percent_margin == 100) and ( + # self.env.user.id != 6 and self.env.user.id != 7): + # approval2 += 1 + # # order.approval_status = "pengajuan2" + # # break + # elif line.item_percent_margin <= 40 and (self.env.user.id != 8 and self.env.user.id != 6 and self.env.user.id != 7): + # approval1 += 1 + # # order.approval_status = 'pengajuan1' + # # break + # if approval2 > 0: + # order.approval_status = 'pengajuan2' + # elif approval1 > 0: + # order.approval_status = 'pengajuan1' + # else: + # raise UserError("Bisa langsung Confirm") - def action_cancel(self): - self.approval_status = False - return super(SaleOrder, self).action_cancel() + # def action_cancel(self): + # self.approval_status = False + # return super(SaleOrder, self).action_cancel() def compute_total_margin(self): for order in self: @@ -61,25 +60,25 @@ class SaleOrder(models.Model): total_percent_margin = round((total_margin / order.amount_untaxed), 4) * 100 order.total_percent_margin = total_percent_margin - def action_confirm(self): - res = super(SaleOrder, self).action_confirm() - for order in self: - approval1 = approval2 = 0 - for line in order.order_line: - if not line.product_id: - continue - if (line.item_percent_margin <= 15 or line.item_percent_margin == 100) and ( - self.env.user.id != 6 and self.env.user.id != 7): - approval2 += 1 - elif line.item_percent_margin <= 40 and ( - self.env.user.id != 8 and self.env.user.id != 6 and self.env.user.id != 7): - approval1 += 1 - if approval2 > 0: - raise UserError("Need Tyas / Akbar Approval, atau Approval manual dan lampirkan di Log Internal") - elif approval1 > 0: - raise UserError("Need Adela Approval") - order.approval_status = 'approved' - return res + # def action_confirm(self): + # res = super(SaleOrder, self).action_confirm() + # for order in self: + # approval1 = approval2 = 0 + # for line in order.order_line: + # if not line.product_id: + # continue + # if (line.item_percent_margin <= 15 or line.item_percent_margin == 100) and ( + # self.env.user.id != 6 and self.env.user.id != 7): + # approval2 += 1 + # elif line.item_percent_margin <= 40 and ( + # self.env.user.id != 8 and self.env.user.id != 6 and self.env.user.id != 7): + # approval1 += 1 + # if approval2 > 0: + # raise UserError("Need Tyas / Akbar Approval, atau Approval manual dan lampirkan di Log Internal") + # elif approval1 > 0: + # raise UserError("Need Adela Approval") + # order.approval_status = 'approved' + # return res class SaleOrderLine(models.Model): diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index e0b4ab4d..82058837 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -7,10 +7,10 @@ <field name="inherit_id" ref="sale.view_order_form"/> <field name="arch" type="xml"> <button id="action_confirm" position="after"> - <button name="sale_order_approve" - string="Ask Approval" - type="object" - /> +<!-- <button name="sale_order_approve"--> +<!-- string="Ask Approval"--> +<!-- type="object"--> +<!-- />--> </button> <field name="payment_term_id" position="after"> <field name="approval_status" /> |
