Small usability enhancement for account

PEP8 stuff
This commit is contained in:
Alexis de Lattre
2015-10-09 12:50:22 +02:00
parent 72b1333bb2
commit a34d47a13b

View File

@@ -41,6 +41,15 @@ class AccountInvoice(models.Model):
fiscal_position = fields.Many2one(track_visibility='onchange') fiscal_position = fields.Many2one(track_visibility='onchange')
class AccountMove(models.Model):
_inherit = 'account.move'
@api.onchange('date')
def date_onchange(self):
if self.date:
self.period_id = self.env['account.period'].find(self.date)
class AccountMoveLine(models.Model): class AccountMoveLine(models.Model):
_inherit = 'account.move.line' _inherit = 'account.move.line'
@@ -61,21 +70,25 @@ class AccountBankStatementLine(models.Model):
# Disable guessing for reconciliation # Disable guessing for reconciliation
# because my experience with several customers shows that it is a problem # because my experience with several customers shows that it is a problem
# in the following scenario : move line 'x' has been "guessed" by OpenERP # in the following scenario : move line 'x' has been "guessed" by OpenERP
# to be reconciled with a statement line 'Y' at the end of the bank statement, # to be reconciled with a statement line 'Y' at the end of the bank
# but it is a mistake because it should be reconciled with statement line 'B' # statement, but it is a mistake because it should be reconciled with
# at the beginning of the bank statement # statement line 'B' at the beginning of the bank statement
# When the user is on statement line 'B', he tries to select # When the user is on statement line 'B', he tries to select
# move line 'x', but it can't find it... because it is already "reserved" # move line 'x', but it can't find it... because it is already "reserved"
# by the guess of OpenERP for statement line 'Y' ! To solve this problem, the # by the guess of OpenERP for statement line 'Y' ! To solve this problem,
# user must go to statement line 'Y' and unselect move line 'x' and then come # the user must go to statement line 'Y' and unselect move line 'x'
# back on statement line 'B' and select move line 'A'... but non super-expert # and then come back on statement line 'B' and select move line 'A'...
# users can't do that because it is impossible to figure out that the fact that # but non super-expert users can't do that because it is impossible to
# the user can't find move line 'x' is caused by this. # figure out that the fact that the user can't find move line 'x'
# is caused by this.
# Set search_reconciliation_proposition to False by default # Set search_reconciliation_proposition to False by default
def get_data_for_reconciliations( def get_data_for_reconciliations(
self, cr, uid, ids, excluded_ids=None, self, cr, uid, ids, excluded_ids=None,
search_reconciliation_proposition=False, context=None): search_reconciliation_proposition=False, context=None):
return super(AccountBankStatementLine ,self).get_data_for_reconciliations( # Make variable name shorted for PEP8 !
cr, uid, ids, excluded_ids=excluded_ids, search_rec_prop = search_reconciliation_proposition
search_reconciliation_proposition=search_reconciliation_proposition, return super(AccountBankStatementLine, self).\
context=context) get_data_for_reconciliations(
cr, uid, ids, excluded_ids=excluded_ids,
search_reconciliation_proposition=search_rec_prop,
context=context)