Use party with origin's company in the context to retrieve accounts when applying statement rule
Closes #14740 (grafted from d6e797ed25c68b052cefc5ccde35995f40028a3b) --HG-- branch : 6.0
This commit is contained in:
@@ -321,6 +321,7 @@ class StatementRuleLine(sequence_ordered(), ModelSQL, ModelView):
|
||||
def get_line(self, origin, keywords, **context):
|
||||
pool = Pool()
|
||||
Line = pool.get('account.statement.line')
|
||||
Party = pool.get('party.party')
|
||||
context.setdefault('functions', {})['Decimal'] = Decimal
|
||||
context.setdefault('names', {}).update(keywords)
|
||||
|
||||
@@ -339,7 +340,10 @@ class StatementRuleLine(sequence_ordered(), ModelSQL, ModelView):
|
||||
if invoice:
|
||||
account = invoice.account
|
||||
elif party:
|
||||
with Transaction().set_context(date=origin.date):
|
||||
with Transaction().set_context(
|
||||
date=origin.date,
|
||||
company=origin.company.id):
|
||||
party = Party(party.id)
|
||||
if amount > Decimal(0):
|
||||
account = party.account_receivable_used
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user