mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[FIX] fix change of API for the method get_from_label_and_partner_field
This commit is contained in:
@@ -58,7 +58,7 @@ class AccountBankSatement(orm.Model):
|
|||||||
class AccountStatementCompletionRule(orm.Model):
|
class AccountStatementCompletionRule(orm.Model):
|
||||||
_inherit = "account.statement.completion.rule"
|
_inherit = "account.statement.completion.rule"
|
||||||
|
|
||||||
def get_from_label_and_partner_field(self, cr, uid, line_id, context=None):
|
def get_from_label_and_partner_field(self, cr, uid, st_line, context=None):
|
||||||
"""
|
"""
|
||||||
Match the partner and the account based on the name field of the
|
Match the partner and the account based on the name field of the
|
||||||
statement line and the table account.statement.label.
|
statement line and the table account.statement.label.
|
||||||
@@ -73,9 +73,10 @@ class AccountStatementCompletionRule(orm.Model):
|
|||||||
|
|
||||||
...}
|
...}
|
||||||
"""
|
"""
|
||||||
st_obj = self.pool.get('account.bank.statement.line')
|
st_obj = self.pool.get('account.bank.statement')
|
||||||
|
st_line_obj = self.pool.get('account.bank.statement.line')
|
||||||
label_obj = self.pool.get('account.statement.label')
|
label_obj = self.pool.get('account.statement.label')
|
||||||
st_line = st_obj.browse(cr, uid, line_id, context=context)
|
statement = st_obj.browse(cr, uid, st_line['statement_id'][0], context=context)
|
||||||
res = {}
|
res = {}
|
||||||
# As we have to iterate on each label for each line,
|
# As we have to iterate on each label for each line,
|
||||||
# we memorize the pair to avoid
|
# we memorize the pair to avoid
|
||||||
@@ -86,16 +87,15 @@ class AccountStatementCompletionRule(orm.Model):
|
|||||||
context['label_memorizer'] = defaultdict(list)
|
context['label_memorizer'] = defaultdict(list)
|
||||||
label_ids = label_obj.search(cr, uid,
|
label_ids = label_obj.search(cr, uid,
|
||||||
['|',
|
['|',
|
||||||
('profile_id', '=', st_line.statement_id.profile_id.id),
|
('profile_id', '=', statement.profile_id.id),
|
||||||
('profile_id', '=', False)],
|
('profile_id', '=', False)],
|
||||||
context=context)
|
context=context)
|
||||||
for label in label_obj.browse(cr, uid, label_ids, context=context):
|
for label in label_obj.browse(cr, uid, label_ids, context=context):
|
||||||
line_ids = st_obj.search(cr, uid,
|
line_ids = st_line_obj.search(cr, uid,
|
||||||
[('statement_id', '=', st_line.statement_id.id),
|
[('statement_id', '=', statement.id),
|
||||||
('name', 'ilike', label.label),
|
('name', 'ilike', label.label),
|
||||||
('already_completed', '=', False)],
|
('already_completed', '=', False)],
|
||||||
context=context)
|
context=context)
|
||||||
import pdb;pdb.set_trace()
|
|
||||||
for line_id in line_ids:
|
for line_id in line_ids:
|
||||||
context['label_memorizer'][line_id].append({'partner_id': label.partner_id.id,
|
context['label_memorizer'][line_id].append({'partner_id': label.partner_id.id,
|
||||||
'account_id': label.account_id.id})
|
'account_id': label.account_id.id})
|
||||||
@@ -142,4 +142,4 @@ class AccountStatementLabel(orm.Model):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def save_and_close_label(self, cr, uid, ids, context=None):
|
def save_and_close_label(self, cr, uid, ids, context=None):
|
||||||
return {'type': 'ir.actions.act_window_close'}
|
return {'type': 'ir.actions.act_window_close'}
|
||||||
|
|||||||
Reference in New Issue
Block a user