[FIX] account: A traceback occurs because self.ids is empty in the

context of the creation of a new record

closes odoo/odoo#146019

X-original-commit: c3aea407ccf9903ea9b43edfdd0289b63c478ffb
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
This commit is contained in:
Roy Le
2024-03-14 14:02:07 +00:00
committed by Antoine Dupuis (andu)
parent d11ece23e9
commit ed4bc1e838
+4
View File
@@ -335,6 +335,10 @@ class ResPartner(models.Model):
@api.depends_context('company')
def _credit_debit_get(self):
if not self.ids:
self.debit = False
self.credit = False
return
tables, where_clause, where_params = self.env['account.move.line']._where_calc([
('parent_state', '=', 'posted'),
('company_id', 'child_of', self.env.company.root_id.id)