1016
1016
'account_id': False,
1018
1018
move_lines = self.pool.get('account.move.line').browse(cr, uid, move_line_ids)
1019
for move_line in move_lines:
1020
if move_line.partner_id:
1021
if retval['partner_id']:
1022
if retval['partner_id'] != move_line.partner_id.id:
1023
retval['partner_id'] = False
1026
retval['partner_id'] = move_line.partner_id.id
1028
if retval['partner_id']:
1029
retval['partner_id'] = False
1031
for move_line in move_lines:
1032
if move_line.account_id:
1033
if retval['account_id']:
1034
if retval['account_id'] != move_line.account_id.id:
1035
retval['account_id'] = False
1038
retval['account_id'] = move_line.account_id.id
1040
if retval['account_id']:
1041
retval['account_id'] = False
1043
for move_line in move_lines:
1044
if move_line.invoice:
1045
if retval['match_type']:
1046
if retval['match_type'] != 'invoice':
1047
retval['match_type'] = False
1050
retval['match_type'] = 'invoice'
1052
if retval['match_type']:
1053
retval['match_type'] = False
1055
if move_lines and not retval['match_type']:
1023
if move_lines[0].partner_id and all(
1024
[move_line.partner_id == move_lines[0].partner_id
1025
for move_line in move_lines]):
1026
retval['partner_id'] = move_lines[0].partner_id.id
1028
if move_lines[0].account_id and all(
1029
[move_line.account_id == move_lines[0].account_id
1030
for move_line in move_lines]):
1031
retval['account_id'] = move_lines[0].account_id.id
1033
if move_lines[0].invoice and all(
1034
[move_line.invoice == move_lines[0].invoice
1035
for move_line in move_lines]):
1036
retval['match_type'] = 'invoice'
1037
retval['type'] = type_map[move_lines[0].invoice.type]
1038
retval['invoice_ids'] = list(
1039
set([x.invoice.id for x in move_lines]))
1041
if not retval['match_type']:
1056
1042
retval['match_type'] = 'move'
1057
if move_lines and len(move_lines) == 1:
1044
if len(move_lines) == 1:
1058
1045
retval['reference'] = move_lines[0].ref
1059
if retval['match_type'] == 'invoice':
1060
retval['invoice_ids'] = list(set([x.invoice.id for x in move_lines]))
1061
retval['type'] = type_map[move_lines[0].invoice.type]
1064
1049
def match(self, cr, uid, ids, results=None, context=None):