Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1800 Visualizzazioni

Dear all

I want to restrict account Budget entries on the basis of practical_amount exceeds planned _amount.

I have created new selection filed for budget type as flexible & strict in budget form. using onchange fuction for selection of strict budget filed need to restrict entries if it exceeded with warning.

class CrossoveredBudget(models.Model):
_inherit = "crossovered.budget"
budget_type = fields.Selection([('flexible', 'Flexible'), ('strict', 'Strict')],string="Budget Type", required=True)

@api.onchange("budget_type")
def change_budget_type(self):
if self.budget_type == "strict":
raise exceptions.UserError(_(
'This invoice exceeds the limits set in the Budget, use '
'another journal in order to validate this invoice'
))



Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
ago 25
3765
1
lug 24
1746
3
dic 23
1955
1
mag 23
2678
0
set 17
3395