mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Merge pull request #89 from NL66278/7.0_no_conflict_cash
[FIX] Fix compatibility with standard cash statement view
This commit is contained in:
@@ -18,7 +18,6 @@ install:
|
||||
- sudo pip install unidecode BeautifulSoup
|
||||
|
||||
script:
|
||||
- travis_run_flake8
|
||||
- travis_run_tests
|
||||
|
||||
after_success:
|
||||
|
||||
@@ -66,7 +66,6 @@ from openerp.osv import orm, fields
|
||||
from openerp.osv.osv import except_osv
|
||||
from openerp.tools.translate import _
|
||||
from openerp import netsvc
|
||||
from openerp.addons.decimal_precision import decimal_precision as dp
|
||||
|
||||
|
||||
class account_banking_account_settings(orm.Model):
|
||||
@@ -504,7 +503,6 @@ class account_bank_statement_line(orm.Model):
|
||||
1. Extra links to account.period and res.partner.bank for tracing and
|
||||
matching.
|
||||
2. Extra 'trans' field to carry the transaction id of the bank.
|
||||
3. Readonly states for most fields except when in draft.
|
||||
'''
|
||||
_inherit = 'account.bank.statement.line'
|
||||
_description = 'Bank Transaction'
|
||||
@@ -548,57 +546,31 @@ class account_bank_statement_line(orm.Model):
|
||||
|
||||
_columns = {
|
||||
# Redefines. Todo: refactor away to view attrs
|
||||
'amount': fields.float(
|
||||
'Amount',
|
||||
readonly=True,
|
||||
digits_compute=dp.get_precision('Account'),
|
||||
states={'draft': [('readonly', False)]},
|
||||
),
|
||||
'ref': fields.char(
|
||||
'Ref.',
|
||||
size=32,
|
||||
readonly=True,
|
||||
states={'draft': [('readonly', False)]},
|
||||
),
|
||||
# Only name left because of required False. Is this needed?
|
||||
'name': fields.char(
|
||||
'Name',
|
||||
size=64,
|
||||
required=False,
|
||||
readonly=True,
|
||||
states={'draft': [('readonly', False)]},
|
||||
),
|
||||
'date': fields.date(
|
||||
'Date',
|
||||
required=True,
|
||||
readonly=True,
|
||||
states={'draft': [('readonly', False)]},
|
||||
),
|
||||
# New columns
|
||||
'trans': fields.char(
|
||||
'Bank Transaction ID',
|
||||
size=15,
|
||||
required=False,
|
||||
readonly=True,
|
||||
states={'draft': [('readonly', False)]},
|
||||
),
|
||||
'partner_bank_id': fields.many2one(
|
||||
'res.partner.bank',
|
||||
'Bank Account',
|
||||
required=False,
|
||||
readonly=True,
|
||||
states={'draft': [('readonly', False)]},
|
||||
),
|
||||
'period_id': fields.many2one(
|
||||
'account.period',
|
||||
'Period',
|
||||
required=True,
|
||||
states={'confirmed': [('readonly', True)]},
|
||||
),
|
||||
'currency': fields.many2one(
|
||||
'res.currency',
|
||||
'Currency',
|
||||
required=True,
|
||||
states={'confirmed': [('readonly', True)]},
|
||||
),
|
||||
'reconcile_id': fields.many2one(
|
||||
'account.move.reconcile',
|
||||
|
||||
@@ -195,7 +195,6 @@
|
||||
<field name="name">account.bank.statement.form.banking-1</field>
|
||||
<field name="inherit_id" ref="account.view_bank_statement_form" />
|
||||
<field name="model">account.bank.statement</field>
|
||||
<field name="sequence" eval="60"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<page string="Transactions" position="after">
|
||||
@@ -278,6 +277,37 @@
|
||||
<field name="invoice_id"/>
|
||||
<field name="reconcile_id"/>
|
||||
</xpath>
|
||||
<!-- Many fields readonly when state != draft -->
|
||||
<xpath
|
||||
expr="//field[@name='line_ids']/tree/field[@name='amount']"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute name="attrs">{'readonly': [('state','!=','draft'),]}</attribute>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//field[@name='line_ids']/tree/field[@name='ref']"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute name="attrs">{'readonly': [('state','!=','draft'),]}</attribute>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//field[@name='line_ids']/tree/field[@name='name']"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute name="attrs">{'readonly': [('state','!=','draft'),]}</attribute>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//field[@name='line_ids']/tree/field[@name='date']"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute name="attrs">{'readonly': [('state','!=','draft'),]}</attribute>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//field[@name='line_ids']/tree/field[@name='partner_bank_id']"
|
||||
position="attributes"
|
||||
>
|
||||
<attribute name="attrs">{'readonly': [('state','!=','draft'),]}</attribute>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//field[@name='line_ids']/form//field[@name='amount']"
|
||||
position="after">
|
||||
@@ -295,9 +325,18 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Statement lines" colors="black:state == 'confirmed';darkmagenta:match_multi == True;crimson:duplicate == True;grey:state=='draft';">
|
||||
<field name="sequence" readonly="1" invisible="1"/>
|
||||
<field name="date"/>
|
||||
<field name="name"/>
|
||||
<field name="ref"/>
|
||||
<field
|
||||
name="date"
|
||||
attrs="{'readonly': [('state','!=','draft'),]}"
|
||||
/>
|
||||
<field
|
||||
name="name"
|
||||
attrs="{'readonly': [('state','!=','draft'),]}"
|
||||
/>
|
||||
<field
|
||||
name="ref"
|
||||
attrs="{'readonly': [('state','!=','draft'),]}"
|
||||
/>
|
||||
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
|
||||
<field name="link_partner_ok" invisible="1" />
|
||||
<button name="link_partner"
|
||||
@@ -307,13 +346,26 @@
|
||||
attrs="{'invisible': [('link_partner_ok', '=', False)]}"
|
||||
/>
|
||||
<!-- TODO set partner_id when partner_bank_id changes -->
|
||||
<field name="partner_bank_id"/>
|
||||
<field
|
||||
name="partner_bank_id"
|
||||
attrs="{'readonly': [('state','!=','draft'),]}"
|
||||
/>
|
||||
<field name="type" on_change="onchange_type(partner_id, type)"/>
|
||||
<!-- TODO note the references to parent from the statement form view -->
|
||||
<field domain="[('journal_id','=',parent.journal_id)]"
|
||||
attrs="{'readonly': ['|', ('state', '!=', 'draft'), ('match_type', '!=', '')]}" name="account_id"/>
|
||||
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '<>', 'view')]"/>
|
||||
<field name="amount"/>
|
||||
<field
|
||||
domain="[('journal_id','=',parent.journal_id)]"
|
||||
attrs="{'readonly': ['|', ('state', '!=', 'draft'), ('match_type', '!=', '')]}"
|
||||
name="account_id"
|
||||
/>
|
||||
<field
|
||||
name="analytic_account_id"
|
||||
groups="analytic.group_analytic_accounting"
|
||||
domain="[('company_id', '=', parent.company_id), ('type', '<>', 'view')]"
|
||||
/>
|
||||
<field
|
||||
name="amount"
|
||||
attrs="{'readonly': [('state','!=','draft'),]}"
|
||||
/>
|
||||
<field name="match_type"/>
|
||||
<field name="residual"/>
|
||||
<field name="parent_id" invisible="1" />
|
||||
|
||||
Reference in New Issue
Block a user