parent
65a83436e1
commit
b8011c7a95
12
load.py
12
load.py
|
@ -52,6 +52,10 @@ class Load(metaclass=PoolMeta):
|
|||
def search_unit_loads(cls, name, clause):
|
||||
return [('orders.unit_loads', ) + tuple(clause[1:])]
|
||||
|
||||
@property
|
||||
def ul_quantity(self):
|
||||
return sum(o.ul_quantity for o in self.orders)
|
||||
|
||||
|
||||
class LoadOrder(metaclass=PoolMeta):
|
||||
__name__ = 'carrier.load.order'
|
||||
|
@ -145,12 +149,12 @@ class LoadOrder(metaclass=PoolMeta):
|
|||
return [('lines.unit_loads', ) + tuple(clause[1:])]
|
||||
|
||||
def get_carrier_amount(self, name=None):
|
||||
if (not self.load.unit_price or not self.unit_loads or
|
||||
not self.load.unit_loads):
|
||||
if (not self.load.unit_price or not self.ul_quantity or
|
||||
not self.load.ul_quantity):
|
||||
return 0
|
||||
return self.load.currency.round(
|
||||
(Decimal(len(self.unit_loads)) / Decimal(len(
|
||||
self.load.unit_loads))) * self.load.unit_price)
|
||||
(Decimal(len(self.ul_quantity)) / Decimal(len(
|
||||
self.load.ul_quantity))) * self.load.unit_price)
|
||||
|
||||
@classmethod
|
||||
def cancel(cls, records):
|
||||
|
|
Loading…
Reference in New Issue