This commit is contained in:
2026-03-26 19:15:14 +01:00
parent 841f7a1c20
commit 8b6b93171f
5 changed files with 4153 additions and 4 deletions

View File

@@ -249,3 +249,49 @@ class Invoice(metaclass=PoolMeta):
if shipment:
return shipment.number or ''
return ''
class InvoiceLine(metaclass=PoolMeta):
__name__ = 'account.invoice.line'
def _get_report_trade(self):
origin = getattr(self, 'origin', None)
if not origin:
return None
return getattr(origin, 'sale', None) or getattr(origin, 'purchase', None)
@property
def report_product_description(self):
if self.product:
return self.product.description or ''
origin = getattr(self, 'origin', None)
if origin and getattr(origin, 'product', None):
return origin.product.description or ''
return ''
@property
def report_crop_name(self):
trade = self._get_report_trade()
if trade and getattr(trade, 'crop', None):
return trade.crop.name or ''
return ''
@property
def report_attributes_name(self):
origin = getattr(self, 'origin', None)
if origin:
return getattr(origin, 'attributes_name', '') or ''
return ''
@property
def report_net(self):
if self.type == 'line':
return self.quantity
return ''
@property
def report_lbs(self):
net = self.report_net
if net == '':
return ''
return Decimal(net) * Decimal('2.20462')