Upport the "mark invoice as sent" wizard from v8 to v10

PEP8 on account_usability
This commit is contained in:
Alexis de Lattre
2017-11-30 23:13:14 +01:00
parent f74dc15d4b
commit 1034cc2347
6 changed files with 74 additions and 10 deletions

View File

@@ -6,7 +6,6 @@
from odoo import models, fields, api, _
from odoo.tools import float_compare, float_is_zero
from odoo.exceptions import UserError
from itertools import groupby
class AccountInvoice(models.Model):
@@ -79,8 +78,8 @@ class AccountInvoice(models.Model):
# generated from customer invoices linked to the partners' account because:
# 1) the label of an account move line is an important field, we can't
# write a rubbish '/' in it !
# 2) the 'name' field of the account.move.line is used in the overdue letter,
# and '/' is not meaningful for our customer !
# 2) the 'name' field of the account.move.line is used in the overdue
# letter, and '/' is not meaningful for our customer !
@api.multi
def action_move_create(self):
res = super(AccountInvoice, self).action_move_create()
@@ -134,8 +133,10 @@ class AccountJournal(models.Model):
return res
else:
for journal in self:
currency = journal.currency_id or journal.company_id.currency_id
name = "[%s] %s (%s)" % (journal.code, journal.name, currency.name)
currency = journal.currency_id or\
journal.company_id.currency_id
name = "[%s] %s (%s)" % (
journal.code, journal.name, currency.name)
res.append((journal.id, name))
return res
@@ -193,8 +194,8 @@ class AccountAnalyticAccount(models.Model):
class AccountMove(models.Model):
_inherit = 'account.move'
default_move_line_name = fields.Char(string='Default Label',
states={'posted': [('readonly', True)]})
default_move_line_name = fields.Char(
string='Default Label', states={'posted': [('readonly', True)]})
# By default, we can still modify "ref" when account move is posted
# which seems a bit lazy for me...
ref = fields.Char(states={'posted': [('readonly', True)]})
@@ -303,7 +304,7 @@ class AccountBankStatementLine(models.Model):
# is caused by this.
# Set search_reconciliation_proposition to False by default
# TODO: re-write in v10
#def get_data_for_reconciliations(
# def get_data_for_reconciliations(
# self, cr, uid, ids, excluded_ids=None,
# search_reconciliation_proposition=False, context=None):
# # Make variable name shorted for PEP8 !
@@ -323,8 +324,8 @@ class AccountBankStatementLine(models.Model):
# 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 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