[IMP] Use onchange decorator, add white space at end of file, correct ypo mistake for account_invoice_constraint_chronology

This commit is contained in:
Adrien Peiffer
2014-09-05 13:27:13 +02:00
committed by Francesco Apruzzese
parent b0e75fd002
commit 838d8c989a
2 changed files with 9 additions and 12 deletions

View File

@@ -30,15 +30,15 @@
from openerp import models, fields, api
class account_jounrnal(models.Model):
class account_journal(models.Model):
_inherit = ['account.journal']
check_chronology = fields.Boolean(string='Check Chronology', default=False)
@api.multi
def on_change_type(self, type_journal, context=None):
value = {}
if type_journal not in ['sale', 'purchase', 'sale_refund',
'purchase_refund']:
value.update({'check_chronology': False})
return {'value': value}
@api.one
@api.onchange('type')
def on_change_type(self):
if self.type not in ['sale', 'purchase', 'sale_refund',
'purchase_refund']:
self.check_chronology = False
return True

View File

@@ -9,10 +9,7 @@
<field name="entry_posted" position="after">
<field name="check_chronology" attrs="{'readonly': [('type', 'not in', ['sale', 'purchase', 'sale_refund', 'purchase_refund'])]}"/>
</field>
<xpath expr="//field[@name='type']" position="attributes">
<attribute name="on_change">on_change_type(type)</attribute>
</xpath>
</field>
</record>
</data>
</openerp>
</openerp>