Skip to content

Commit

Permalink
partner_address_two_lines: fix display
Browse files Browse the repository at this point in the history
  • Loading branch information
JuMiSanAr committed Jun 22, 2023
1 parent 5cf25d6 commit 1a5bd58
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions partner_address_two_lines/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ class ResPartner(models.Model):

def _get_contact_name(self, partner, name):
if self.env.context.get("_two_lines_partner_address"):
return "{}\n {}".format(
partner.commercial_company_name or partner.sudo().parent_id.name, name
)
else:
return super()._get_contact_name(partner, name)
company_name = partner.commercial_company_name
partner_name = partner.name
if company_name and partner_name:
# Only display two lines if both values are found,
# otherwise revert to the standard behavior.
return "{}\n {}".format(
company_name, partner_name
)
return super()._get_contact_name(partner, name)

0 comments on commit 1a5bd58

Please sign in to comment.