mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[IMP] Use onchange decorator, add white space at end of file, correct ypo mistake for account_invoice_constraint_chronology
This commit is contained in:
committed by
Francesco Apruzzese
parent
b0e75fd002
commit
838d8c989a
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user