Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @api.multi
- def button_confirm(self):
- """ Sobreescrita funcion para agregar nueva validacion de aprobacion
- de usuarios """
- for order in self:
- if order.state not in ['draft', 'sent']:
- continue
- order._add_supplier_to_product()
- # Deal with double validation process
- if order.company_id.po_double_validation == 'one_step'\
- or (order.company_id.po_double_validation == 'two_step' and order.amount_total < self.env.user.company_id.currency_id.compute(order.company_id.po_double_validation_amount, order.currency_id)):
- order.button_approve()
- elif order.company_id.po_double_validation == 'user_approval' and self.amount_total > self.env.user.company_id.currency_id.compute(order.general_po_max, order.currency_id):
- # crea los usuarios que van a aprobar la orden de compra
- self.create_users_previous_approval_level()
- order.write({'state': 'to approve'})
- if self.check_user_one_approval():
- order.button_approve()
- elif order.company_id.mail_purchase_approval_check:
- self.get_url_purchase_order()
- order.button_approve()
- self.send_mail_to_user_approval()
- else:
- order.button_approve()
- return True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement