account_tax_include: Reverted changes

bzr revid: mra@tinyerp.com-20100602102450-dack5o9qchv3l7t8
This commit is contained in:
mra (Open ERP) 2010-06-02 15:54:50 +05:30
parent 968e5ca2d5
commit 6c3d7bb487
4 changed files with 21 additions and 55 deletions

View File

@ -183,7 +183,7 @@ class account_account(osv.osv):
temp.append(x)
ids2 += self._get_children_and_consol(cr, uid, temp, context)
return ids2
def search(self, cr, uid, args, offset=0, limit=None, order=None,
context=None, count=False):
if context is None:
@ -320,7 +320,7 @@ class account_account(osv.osv):
level = obj.level + 1
res[account.id] = level
return res
_columns = {
'name': fields.char('Name', size=128, required=True, select=True),
'currency_id': fields.many2one('res.currency', 'Secondary Currency', help="Forces all moves for this account to have this secondary currency."),
@ -477,7 +477,7 @@ class account_account(osv.osv):
def _check_moves(self, cr, uid, ids, method, context):
line_obj = self.pool.get('account.move.line')
account_ids = self.search(cr, uid, [('id', 'child_of', ids)])
if line_obj.search(cr, uid, [('account_id', 'in', account_ids)]):
if method == 'write':
raise osv.except_osv(_('Error !'), _('You cannot deactivate an account that contains account moves.'))
@ -511,7 +511,7 @@ class account_account(osv.osv):
context = {}
if 'active' in vals and not vals['active']:
self._check_moves(cr, uid, ids, "write", context)
if 'type' in vals.keys():
if 'type' in vals.keys():
self._check_allow_type_change(cr, uid, ids, vals['type'], context=context)
return super(account_account, self).write(cr, uid, ids, vals, context=context)
@ -683,7 +683,7 @@ class account_fiscalyear(osv.osv):
else:
return False
return ids[0]
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
if args is None:
args = []
@ -695,7 +695,7 @@ class account_fiscalyear(osv.osv):
if not ids:
ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit)
return self.name_get(cr, user, ids, context=context)
account_fiscalyear()
class account_period(osv.osv):
@ -771,7 +771,7 @@ class account_period(osv.osv):
cr.execute('update account_journal_period set state=%s where period_id=%s', (mode, id))
cr.execute('update account_period set state=%s where id=%s', (mode, id))
return True
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
if args is None:
args = []
@ -1375,7 +1375,7 @@ class account_tax_code(osv.osv):
return False
level -= 1
return True
def copy(self, cr, uid, id, default=None, context=None):
if default is None:
@ -1383,7 +1383,7 @@ class account_tax_code(osv.osv):
default = default.copy()
default.update({'line_ids': []})
return super(account_tax_code, self).copy(cr, uid, id, default, context)
_constraints = [
(_check_recursion, 'Error ! You can not create recursive accounts.', ['parent_id'])
]
@ -1441,6 +1441,7 @@ class account_tax(osv.osv):
'include_base_amount': fields.boolean('Included in base amount', help="Indicates if the amount of tax must be included in the base amount for the computation of the next taxes"),
'company_id': fields.many2one('res.company', 'Company', required=True),
'description': fields.char('Tax Code',size=32),
'price_include': fields.boolean('Tax Included in Price', help="Check this if the price you use on the product and invoices includes this tax."),
'type_tax_use': fields.selection([('sale','Sale'),('purchase','Purchase'),('all','All')], 'Tax Application', required=True)
}
@ -1473,6 +1474,7 @@ class account_tax(osv.osv):
'applicable_type': lambda *a: 'true',
'type': lambda *a: 'percent',
'amount': lambda *a: 0,
'price_include': lambda *a: 0,
'active': lambda *a: 1,
'type_tax_use': lambda *a: 'all',
'sequence': lambda *a: 1,

View File

@ -283,32 +283,32 @@
<separator string="Journal View" colspan="4"/>
<field name="view_id"/>
</group>
<group colspan="2" col="2">
<separator string="Sequence" colspan="4"/>
<field name="sequence_id"/>
<field name="invoice_sequence_id"/>
</group>
<group colspan="2" col="2">
<separator string="Accounts" colspan="4"/>
<field name="default_debit_account_id" attrs="{'required':[('type','=','cash')]}" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="default_credit_account_id" attrs="{'required':[('type','=','cash')]}" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
</group>
<group colspan="2" col="2">
<separator string="Validations" colspan="4"/>
<separator string="Validations" colspan="4"/>
<field name="allow_date" groups="base.group_extended"/>
</group>
<group colspan="2" col="2">
<separator string="Company" colspan="4"/>
<separator string="Company" colspan="4"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="user_id" groups="base.group_extended"/>
<field name="currency"/>
</group>
<group colspan="2" col="2">
<separator string="Other Configuration" colspan="4"/>
<separator string="Other Configuration" colspan="4"/>
<field name="centralisation"/>
<field name="group_invoice_lines"/>
<field name="update_posted"/>
@ -623,6 +623,7 @@
<field name="arch" type="xml">
<tree string="Account Tax">
<field name="name"/>
<field name="price_include"/>
<field name="description"/>
</tree>
</field>
@ -654,6 +655,7 @@
<label colspan="2" nolabel="1" string="Keep empty to use the expense account"/>
<field groups="base.group_extended" name="child_depend"/>
<field groups="base.group_extended" name="sequence"/>
<field groups="base.group_extended" name="price_include"/>
<field name="type_tax_use"/>
<newline/>
<field colspan="4" groups="base.group_extended" name="child_ids"/>
@ -1493,7 +1495,7 @@
<act_window domain="[('partner_id', '=', active_id), ('account_id.type', 'in', ['receivable', 'payable']), ('reconcile_id','=',False)]" id="act_account_partner_account_move_unreconciled" name="Unreconciled Receivables &amp; Payables" res_model="account.move.line" src_model="res.partner"/>
<act_window domain="[('partner_id', '=', active_id), ('account_id.type', 'in', ['receivable', 'payable'])]" id="act_account_partner_account_move_all" name="Receivables &amp; Payables" res_model="account.move.line" src_model="res.partner"/>
<act_window domain="[('partner_id', '=', active_id)]" id="act_account_partner_account_move" name="All Account Entries" res_model="account.move.line" src_model="res.partner"/>
<record id="view_account_addtmpl_wizard_form" model="ir.ui.view">

View File

@ -23,18 +23,6 @@ import time
from osv import fields, osv
import decimal_precision as dp
class account_tax(osv.osv):
_inherit = 'account.tax'
_description = 'Account Tax'
_columns = {
'price_include': fields.boolean('Tax Included in Price', help="Check this if the price you use on the product and invoices includes this tax."),
}
_defaults = {
'price_include': 0,
}
account_tax()
class account_invoice(osv.osv):
_inherit = "account.invoice"
_columns = {

View File

@ -2,32 +2,6 @@
<openerp>
<data>
<!-- Add price include (boolean) on tax form/tree view -->
<record id="view_tax_tree_inherit" model="ir.ui.view">
<field name="name">account.tax.tree.inherit.tree</field>
<field name="type">tree</field>
<field name="model">account.tax</field>
<field name="inherit_id" ref="account.view_tax_tree"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="price_include"/>
</field>
</field>
</record>
<record id="view_tax_form_inherit" model="ir.ui.view">
<field name="name">account.tax.tree.inherit.form</field>
<field name="type">form</field>
<field name="model">account.tax</field>
<field name="inherit_id" ref="account.view_tax_form"/>
<field name="arch" type="xml">
<field name="sequence" position="after">
<field groups="base.group_extended" name="price_include"/>
</field>
</field>
</record>
<!-- End -->
<record id="account_tax_view_price" model="ir.ui.view">
<field name="name">account.tax.exlcuded.view.form</field>
<field name="type">form</field>