Change string domain into list

This commit is contained in:
Cédric Krier
2009-06-23 18:52:32 +02:00
parent 44fa088c2f
commit ce561e2b74
7 changed files with 44 additions and 44 deletions
+14 -14
View File
@@ -1137,11 +1137,11 @@ class PrintGeneralLegderInit(ModelView):
fiscalyear = fields.Many2One('account.fiscalyear', 'Fiscal Year',
required=True, on_change=['fiscalyear'])
start_period = fields.Many2One('account.period', 'Start Period',
domain="[('fiscalyear', '=', fiscalyear), " \
"('start_date', '<=', (end_period, 'start_date'))]")
domain=["('fiscalyear', '=', fiscalyear)",
"('start_date', '<=', (end_period, 'start_date'))"])
end_period = fields.Many2One('account.period', 'End Period',
domain="[('fiscalyear', '=', fiscalyear), " \
"('start_date', '>=', (start_period, 'start_date'))]")
domain=["('fiscalyear', '=', fiscalyear)",
"('start_date', '>=', (start_period, 'start_date'))"])
company = fields.Many2One('company.company', 'Company', required=True)
posted = fields.Boolean('Posted Move', help='Show only posted move')
empty_account = fields.Boolean('Empty Account',
@@ -1351,12 +1351,12 @@ class PrintTrialBalanceInit(ModelView):
required=True, on_change=['fiscalyear'],
depends=['start_period', 'end_period'])
start_period = fields.Many2One('account.period', 'Start Period',
domain="[('fiscalyear', '=', fiscalyear), " \
"('start_date', '<=', (end_period, 'start_date'))]",
domain=["('fiscalyear', '=', fiscalyear)",
"('start_date', '<=', (end_period, 'start_date'))"],
depends=['end_period'])
end_period = fields.Many2One('account.period', 'End Period',
domain="[('fiscalyear', '=', fiscalyear), " \
"('start_date', '>=', (start_period, 'start_date'))]",
domain=["('fiscalyear', '=', fiscalyear)",
"('start_date', '>=', (start_period, 'start_date'))"],
depends=['start_period'])
company = fields.Many2One('company.company', 'Company', required=True)
posted = fields.Boolean('Posted Move', help='Show only posted move')
@@ -1605,12 +1605,12 @@ class OpenIncomeStatementInit(ModelView):
required=True, on_change=['fiscalyear'],
depends=['start_period', 'end_period'])
start_period = fields.Many2One('account.period', 'Start Period',
domain="[('fiscalyear', '=', fiscalyear), " \
"('start_date', '<=', (end_period, 'start_date'))]",
domain=["('fiscalyear', '=', fiscalyear)",
"('start_date', '<=', (end_period, 'start_date'))"],
depends=['end_period'])
end_period = fields.Many2One('account.period', 'End Period',
domain="[('fiscalyear', '=', fiscalyear), " \
"('start_date', '>=', (start_period, 'start_date'))]",
domain=["('fiscalyear', '=', fiscalyear)",
"('start_date', '>=', (start_period, 'start_date'))"],
depends=['start_period'])
company = fields.Many2One('company.company', 'Company', required=True)
posted = fields.Boolean('Posted Move', help='Show only posted move')
@@ -1747,11 +1747,11 @@ class CreateChartAccountPropertites(ModelView):
company = fields.Many2One('company.company', 'Company')
account_receivable = fields.Many2One('account.account',
'Default Receivable Account',
domain="[('kind', '=', 'receivable'), ('company', '=', company)]",
domain=[('kind', '=', 'receivable'), "('company', '=', company)"],
depends=['company'])
account_payable = fields.Many2One('account.account',
'Default Payable Account',
domain="[('kind', '=', 'payable'), ('company', '=', company)]",
domain=[('kind', '=', 'payable'), "('company', '=', company)"],
depends=['company'])
CreateChartAccountPropertites()
+6 -5
View File
@@ -29,13 +29,14 @@ class FiscalYear(ModelSQL, ModelView):
('close', 'Close'),
], 'State', readonly=True, required=True)
post_move_sequence = fields.Many2One('ir.sequence', 'Post Move Sequence',
required=True, domain="[('code', '=', 'account.move')," \
"['OR', ('company', '=', company)," \
"('company', '=', False)]]",
required=True, domain=["('code', '=', 'account.move')",
['OR',
"('company', '=', company)",
"('company', '=', False)"]],
context="{'code': 'account.move', 'company': company}",
depends=['company'])
company = fields.Many2One('company.company', 'Company', required=True,
domain="[('id', '=', context.get('company', False))]")
domain=["('id', '=', context.get('company', False))"])
def __init__(self):
super(FiscalYear, self).__init__()
@@ -316,7 +317,7 @@ class CloseFiscalYearInit(ModelView):
close_fiscalyear = fields.Many2One('account.fiscalyear',
'Fiscal Year to close',
required=True,
domain="[('state', '!=', 'close')]")
domain=["('state', '!=', 'close')"])
CloseFiscalYearInit()
+4 -4
View File
@@ -53,7 +53,7 @@ class Column(ModelSQL, ModelView):
_description = __doc__
name = fields.Char('Name', size=None, required=True)
field = fields.Many2One('ir.model.field', 'Field', required=True,
domain="[('model.model', '=', 'account.move.line')]")
domain=[('model.model', '=', 'account.move.line')])
view = fields.Many2One('account.journal.view', 'View', select=1)
sequence = fields.Integer('Sequence', select=2)
required = fields.Boolean('Required')
@@ -86,11 +86,11 @@ class Journal(ModelSQL, ModelView):
update_posted = fields.Boolean('Allow cancelling moves')
sequence = fields.Property(type='many2one', relation='ir.sequence',
string='Sequence', required=True,
domain="[('code', '=', 'account.journal')]",
domain=[('code', '=', 'account.journal')],
context={'code': 'account.journal'})
credit_account = fields.Property(type='many2one',
relation='account.account', string='Default Credit Account',
domain="[('kind', '!=', 'view'), ('company', '=', company)]",
domain=[('kind', '!=', 'view'), "('company', '=', company)"],
states={
'required': "centralised or " \
"(type == 'cash' and context.get('company'))",
@@ -98,7 +98,7 @@ class Journal(ModelSQL, ModelView):
}, depends=['company', 'type', 'centralised'])
debit_account = fields.Property(type='many2one',
relation='account.account', string='Default Debit Account',
domain="[('kind', '!=', 'view'), ('company', '=', company)]",
domain=[('kind', '!=', 'view'), "('company', '=', company)"],
states={
'required': "centralised or " \
"(type == 'cash' and context.get('company'))",
+2 -3
View File
@@ -1324,9 +1324,8 @@ class OpenJournalAsk(ModelView):
_description = __doc__
journal = fields.Many2One('account.journal', 'Journal', required=True)
period = fields.Many2One('account.period', 'Period', required=True,
domain="[('state', '!=', 'close'), " \
"('fiscalyear.company.id', '=', " \
"context.get('company', False))]")
domain=[('state', '!=', 'close'),
"('fiscalyear.company.id', '=', context.get('company', False))"])
def default_period(self, cursor, user, context=None):
period_obj = self.pool.get('account.period')
+4 -4
View File
@@ -8,27 +8,27 @@ class Party(ModelSQL, ModelView):
_name = 'party.party'
account_payable = fields.Property(type='many2one',
relation='account.account', string='Account Payable',
domain="[('kind', '=', 'payable'), ('company', '=', company)]",
domain=[('kind', '=', 'payable'), "('company', '=', company)"],
states={
'required': "globals().get('company') and bool(company)",
'invisible': "not globals().get('company') or not bool(company)",
})
account_receivable = fields.Property(type='many2one',
relation='account.account', string='Account Receivable',
domain="[('kind', '=', 'receivable'), ('company', '=', company)]",
domain=[('kind', '=', 'receivable'), "('company', '=', company)"],
states={
'required': "globals().get('company') and bool(company)",
'invisible': "not globals().get('company') or not bool(company)",
})
customer_tax_rule = fields.Property(type='many2one',
relation='account.tax.rule', string='Customer Tax Rule',
domain="[('company', '=', company)]",
domain=["('company', '=', company)"],
states={
'invisible': "not globals().get('company') or not bool(company)",
}, help='Apply this rule on taxes when party is customer.')
supplier_tax_rule = fields.Property(type='many2one',
relation='account.tax.rule', string='Supplier Tax Rule',
domain="[('company', '=', company)]",
domain=["('company', '=', company)"],
states={
'invisible': "not globals().get('company') or not bool(company)",
}, help='Apply this rule on taxes when party is supplier.')
+2 -2
View File
@@ -27,8 +27,8 @@ class Period(ModelSQL, ModelView):
('close', 'Close'),
], 'State', readonly=True, required=True)
post_move_sequence =fields.Many2One('ir.sequence', 'Post Move Sequence',
required=True, domain="[('code', '=', 'account.move')]",
context="{'code': 'account.move'}")
required=True, domain=[('code', '=', 'account.move')],
context={'code': 'account.move'})
type = fields.Selection([
('standard', 'Standard'),
('adjustment', 'Adjustment'),
+12 -12
View File
@@ -145,9 +145,9 @@ class Code(ModelSQL, ModelView):
active = fields.Boolean('Active', select=2)
company = fields.Many2One('company.company', 'Company', required=True)
parent = fields.Many2One('account.tax.code', 'Parent', select=1,
domain="[('company', '=', company)]", depends=['company'])
domain=["('company', '=', company)"], depends=['company'])
childs = fields.One2Many('account.tax.code', 'parent', 'Children',
domain="[('company', '=', company)]", depends=['company'])
domain=["('company', '=', company)"], depends=['company'])
currency_digits = fields.Function('get_currency_digits', type='integer',
string='Currency Digits', on_change_with=['company'])
sum = fields.Function('get_sum', digits="(16, currency_digits)",
@@ -613,15 +613,15 @@ class Tax(ModelSQL, ModelView):
parent = fields.Many2One('account.tax', 'Parent', ondelete='CASCADE')
childs = fields.One2Many('account.tax', 'parent', 'Children')
company = fields.Many2One('company.company', 'Company', required=True,
domain="[('id', '=', context.get('company', 0))]")
domain=["('id', '=', context.get('company', 0))"])
invoice_account = fields.Many2One('account.account', 'Invoice Account',
domain="[('company', '=', company)]",
domain=["('company', '=', company)"],
states={
'readonly': "type == 'none' or not company",
'required': "type != 'none' and company",
}, depends=['company'])
credit_note_account = fields.Many2One('account.account', 'Credit Note Account',
domain="[('company', '=', company)]",
domain=["('company', '=', company)"],
states={
'readonly': "type == 'none' or not company",
'required': "type != 'none' and company",
@@ -1038,7 +1038,7 @@ class Rule(ModelSQL, ModelView):
_description = __doc__
name = fields.Char('Name', required=True, translate=True)
company = fields.Many2One('company.company', 'Company', required=True,
select=1, domain="[('id', '=', context.get('company', 0))]")
select=1, domain=["('id', '=', context.get('company', 0))"])
lines = fields.One2Many('account.tax.rule.line', 'rule', 'Lines')
template = fields.Many2One('account.tax.rule.template', 'Template')
@@ -1127,8 +1127,8 @@ class RuleLineTemplate(ModelSQL, ModelView):
ondelete='CASCADE')
group = fields.Many2One('account.tax.group', 'Tax Group')
tax = fields.Many2One('account.tax.template', 'Substitution Tax',
domain="[('account', '=', _parent_rule.account), " \
"('group', '=', group)]")
domain=["('account', '=', _parent_rule.account)",
"('group', '=', group)"])
sequence = fields.Integer('Sequence')
def __init__(self):
@@ -1213,8 +1213,8 @@ class RuleLine(ModelSQL, ModelView):
select=1, ondelete='CASCADE')
group = fields.Many2One('account.tax.group', 'Tax Group')
tax = fields.Many2One('account.tax', 'Substitution Tax',
domain="[('company', '=', _parent_rule.company), " \
"('group', '=', group)]")
domain=["('company', '=', _parent_rule.company)",
"('group', '=', group)"])
sequence = fields.Integer('Sequence')
template = fields.Many2One('account.tax.rule.line.template', 'Template')
@@ -1385,7 +1385,7 @@ class AccountTemplate(ModelSQL, ModelView):
_name = 'account.account.template'
taxes = fields.Many2Many('account.account.template-account.tax.template',
'account', 'tax', 'Default Taxes',
domain="[('parent', '=', False)]")
domain=["('parent', '=', False)"])
AccountTemplate()
@@ -1407,7 +1407,7 @@ class Account(ModelSQL, ModelView):
_name = 'account.account'
taxes = fields.Many2Many('account.account-account.tax',
'account', 'tax', 'Default Taxes',
domain="[('company', '=', company), ('parent', '=', False)]",
domain=["('company', '=', company)", ('parent', '=', False)],
help='Default tax for manual encoding of move lines \n' \
'for journal types: "expense" and "revenue"',
depends=['company'])