Skip to content

Commit

Permalink
Merge PR OCA#114 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Dec 11, 2020
2 parents 348e155 + ccb67a4 commit 33b9e22
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions sale_financial_risk/models/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class SaleOrder(models.Model):
_inherit = 'sale.order'

def risk_exception_msg(self):
self.ensure_one()
risk_amount = self.currency_id._convert(
self.amount_total, self.company_id.currency_id,
self.company_id, self.confirmation_date and
Expand All @@ -33,14 +34,15 @@ def risk_exception_msg(self):
@api.multi
def action_confirm(self):
if not self.env.context.get('bypass_risk', False):
exception_msg = self.risk_exception_msg()
if exception_msg:
return self.env['partner.risk.exceeded.wiz'].create({
'exception_msg': exception_msg,
'partner_id': self.partner_id.commercial_partner_id.id,
'origin_reference': '%s,%s' % ('sale.order', self.id),
'continue_method': 'action_confirm',
}).action_show()
for order in self:
exception_msg = order.risk_exception_msg()
if exception_msg:
return self.env['partner.risk.exceeded.wiz'].create({
'exception_msg': exception_msg,
'partner_id': order.partner_id.commercial_partner_id.id,
'origin_reference': '%s,%s' % ('sale.order', order.id),
'continue_method': 'action_confirm',
}).action_show()
return super(SaleOrder, self).action_confirm()

@api.model
Expand Down

0 comments on commit 33b9e22

Please sign in to comment.