Skip to content

Commit

Permalink
[IMP] account: account.statement.operation.template model
Browse files Browse the repository at this point in the history
- better many2one ondelete strategies
- domain set on fields, not views
- added domain on analytic_account_id field
  • Loading branch information
aba-odoo authored and Whisno committed Nov 28, 2014
1 parent fd6dde7 commit d4027e6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions addons/account/account_bank_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,13 +859,13 @@ class account_statement_operation_template(osv.osv):
_description = "Preset for the lines that can be created in a bank statement reconciliation"
_columns = {
'name': fields.char('Button Label', required=True),
'account_id': fields.many2one('account.account', 'Account', ondelete='cascade', domain=[('type','!=','view')]),
'account_id': fields.many2one('account.account', 'Account', ondelete='cascade', domain=[('type', 'not in', ('view', 'closed', 'consolidation'))]),
'label': fields.char('Label'),
'amount_type': fields.selection([('fixed', 'Fixed'),('percentage_of_total','Percentage of total amount'),('percentage_of_balance', 'Percentage of open balance')],
'Amount type', required=True),
'amount': fields.float('Amount', digits_compute=dp.get_precision('Account'), help="The amount will count as a debit if it is negative, as a credit if it is positive (except if amount type is 'Percentage of open balance').", required=True),
'tax_id': fields.many2one('account.tax', 'Tax', ondelete='cascade'),
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', ondelete='cascade'),
'tax_id': fields.many2one('account.tax', 'Tax', ondelete='restrict', domain=[('type_tax_use', 'in', ['purchase', 'all']), ('parent_id', '=', False)]),
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', ondelete='set null', domain=[('type','!=','view'), ('state','not in',('close','cancelled'))]),
}
_defaults = {
'amount_type': 'percentage_of_balance',
Expand Down
4 changes: 2 additions & 2 deletions addons/account/account_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -702,9 +702,9 @@
</div>
<group>
<group>
<field name="account_id" domain="[('type', 'not in', ['view', 'closed', 'consolidation'])]"/>
<field name="account_id"/>
<field name="amount_type"/>
<field name="tax_id" domain="[('type_tax_use', 'in', ['purchase', 'all']), ('parent_id', '=', False)]"/>
<field name="tax_id"/>
</group>
<group>
<field name="label"/>
Expand Down
1 change: 1 addition & 0 deletions addons/account/static/src/js/account_widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ openerp.account = function (instance) {
relation: "account.analytic.account",
string: _t("Analytic Acc."),
type: "many2one",
domain: [['type', '!=', 'view'], ['state', 'not in', ['close','cancelled']]],
},
},
};
Expand Down

0 comments on commit d4027e6

Please sign in to comment.