Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. @api.multi
  2. def button_confirm(self):
  3. """ Sobreescrita funcion para agregar nueva validacion de aprobacion
  4. de usuarios """
  5. for order in self:
  6. if order.state not in ['draft', 'sent']:
  7. continue
  8. order._add_supplier_to_product()
  9. # Deal with double validation process
  10. if order.company_id.po_double_validation == 'one_step'\
  11. 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)):
  12. order.button_approve()
  13. 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):
  14. # crea los usuarios que van a aprobar la orden de compra
  15. self.create_users_previous_approval_level()
  16. order.write({'state': 'to approve'})
  17. if self.check_user_one_approval():
  18. order.button_approve()
  19. elif order.company_id.mail_purchase_approval_check:
  20. self.get_url_purchase_order()
  21. order.button_approve()
  22. self.send_mail_to_user_approval()
  23.  
  24. else:
  25. order.button_approve()
  26. return True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement