'Computes the number of badges remaining the user can send
0 if not allowed or no remaining
integer if limited sending
-1 if infinite (should not be displayed)'

@api.depends('rule_auth', 'rule_auth_user_ids', 'rule_auth_badge_ids', 'rule_max', 'rule_max_number', 'stat_my_monthly_sending')
def _remaining_sending_calc(self):

    for badge in self:
        if (badge._can_grant_badge() != self.CAN_GRANT):
            badge.remaining_sending = 0
        elif (not badge.rule_max):
            badge.remaining_sending = (-1)
        else:
            badge.remaining_sending = (badge.rule_max_number - badge.stat_my_monthly_sending)
