Hello all,
I want to display lines of another models in a new tab.
I already write that but it doesn't work :
I just created a variable named "liaison_tableau_honoraires_line" in my model "apel.budget.facture" like this :
liaison_tableau_honoraires_line = fields.One2many('tableau.honoraires.line', 'liaison_apel_budget_facture', string='Liaison vers les lignes')
For me it has to link with the model "tableau.honoraires.line" and the other variable "liaison_apel_budget_facture"
Here this model and this variable :
class TableauHonorairesLine(models.TransientModel):
_name='tableau.honoraires.line'
_inherit = ['mail.thread']
categorie = fields.Char(string='Onglet')
budget_ht = fields.Char(string='Initial HT')
actualise_ht = fields.Char(string='Actualisé HT')
cmd_ht = fields.Char(string='CMD HT')
liaison_fac_terrain = fields.Many2one('apel.budget.facture.terrain', string='Liaison Terrain') liaison_apel_budget_facture = fields.Many2one('apel.budget.facture', string='Liaison apel budget facture')
Now that I have created this link between both models, I want to print all lines of model "terrains_ids" (which is "apel.budget.facture) in my new tab in "tableau.honoraires.line", I wrote that :
def add_line_honoraires(self):
result = []
add_line = self.env['apel.budget.facture'].browse(self._context.get('active_ids', []))
for record in add_line:
# Onglet Terrain
if record.terrain_ids:
for terrains in record.terrain_ids:
result.append((0,0,{
'categorie': 'Terrain',
'budget_ht': terrains.budget_ht,
'actualise_ht': terrains.actualise_ht,
'cmd_ht': terrains.montant_ht,
'liaison_fac_terrain': terrains.id, 'liaison_apel_budget_facture': self.id,
}))
self.liaison_tableau_honoraires_line = result
but nothing happens, the table is created but remains empty, I don't know what I'm doing wrong, if anyone can help me !
Here is my XML code for display the table :
Thanks in advance