mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[IMP] Set a default account on a new bank statement line when manual entry
(lp:c2c-financial-addons/6.1 rev 24.1.40)
This commit is contained in:
@@ -515,6 +515,9 @@ class AccountBankSatementLine(Model):
|
|||||||
periods = self.pool.get('account.period').find(cursor, user, dt=date)
|
periods = self.pool.get('account.period').find(cursor, user, dt=date)
|
||||||
return periods and periods[0] or False
|
return periods and periods[0] or False
|
||||||
|
|
||||||
|
def _get_default_account(self, cursor, user, context=None):
|
||||||
|
return self.get_values_for_line(cursor, user, context = context)['account_id']
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
# Set them as required + 64 char instead of 32
|
# Set them as required + 64 char instead of 32
|
||||||
'ref': fields.char('Reference', size=64, required=True),
|
'ref': fields.char('Reference', size=64, required=True),
|
||||||
@@ -522,6 +525,7 @@ class AccountBankSatementLine(Model):
|
|||||||
}
|
}
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'period_id': _get_period,
|
'period_id': _get_period,
|
||||||
|
'account_id': _get_default_account,
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_values_for_line(self, cr, uid, profile_id = False, partner_id = False, line_type = False, amount = False, context = None):
|
def get_values_for_line(self, cr, uid, profile_id = False, partner_id = False, line_type = False, amount = False, context = None):
|
||||||
|
|||||||
Reference in New Issue
Block a user