Merge pull request #934 from expsa/project_test

Update project_invoice.py
This commit is contained in:
zainab2097 2024-09-01 17:49:28 +03:00 committed by GitHub
commit 49b13222e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -355,8 +355,12 @@ class ProjectInvoiceLine(models.Model):
:param optional_values: any parameter that should be added to the returned invoice line
"""
self.ensure_one()
res = {
'name': self.name+'/'+self.project_invoice_id.project_id.name,
# Convert to string to avoid TypeError
name = str(self.name) if self.name else ''
project_name = str(self.project_invoice_id.project_id.name) if self.project_invoice_id and self.project_invoice_id.project_id.name else ''
res = {
'name': name + '/' + project_name,
'account_id': self.project_invoice_id.project_id.category_id.account_id and self.project_invoice_id.project_id.category_id.account_id.id or False,
'product_id': self.product_id.id,
'product_uom_id': self.product_uom.id,