I want to store definitely data of a TransientModel. I notice that after registered data through TransientModel it disappeared after a while.
I try this but it doesn't worked :
class BudgLineBudg(models.TransientModel):
_name = "budg_line_budg"
budg_lbudg_id = fields.Many2one("budg_lbudg")
rubrique_id = fields.Many2one("budg_rubrique", string = "Rubrique")
mnt_ant1 = fields.Integer(string = "Montant antérieur 1", size = 15)
mnt_ant2 = fields.Integer(string = "Montant antérieur 2", size = 15)
mnt_precedent = fields.Integer(string = "Montant précédent", size = 15)
mnt_budgetise = fields.Integer(string = "Montant budgétisé", size = 15)
@api.model
def get_lbudg(self,fields):
conf = self.env['ir.config_parameter']
return {
'budg_lbudg_id': str(conf.get_param('line_budg.budg_lbudg_id')),
'rubrique_id': str(conf.get_param('line_budg.rubrique_id')),
'mnt_ant1': int(conf.get_param('line_budg.mnt_ant1')),
'mnt_ant2': int(conf.get_param('line_budg.mnt_ant2')),
'mnt_precedent': int(conf.get_param('line_budg.mnt_precedent')),
'mnt_budgetise': int(conf.get_param('line_budg.mnt_budgetise')),
}
@api.one
def set_lbudg(self,fields):
conf = self.env['ir.config_parameter']
conf.set_param('line_budg.budg_lbudg_id', str(self.budg_lbudg_id)),
conf.set_param('line_budg.rubrique_id', str(self.rubrique_id)),
conf.set_param('line_budg.mnt_ant1', str(self.mnt_ant1)),
conf.set_param('line_budg.mnt_ant2', str(self.mnt_ant2)),
conf.set_param('line_budg.mnt_precedent', str(self.mnt_precedent)),
conf.set_param('line_budg.mnt_budgetise', str(self.mnt_budgetise))