Finalize migration of account_usability

This commit is contained in:
Alexis de Lattre
2020-12-08 11:58:57 +01:00
parent 17549ca457
commit 75b8bef3c4
20 changed files with 156 additions and 858 deletions

View File

@@ -2,8 +2,7 @@
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models, _
from odoo.tools import float_compare, float_is_zero
from odoo import api, fields, models
from odoo.tools.misc import format_date
@@ -79,90 +78,14 @@ class AccountBankStatementLine(models.Model):
# search_reconciliation_proposition=search_rec_prop,
# context=context)
# def _prepare_reconciliation_move(self, move_ref):
# vals = super()._prepare_reconciliation_move(move_ref)
# By default, ref contains the name of the statement + name of the
# statement line. It causes 2 problems:
# 1) The 'ref' field is too big
# 2) The name of the statement line is already written in the name of
# the move line -> not useful to have the info 2 times
# In the end, I think it's better to just put nothing (we could write
# the name of the statement which has the account number, but it
# doesn't bring any useful info to the accountant)
# The only "good" thing to do would be to have a sequence per
# statement line and write it in this 'ref' field
# But that would required an additionnal field on statement lines
# vals['ref'] = False
# return vals
def show_account_move(self):
self.ensure_one()
action = self.env.ref('account.action_move_line_form').read()[0]
# Note: this action is on account.move, not account.move.line !
if self.journal_entry_ids:
action.update({
'views': False,
'view_id': False,
'view_mode': 'form,tree',
'res_id': self.move_id.id,
})
return action
else:
raise UserError(_(
'No journal entry linked to this bank statement line.'))
#class AccountFiscalPosition(models.Model):
# _inherit = 'account.fiscal.position'
# TODO mig to v14 ?
# @api.model
# def get_fiscal_position_no_partner(
# self, company_id=None, vat_subjected=False, country_id=None):
# '''This method is inspired by the method get_fiscal_position()
# in odoo/addons/account/partner.py : it uses the same algo
# but without a real partner.
# Returns a recordset of fiscal position, or False'''
# domains = [[
# ('auto_apply', '=', True),
# ('vat_required', '=', vat_subjected),
# ('company_id', '=', company_id)]]
# if vat_subjected:
# domains += [[
# ('auto_apply', '=', True),
# ('vat_required', '=', False),
# ('company_id', '=', company_id)]]
# for domain in domains:
# if country_id:
# fps = self.search(
# domain + [('country_id', '=', country_id)], limit=1)
# if fps:
# return fps[0]
# fps = self.search(
# domain +
# [('country_group_id.country_ids', '=', country_id)],
# limit=1)
# if fps:
# return fps[0]
# fps = self.search(
# domain +
# [('country_id', '=', None), ('country_group_id', '=', None)],
# limit=1)
# if fps:
# return fps[0]
# return False
#class AccountReconcileModel(models.Model):
# _inherit = 'account.reconcile.model'
# @api.onchange('name')
# def onchange_name(self):
# Do NOT copy by default name on label
# Because it's much better to have the bank statement line label as
# label of the counter-part move line, then the label of the button
# assert True # Stupid line of code just to have something...
action.update({
'views': False,
'view_id': False,
'view_mode': 'form,tree',
'res_id': self.move_id.id,
})
return action