26.03.26
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user