mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[REF] account_id is not anymore mandatory for creating a bank statement line. Still mandatory for the validation
This commit is contained in:
@@ -382,6 +382,23 @@ class AccountStatementCompletionRule(orm.Model):
|
|||||||
res.update(st_vals)
|
res.update(st_vals)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
class AccountStatement(orm.Model):
|
||||||
|
_inherit = "account.bank.statement"
|
||||||
|
|
||||||
|
def button_confirm_bank(self, cr, uid, ids, context=None):
|
||||||
|
line_obj = self.pool['account.bank.statement.line']
|
||||||
|
for stat_id in ids:
|
||||||
|
line_without_account = line_obj.search(cr, uid, [
|
||||||
|
['statement_id', '=', stat_id],
|
||||||
|
['account_id', '=', False],
|
||||||
|
], context=context)
|
||||||
|
if line_without_account:
|
||||||
|
stat = self.browse(cr, uid, stat_id, context=context)
|
||||||
|
raise osv.except_osv(_('User error'),
|
||||||
|
_('You should fill all account on the line of the'
|
||||||
|
' statement %s')%stat.name)
|
||||||
|
return super(AccountStatement, self).button_confirm_bank(cr, uid, ids, context=context)
|
||||||
|
|
||||||
|
|
||||||
class AccountStatementLine(orm.Model):
|
class AccountStatementLine(orm.Model):
|
||||||
"""
|
"""
|
||||||
@@ -393,6 +410,7 @@ class AccountStatementLine(orm.Model):
|
|||||||
module to see how we've done it.
|
module to see how we've done it.
|
||||||
"""
|
"""
|
||||||
_inherit = "account.bank.statement.line"
|
_inherit = "account.bank.statement.line"
|
||||||
|
_order = "already_completed desc, date asc"
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'additionnal_bank_fields': fields.serialized(
|
'additionnal_bank_fields': fields.serialized(
|
||||||
|
|||||||
@@ -103,12 +103,6 @@ class AccountStatementProfil(Model):
|
|||||||
statement_obj = self.pool.get('account.bank.statement')
|
statement_obj = self.pool.get('account.bank.statement')
|
||||||
values = parser_vals
|
values = parser_vals
|
||||||
values['statement_id'] = statement_id
|
values['statement_id'] = statement_id
|
||||||
values['account_id'] = statement_obj.get_account_for_counterpart(cr,
|
|
||||||
uid,
|
|
||||||
parser_vals['amount'],
|
|
||||||
account_receivable,
|
|
||||||
account_payable)
|
|
||||||
|
|
||||||
date = values.get('date')
|
date = values.get('date')
|
||||||
period_memoizer = context.get('period_memoizer')
|
period_memoizer = context.get('period_memoizer')
|
||||||
if not period_memoizer:
|
if not period_memoizer:
|
||||||
@@ -214,3 +208,12 @@ class AccountStatementProfil(Model):
|
|||||||
raise osv.except_osv(_("Statement import error"),
|
raise osv.except_osv(_("Statement import error"),
|
||||||
_("The statement cannot be created: %s") % st)
|
_("The statement cannot be created: %s") % st)
|
||||||
return statement_id
|
return statement_id
|
||||||
|
|
||||||
|
|
||||||
|
class AccountBankStatementLine(orm.Model):
|
||||||
|
_inherit = "account.bank.statement.line"
|
||||||
|
|
||||||
|
_columns = {
|
||||||
|
'account_id': fields.many2one('account.account','Account'),
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,5 +26,22 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="bank_statement_view_form" model="ir.ui.view">
|
||||||
|
<field name="name">account_bank_statement.bank_statement.view_form</field>
|
||||||
|
<field name="model">account.bank.statement</field>
|
||||||
|
<field name="inherit_id" ref="account_statement_base_completion.bank_statement_view_form" />
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field eval="20" name="priority"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="/form/sheet/notebook/page/field[@name='line_ids']/form/group/field[@name='account_id']" position="attributes">
|
||||||
|
<attribute name="attrs">{'required': [('already_completed','=', True)]}</attribute>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="/form/sheet/notebook/page/field[@name='line_ids']/tree/field[@name='account_id']" position="attributes">
|
||||||
|
<attribute name="attrs">{'required': [('already_completed','=', True)]}</attribute>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|||||||
Reference in New Issue
Block a user