mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
Force import partner on account.move (#157)
Force import partner on account.move
This commit is contained in:
committed by
Florian da Costa
parent
2b3cd6bbbb
commit
0bfaa2d044
@@ -243,7 +243,8 @@ class AccountJournal(models.Model):
|
|||||||
the profile.
|
the profile.
|
||||||
"""
|
"""
|
||||||
vals = {'journal_id': self.id,
|
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())
|
vals.update(parser.get_move_vals())
|
||||||
return vals
|
return vals
|
||||||
|
|
||||||
|
|||||||
@@ -333,6 +333,17 @@ class AccountMove(models.Model):
|
|||||||
related='journal_id.used_for_completion',
|
related='journal_id.used_for_completion',
|
||||||
readonly=True)
|
readonly=True)
|
||||||
completion_logs = fields.Text(string='Completion Log', 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):
|
def write_completion_log(self, error_msg, number_imported):
|
||||||
"""Write the log in the completion_logs field of the bank statement to
|
"""Write the log in the completion_logs field of the bank statement to
|
||||||
|
|||||||
Reference in New Issue
Block a user