what I should put in the search([ ]) to match date in different model/database?
Hi all, Thanks for you guys help, I have some overall understanding on using @api.depends do the calculation. But I still have some questions on this.
Here is my code:
_name = 'cost.summary'
total = XXXXX
cost_line = fields.One2many('cost.details', inverse_name='cost_id')
for rec in self:
cost_rec = rec.env['hr.expense.line'].search([('cost_id', '=', id)])
rec.total = sum(cost_rec.mapped('cost_line_cost'))
_name = 'cost.details'
cost_id = fields.Many2one('cost.summary', ondelete='cascade')
cost_line_id = fields.Char(string="SubExpense")
cost_line_desc = fields.Text(string="SubExpense Description")
cost_line_cost = fields.Float(string='Cost')
what make me confusing is that, inside the search([ ]), what I should put to make cost_id and cost_line match up? I have tried search([('cost_id', '=', id)]), search([('cost_id', '=', cost_line)])... none of them work. why I using id is because id is the name in the database.
Can anyone please show me what I missed? any hint will be useful, Thanks a lot!