Skip to content

Commit

Permalink
Force import partner on account.move
Browse files Browse the repository at this point in the history
  • Loading branch information
mdietrichc2c committed Oct 6, 2016
1 parent d33ae64 commit 7f22a25
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion account_move_base_import/models/account_journal.py
Expand Up @@ -243,7 +243,8 @@ def prepare_move_vals(self, result_row_list, parser):
the profile.
"""
vals = {'journal_id': self.id,
'currency_id': self.currency_id.id}
'currency_id': self.currency_id.id,
'import_partner_id': self.partner_id.id}
vals.update(parser.get_move_vals())
return vals

Expand Down
10 changes: 10 additions & 0 deletions account_move_base_import/models/account_move.py
Expand Up @@ -333,6 +333,16 @@ class AccountMove(models.Model):
related='journal_id.used_for_completion',
readonly=True)
completion_logs = fields.Text(string='Completion Log', readonly=True)
partner_id = fields.Many2one(related=False, compute='_compute_partner_id')
import_partner_id = fields.Many2one('res.partner', string="Partner from import")

@api.depends('line_ids.partner_id', 'import_partner_id')
def _compute_partner_id(self):
for move in self:
if move.import_partner_id:
move.partner_id = move.import_partner_id
elif move.line_ids:
move.partner_id = move.line_ids[0].partner_id

def write_completion_log(self, error_msg, number_imported):
"""Write the log in the completion_logs field of the bank statement to
Expand Down

0 comments on commit 7f22a25

Please sign in to comment.