mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
Start work to port account_move_base_import and base_transaction_id to v10
This commit is contained in:
committed by
Florian da Costa
parent
0bfaa2d044
commit
1e77fa88ae
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2011 Akretion
|
||||
# © 2011-2016 Akretion
|
||||
# © 2011-2016 Camptocamp SA
|
||||
# © 2013 Savoir-faire Linux
|
||||
# © 2014 ACSONE SA/NV
|
||||
@@ -10,8 +10,8 @@ import logging
|
||||
|
||||
import psycopg2
|
||||
|
||||
from openerp import _, api, fields, models
|
||||
from openerp.exceptions import ValidationError
|
||||
from odoo import _, api, fields, models
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
@@ -260,12 +260,13 @@ class AccountMoveLine(models.Model):
|
||||
|
||||
def _get_available_columns(self, move_store):
|
||||
"""Return writeable by SQL columns"""
|
||||
model_cols = self._columns
|
||||
model_cols = self._fields
|
||||
avail = [
|
||||
k for k, col in model_cols.iteritems() if not hasattr(col, '_fnct')
|
||||
]
|
||||
keys = [k for k in move_store[0].keys() if k in avail]
|
||||
keys.sort()
|
||||
print "keys==================", keys
|
||||
return keys
|
||||
|
||||
def _prepare_insert(self, move, cols):
|
||||
@@ -275,7 +276,9 @@ class AccountMoveLine(models.Model):
|
||||
move_copy = move
|
||||
for k, col in move_copy.iteritems():
|
||||
if k in cols:
|
||||
move_copy[k] = self._columns[k]._symbol_set[1](col)
|
||||
print "DIR self._fields[k]=", dir(self._fields[k])
|
||||
move_copy[k] = self._fields[k]._symbol_set[1](col)
|
||||
print "move_copy[k]==========", move_copy[k]
|
||||
return move_copy
|
||||
|
||||
def _prepare_manyinsert(self, move_store, cols):
|
||||
@@ -333,17 +336,19 @@ class AccountMove(models.Model):
|
||||
related='journal_id.used_for_completion',
|
||||
readonly=True)
|
||||
completion_logs = fields.Text(string='Completion Log', readonly=True)
|
||||
# partner_id is a native field of the account module
|
||||
# (related='line_ids.partner_id', store=True, readonly=True)
|
||||
partner_id = fields.Many2one(related=False, compute='_compute_partner_id')
|
||||
import_partner_id = fields.Many2one('res.partner',
|
||||
string="Partner from import")
|
||||
|
||||
@api.one
|
||||
@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
|
||||
if self.import_partner_id:
|
||||
self.partner_id = self.import_partner_id
|
||||
elif self.line_ids:
|
||||
self.partner_id = self.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
|
||||
|
||||
Reference in New Issue
Block a user