İçereği Atla
Menü
Bu soru işaretlendi
4358 Görünümler

Hi All,

I have inherit an action_confirm in sale order module and write the state changed to an Approved and then after just simply shows a warning or alert message without any user restricts.

Below i have shared my code..

@api.multi
def action_confirm(self):
super(SaleOrder, self).action_confirm()
for order in self:
if not order.user_is_manager:
credit_limit = order.partner_id.limit
order_amount = self.amount_total
cal_credit_avail = credit_limit - order_amount

if cal_credit_avail < self.amount_total:

order.write({'state': 'approve'})

message = _('The credit limit of %s the %s Customer') % (self.partner_id.credit_limit, self.partner_id.name)
warning_mess = {'title': _('Credit Limit!'), 'message': message}
            return {'warning': warning_mess}
Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Nis 25
6195
0
Oca 25
738
1
May 25
945
2
Kas 24
2181
4
Şub 24
12304