2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 11:10:54 +00:00

Fix missing context items (#9819)

* Fix missing context items

* Fix typo in docstring
This commit is contained in:
Oliver
2025-06-21 17:27:39 +10:00
committed by GitHub
parent ab9c6bae3e
commit cc40af6199
2 changed files with 22 additions and 3 deletions

View File

@ -948,7 +948,7 @@ class InvenTreeBarcodeMixin(models.Model):
This is used to generate a efficient QR code for the model type. This is used to generate a efficient QR code for the model type.
It is expected to match this pattern: [0-9A-Z $%*+-.\/:]{2} It is expected to match this pattern: [0-9A-Z $%*+-.\/:]{2}
Note: Due to the shape constrains (45**2=2025 different allowed codes) Note: Due to the shape constraints (45**2=2025 different allowed codes)
this needs to be explicitly implemented in the model class to avoid collisions. this needs to be explicitly implemented in the model class to avoid collisions.
""" """
raise NotImplementedError( raise NotImplementedError(

View File

@ -58,11 +58,22 @@ class CompanyReportContext(report.mixins.BaseReportContext):
"""Report context for the Company model. """Report context for the Company model.
Attributes: Attributes:
company: The Company object associated with this context
name: The name of the Company name: The name of the Company
primary_address: The primary address associated with the Company description: A description of the Company
website: The website URL for the Company
phone: The contact phone number for the Company
email: The contact email address for the Company
address: The primary address associated with the Company
""" """
company: 'Company'
name: str name: str
description: str
website: str
phone: str
email: str
address: str
class Company( class Company(
@ -114,7 +125,15 @@ class Company(
def report_context(self) -> CompanyReportContext: def report_context(self) -> CompanyReportContext:
"""Generate a dict of context data to provide to the reporting framework.""" """Generate a dict of context data to provide to the reporting framework."""
return {'name': self.name} return {
'company': self,
'name': self.name,
'description': self.description,
'website': self.website,
'phone': self.phone,
'email': self.email,
'address': str(self.address) if self.address else '',
}
name = models.CharField( name = models.CharField(
max_length=100, max_length=100,