@@ -144,7 +144,6 @@ class AccrualPostings(core.RelatedPostings):
_FIELDS: Dict[str, Callable[[data.Posting], MetaValue]] = {
'account': operator.attrgetter('account'),
'contract': _meta_getter('contract'),
'cost': operator.attrgetter('cost'),
'entity': _meta_getter('entity'),
'invoice': _meta_getter('invoice'),
'purchase_order': _meta_getter('purchase-order'),
@@ -157,8 +156,6 @@ class AccrualPostings(core.RelatedPostings):
'accounts',
'contract',
'contracts',
'cost',
'costs',
'entity',
'entitys',
'entities',
@@ -226,6 +223,17 @@ class AccrualPostings(core.RelatedPostings):
get_func(post),
)
yield Error(post.meta, errmsg, post.meta.txn)
costs = collections.defaultdict(set)
for post in self:
costs[post.units.currency].add(post.cost)
for code, currency_costs in costs.items():
if len(currency_costs) > 1:
if post.units.currency == code:
errmsg = 'inconsistent cost for invoice {}: {}'.format(
self.invoice or "<none>", post.cost,
def is_paid(self, default: Optional[bool]=None) -> Optional[bool]:
if self.accrual_type is None: