[MERGE] Sync with trunk
bzr revid: tde@openerp.com-20131210093307-gxn4g59xba3l82zx
This commit is contained in:
commit
03d7a17880
|
@ -146,6 +146,7 @@ for a particular financial year and for preparation of vouchers there is a modul
|
||||||
'account_unit_test.xml',
|
'account_unit_test.xml',
|
||||||
],
|
],
|
||||||
'test': [
|
'test': [
|
||||||
|
'test/account_test_users.yml',
|
||||||
'test/account_customer_invoice.yml',
|
'test/account_customer_invoice.yml',
|
||||||
'test/account_supplier_invoice.yml',
|
'test/account_supplier_invoice.yml',
|
||||||
'test/account_change_currency.yml',
|
'test/account_change_currency.yml',
|
||||||
|
@ -153,12 +154,11 @@ for a particular financial year and for preparation of vouchers there is a modul
|
||||||
'test/account_period_close.yml',
|
'test/account_period_close.yml',
|
||||||
'test/account_use_model.yml',
|
'test/account_use_model.yml',
|
||||||
'test/account_validate_account_move.yml',
|
'test/account_validate_account_move.yml',
|
||||||
'test/account_fiscalyear_close.yml',
|
|
||||||
#'test/account_bank_statement.yml',
|
#'test/account_bank_statement.yml',
|
||||||
#'test/account_cash_statement.yml',
|
#'test/account_cash_statement.yml',
|
||||||
'test/test_edi_invoice.yml',
|
'test/test_edi_invoice.yml',
|
||||||
'test/account_report.yml',
|
'test/account_report.yml',
|
||||||
'test/account_fiscalyear_close_state.yml', #last test, as it will definitively close the demo fiscalyear
|
'test/account_fiscalyear_close.yml', #last test, as it will definitively close the demo fiscalyear
|
||||||
],
|
],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
'auto_install': False,
|
'auto_install': False,
|
||||||
|
|
|
@ -28,7 +28,7 @@ import time
|
||||||
import openerp
|
import openerp
|
||||||
from openerp import SUPERUSER_ID
|
from openerp import SUPERUSER_ID
|
||||||
from openerp import tools
|
from openerp import tools
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv, expression
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
from openerp.tools.float_utils import float_round
|
from openerp.tools.float_utils import float_round
|
||||||
|
|
||||||
|
@ -137,16 +137,27 @@ class account_account_type(osv.osv):
|
||||||
_name = "account.account.type"
|
_name = "account.account.type"
|
||||||
_description = "Account Type"
|
_description = "Account Type"
|
||||||
|
|
||||||
def _get_current_report_type(self, cr, uid, ids, name, arg, context=None):
|
def _get_financial_report_ref(self, cr, uid, context=None):
|
||||||
obj_data = self.pool.get('ir.model.data')
|
obj_data = self.pool.get('ir.model.data')
|
||||||
obj_financial_report = self.pool.get('account.financial.report')
|
obj_financial_report = self.pool.get('account.financial.report')
|
||||||
|
financial_report_ref = {}
|
||||||
|
for key, financial_report in [
|
||||||
|
('asset','account_financial_report_assets0'),
|
||||||
|
('liability','account_financial_report_liability0'),
|
||||||
|
('income','account_financial_report_income0'),
|
||||||
|
('expense','account_financial_report_expense0'),
|
||||||
|
]:
|
||||||
|
try:
|
||||||
|
financial_report_ref[key] = obj_financial_report.browse(cr, uid,
|
||||||
|
obj_data.get_object_reference(cr, uid, 'account', financial_report)[1],
|
||||||
|
context=context)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
return financial_report_ref
|
||||||
|
|
||||||
|
def _get_current_report_type(self, cr, uid, ids, name, arg, context=None):
|
||||||
res = {}
|
res = {}
|
||||||
financial_report_ref = {
|
financial_report_ref = self._get_financial_report_ref(cr, uid, context=context)
|
||||||
'asset': obj_financial_report.browse(cr, uid, obj_data.get_object_reference(cr, uid, 'account','account_financial_report_assets0')[1], context=context),
|
|
||||||
'liability': obj_financial_report.browse(cr, uid, obj_data.get_object_reference(cr, uid, 'account','account_financial_report_liability0')[1], context=context),
|
|
||||||
'income': obj_financial_report.browse(cr, uid, obj_data.get_object_reference(cr, uid, 'account','account_financial_report_income0')[1], context=context),
|
|
||||||
'expense': obj_financial_report.browse(cr, uid, obj_data.get_object_reference(cr, uid, 'account','account_financial_report_expense0')[1], context=context),
|
|
||||||
}
|
|
||||||
for record in self.browse(cr, uid, ids, context=context):
|
for record in self.browse(cr, uid, ids, context=context):
|
||||||
res[record.id] = 'none'
|
res[record.id] = 'none'
|
||||||
for key, financial_report in financial_report_ref.items():
|
for key, financial_report in financial_report_ref.items():
|
||||||
|
@ -157,15 +168,9 @@ class account_account_type(osv.osv):
|
||||||
|
|
||||||
def _save_report_type(self, cr, uid, account_type_id, field_name, field_value, arg, context=None):
|
def _save_report_type(self, cr, uid, account_type_id, field_name, field_value, arg, context=None):
|
||||||
field_value = field_value or 'none'
|
field_value = field_value or 'none'
|
||||||
obj_data = self.pool.get('ir.model.data')
|
|
||||||
obj_financial_report = self.pool.get('account.financial.report')
|
obj_financial_report = self.pool.get('account.financial.report')
|
||||||
#unlink if it exists somewhere in the financial reports related to BS or PL
|
#unlink if it exists somewhere in the financial reports related to BS or PL
|
||||||
financial_report_ref = {
|
financial_report_ref = self._get_financial_report_ref(cr, uid, context=context)
|
||||||
'asset': obj_financial_report.browse(cr, uid, obj_data.get_object_reference(cr, uid, 'account','account_financial_report_assets0')[1], context=context),
|
|
||||||
'liability': obj_financial_report.browse(cr, uid, obj_data.get_object_reference(cr, uid, 'account','account_financial_report_liability0')[1], context=context),
|
|
||||||
'income': obj_financial_report.browse(cr, uid, obj_data.get_object_reference(cr, uid, 'account','account_financial_report_income0')[1], context=context),
|
|
||||||
'expense': obj_financial_report.browse(cr, uid, obj_data.get_object_reference(cr, uid, 'account','account_financial_report_expense0')[1], context=context),
|
|
||||||
}
|
|
||||||
for key, financial_report in financial_report_ref.items():
|
for key, financial_report in financial_report_ref.items():
|
||||||
list_ids = [x.id for x in financial_report.account_type_ids]
|
list_ids = [x.id for x in financial_report.account_type_ids]
|
||||||
if account_type_id in list_ids:
|
if account_type_id in list_ids:
|
||||||
|
@ -574,15 +579,18 @@ class account_account(osv.osv):
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if name:
|
if name:
|
||||||
ids = self.search(cr, user, [('code', '=like', name+"%")]+args, limit=limit)
|
if operator not in expression.NEGATIVE_TERM_OPERATORS:
|
||||||
if not ids:
|
ids = self.search(cr, user, ['|', ('code', '=like', name+"%"), '|', ('shortcut', '=', name), ('name', operator, name)]+args, limit=limit)
|
||||||
ids = self.search(cr, user, [('shortcut', '=', name)]+ args, limit=limit)
|
if not ids and len(name.split()) >= 2:
|
||||||
if not ids:
|
#Separating code and name of account for searching
|
||||||
ids = self.search(cr, user, [('name', operator, name)]+ args, limit=limit)
|
operand1,operand2 = name.split(' ',1) #name can contain spaces e.g. OpenERP S.A.
|
||||||
if not ids and len(name.split()) >= 2:
|
ids = self.search(cr, user, [('code', operator, operand1), ('name', operator, operand2)]+ args, limit=limit)
|
||||||
#Separating code and name of account for searching
|
else:
|
||||||
operand1,operand2 = name.split(' ',1) #name can contain spaces e.g. OpenERP S.A.
|
ids = self.search(cr, user, ['&','!', ('code', '=like', name+"%"), ('name', operator, name)]+args, limit=limit)
|
||||||
ids = self.search(cr, user, [('code', operator, operand1), ('name', operator, operand2)]+ args, limit=limit)
|
# as negation want to restric, do if already have results
|
||||||
|
if ids and len(name.split()) >= 2:
|
||||||
|
operand1,operand2 = name.split(' ',1) #name can contain spaces e.g. OpenERP S.A.
|
||||||
|
ids = self.search(cr, user, [('code', operator, operand1), ('name', operator, operand2), ('id', 'in', ids)]+ args, limit=limit)
|
||||||
else:
|
else:
|
||||||
ids = self.search(cr, user, args, context=context, limit=limit)
|
ids = self.search(cr, user, args, context=context, limit=limit)
|
||||||
return self.name_get(cr, user, ids, context=context)
|
return self.name_get(cr, user, ids, context=context)
|
||||||
|
@ -1258,6 +1266,10 @@ class account_move(osv.osv):
|
||||||
return [('id', 'in', tuple(ids))]
|
return [('id', 'in', tuple(ids))]
|
||||||
return [('id', '=', '0')]
|
return [('id', '=', '0')]
|
||||||
|
|
||||||
|
def _get_move_from_lines(self, cr, uid, ids, context=None):
|
||||||
|
line_obj = self.pool.get('account.move.line')
|
||||||
|
return [line.move_id.id for line in line_obj.browse(cr, uid, ids, context=context)]
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Number', size=64, required=True),
|
'name': fields.char('Number', size=64, required=True),
|
||||||
'ref': fields.char('Reference', size=64),
|
'ref': fields.char('Reference', size=64),
|
||||||
|
@ -1267,7 +1279,10 @@ class account_move(osv.osv):
|
||||||
help='All manually created new journal entries are usually in the status \'Unposted\', but you can set the option to skip that status on the related journal. In that case, they will behave as journal entries automatically created by the system on document validation (invoices, bank statements...) and will be created in \'Posted\' status.'),
|
help='All manually created new journal entries are usually in the status \'Unposted\', but you can set the option to skip that status on the related journal. In that case, they will behave as journal entries automatically created by the system on document validation (invoices, bank statements...) and will be created in \'Posted\' status.'),
|
||||||
'line_id': fields.one2many('account.move.line', 'move_id', 'Entries', states={'posted':[('readonly',True)]}),
|
'line_id': fields.one2many('account.move.line', 'move_id', 'Entries', states={'posted':[('readonly',True)]}),
|
||||||
'to_check': fields.boolean('To Review', help='Check this box if you are unsure of that journal entry and if you want to note it as \'to be reviewed\' by an accounting expert.'),
|
'to_check': fields.boolean('To Review', help='Check this box if you are unsure of that journal entry and if you want to note it as \'to be reviewed\' by an accounting expert.'),
|
||||||
'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner", store=True),
|
'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner", store={
|
||||||
|
_name: (lambda self, cr,uid,ids,c: ids, ['line_id'], 10),
|
||||||
|
'account.move.line': (_get_move_from_lines, ['partner_id'],10)
|
||||||
|
}),
|
||||||
'amount': fields.function(_amount_compute, string='Amount', digits_compute=dp.get_precision('Account'), type='float', fnct_search=_search_amount),
|
'amount': fields.function(_amount_compute, string='Amount', digits_compute=dp.get_precision('Account'), type='float', fnct_search=_search_amount),
|
||||||
'date': fields.date('Date', required=True, states={'posted':[('readonly',True)]}, select=True),
|
'date': fields.date('Date', required=True, states={'posted':[('readonly',True)]}, select=True),
|
||||||
'narration':fields.text('Internal Note'),
|
'narration':fields.text('Internal Note'),
|
||||||
|
@ -1404,14 +1419,17 @@ class account_move(osv.osv):
|
||||||
l[2]['period_id'] = default_period
|
l[2]['period_id'] = default_period
|
||||||
context['period_id'] = default_period
|
context['period_id'] = default_period
|
||||||
|
|
||||||
if 'line_id' in vals:
|
if vals.get('line_id', False):
|
||||||
c = context.copy()
|
c = context.copy()
|
||||||
c['novalidate'] = True
|
c['novalidate'] = True
|
||||||
c['period_id'] = vals['period_id'] if 'period_id' in vals else self._get_period(cr, uid, context)
|
c['period_id'] = vals['period_id'] if 'period_id' in vals else self._get_period(cr, uid, context)
|
||||||
c['journal_id'] = vals['journal_id']
|
c['journal_id'] = vals['journal_id']
|
||||||
if 'date' in vals: c['date'] = vals['date']
|
if 'date' in vals: c['date'] = vals['date']
|
||||||
result = super(account_move, self).create(cr, uid, vals, c)
|
result = super(account_move, self).create(cr, uid, vals, c)
|
||||||
self.validate(cr, uid, [result], context)
|
tmp = self.validate(cr, uid, [result], context)
|
||||||
|
journal = self.pool.get('account.journal').browse(cr, uid, vals['journal_id'], context)
|
||||||
|
if journal.entry_posted and tmp:
|
||||||
|
self.button_validate(cr,uid, [result], context)
|
||||||
else:
|
else:
|
||||||
result = super(account_move, self).create(cr, uid, vals, context)
|
result = super(account_move, self).create(cr, uid, vals, context)
|
||||||
return result
|
return result
|
||||||
|
@ -1432,6 +1450,8 @@ class account_move(osv.osv):
|
||||||
def unlink(self, cr, uid, ids, context=None, check=True):
|
def unlink(self, cr, uid, ids, context=None, check=True):
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
|
if isinstance(ids, (int, long)):
|
||||||
|
ids = [ids]
|
||||||
toremove = []
|
toremove = []
|
||||||
obj_move_line = self.pool.get('account.move.line')
|
obj_move_line = self.pool.get('account.move.line')
|
||||||
for move in self.browse(cr, uid, ids, context=context):
|
for move in self.browse(cr, uid, ids, context=context):
|
||||||
|
@ -1556,11 +1576,6 @@ class account_move(osv.osv):
|
||||||
obj_analytic_line = self.pool.get('account.analytic.line')
|
obj_analytic_line = self.pool.get('account.analytic.line')
|
||||||
obj_move_line = self.pool.get('account.move.line')
|
obj_move_line = self.pool.get('account.move.line')
|
||||||
for move in self.browse(cr, uid, ids, context):
|
for move in self.browse(cr, uid, ids, context):
|
||||||
# Unlink old analytic lines on move_lines
|
|
||||||
for obj_line in move.line_id:
|
|
||||||
for obj in obj_line.analytic_lines:
|
|
||||||
obj_analytic_line.unlink(cr,uid,obj.id)
|
|
||||||
|
|
||||||
journal = move.journal_id
|
journal = move.journal_id
|
||||||
amount = 0
|
amount = 0
|
||||||
line_ids = []
|
line_ids = []
|
||||||
|
@ -1633,9 +1648,11 @@ class account_move(osv.osv):
|
||||||
else:
|
else:
|
||||||
# We can't validate it (it's unbalanced)
|
# We can't validate it (it's unbalanced)
|
||||||
# Setting the lines as draft
|
# Setting the lines as draft
|
||||||
obj_move_line.write(cr, uid, line_ids, {
|
not_draft_line_ids = list(set(line_ids) - set(line_draft_ids))
|
||||||
'state': 'draft'
|
if not_draft_line_ids:
|
||||||
}, context, check=False)
|
obj_move_line.write(cr, uid, not_draft_line_ids, {
|
||||||
|
'state': 'draft'
|
||||||
|
}, context, check=False)
|
||||||
# Create analytic lines for the valid moves
|
# Create analytic lines for the valid moves
|
||||||
for record in valid_moves:
|
for record in valid_moves:
|
||||||
obj_move_line.create_analytic_lines(cr, uid, [line.id for line in record.line_id], context)
|
obj_move_line.create_analytic_lines(cr, uid, [line.id for line in record.line_id], context)
|
||||||
|
@ -1911,7 +1928,7 @@ class account_tax(osv.osv):
|
||||||
'child_depend':fields.boolean('Tax on Children', help="Set if the tax computation is based on the computation of child taxes rather than on the total amount."),
|
'child_depend':fields.boolean('Tax on Children', help="Set if the tax computation is based on the computation of child taxes rather than on the total amount."),
|
||||||
'python_compute':fields.text('Python Code'),
|
'python_compute':fields.text('Python Code'),
|
||||||
'python_compute_inv':fields.text('Python Code (reverse)'),
|
'python_compute_inv':fields.text('Python Code (reverse)'),
|
||||||
'python_applicable':fields.text('Python Code'),
|
'python_applicable':fields.text('Applicable Code'),
|
||||||
|
|
||||||
#
|
#
|
||||||
# Fields used for the Tax declaration
|
# Fields used for the Tax declaration
|
||||||
|
@ -1925,8 +1942,8 @@ class account_tax(osv.osv):
|
||||||
|
|
||||||
'ref_base_code_id': fields.many2one('account.tax.code', 'Refund Base Code', help="Use this code for the tax declaration."),
|
'ref_base_code_id': fields.many2one('account.tax.code', 'Refund Base Code', help="Use this code for the tax declaration."),
|
||||||
'ref_tax_code_id': fields.many2one('account.tax.code', 'Refund Tax Code', help="Use this code for the tax declaration."),
|
'ref_tax_code_id': fields.many2one('account.tax.code', 'Refund Tax Code', help="Use this code for the tax declaration."),
|
||||||
'ref_base_sign': fields.float('Base Code Sign', help="Usually 1 or -1."),
|
'ref_base_sign': fields.float('Refund Base Code Sign', help="Usually 1 or -1."),
|
||||||
'ref_tax_sign': fields.float('Tax Code Sign', help="Usually 1 or -1."),
|
'ref_tax_sign': fields.float('Refund Tax Code Sign', help="Usually 1 or -1."),
|
||||||
'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"),
|
'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),
|
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||||
'description': fields.char('Tax Code'),
|
'description': fields.char('Tax Code'),
|
||||||
|
@ -2774,6 +2791,7 @@ class account_chart_template(osv.osv):
|
||||||
'parent_id': fields.many2one('account.chart.template', 'Parent Chart Template'),
|
'parent_id': fields.many2one('account.chart.template', 'Parent Chart Template'),
|
||||||
'code_digits': fields.integer('# of Digits', required=True, help="No. of Digits to use for account code"),
|
'code_digits': fields.integer('# of Digits', required=True, help="No. of Digits to use for account code"),
|
||||||
'visible': fields.boolean('Can be Visible?', help="Set this to False if you don't want this template to be used actively in the wizard that generate Chart of Accounts from templates, this is useful when you want to generate accounts of this template only when loading its child template."),
|
'visible': fields.boolean('Can be Visible?', help="Set this to False if you don't want this template to be used actively in the wizard that generate Chart of Accounts from templates, this is useful when you want to generate accounts of this template only when loading its child template."),
|
||||||
|
'currency_id': fields.many2one('res.currency', 'Currency'),
|
||||||
'complete_tax_set': fields.boolean('Complete Set of Taxes', help='This boolean helps you to choose if you want to propose to the user to encode the sale and purchase rates or choose from list of taxes. This last choice assumes that the set of tax defined on this template is complete'),
|
'complete_tax_set': fields.boolean('Complete Set of Taxes', help='This boolean helps you to choose if you want to propose to the user to encode the sale and purchase rates or choose from list of taxes. This last choice assumes that the set of tax defined on this template is complete'),
|
||||||
'account_root_id': fields.many2one('account.account.template', 'Root Account', domain=[('parent_id','=',False)]),
|
'account_root_id': fields.many2one('account.account.template', 'Root Account', domain=[('parent_id','=',False)]),
|
||||||
'tax_code_root_id': fields.many2one('account.tax.code.template', 'Root Tax Code', domain=[('parent_id','=',False)]),
|
'tax_code_root_id': fields.many2one('account.tax.code.template', 'Root Tax Code', domain=[('parent_id','=',False)]),
|
||||||
|
@ -2815,7 +2833,7 @@ class account_tax_template(osv.osv):
|
||||||
'child_depend':fields.boolean('Tax on Children', help="Set if the tax computation is based on the computation of child taxes rather than on the total amount."),
|
'child_depend':fields.boolean('Tax on Children', help="Set if the tax computation is based on the computation of child taxes rather than on the total amount."),
|
||||||
'python_compute':fields.text('Python Code'),
|
'python_compute':fields.text('Python Code'),
|
||||||
'python_compute_inv':fields.text('Python Code (reverse)'),
|
'python_compute_inv':fields.text('Python Code (reverse)'),
|
||||||
'python_applicable':fields.text('Python Code'),
|
'python_applicable':fields.text('Applicable Code'),
|
||||||
|
|
||||||
#
|
#
|
||||||
# Fields used for the Tax declaration
|
# Fields used for the Tax declaration
|
||||||
|
@ -2829,8 +2847,8 @@ class account_tax_template(osv.osv):
|
||||||
|
|
||||||
'ref_base_code_id': fields.many2one('account.tax.code.template', 'Refund Base Code', help="Use this code for the tax declaration."),
|
'ref_base_code_id': fields.many2one('account.tax.code.template', 'Refund Base Code', help="Use this code for the tax declaration."),
|
||||||
'ref_tax_code_id': fields.many2one('account.tax.code.template', 'Refund Tax Code', help="Use this code for the tax declaration."),
|
'ref_tax_code_id': fields.many2one('account.tax.code.template', 'Refund Tax Code', help="Use this code for the tax declaration."),
|
||||||
'ref_base_sign': fields.float('Base Code Sign', help="Usually 1 or -1."),
|
'ref_base_sign': fields.float('Refund Base Code Sign', help="Usually 1 or -1."),
|
||||||
'ref_tax_sign': fields.float('Tax Code Sign', help="Usually 1 or -1."),
|
'ref_tax_sign': fields.float('Refund Tax Code Sign', help="Usually 1 or -1."),
|
||||||
'include_base_amount': fields.boolean('Include in Base Amount', help="Set if the amount of tax must be included in the base amount before computing the next taxes."),
|
'include_base_amount': fields.boolean('Include in Base Amount', help="Set if the amount of tax must be included in the base amount before computing the next taxes."),
|
||||||
'description': fields.char('Internal Name'),
|
'description': fields.char('Internal Name'),
|
||||||
'type_tax_use': fields.selection([('sale','Sale'),('purchase','Purchase'),('all','All')], 'Tax Use In', required=True,),
|
'type_tax_use': fields.selection([('sale','Sale'),('purchase','Purchase'),('all','All')], 'Tax Use In', required=True,),
|
||||||
|
@ -3029,11 +3047,19 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
||||||
'complete_tax_set': fields.boolean('Complete Set of Taxes', help='This boolean helps you to choose if you want to propose to the user to encode the sales and purchase rates or use the usual m2o fields. This last choice assumes that the set of tax defined for the chosen template is complete'),
|
'complete_tax_set': fields.boolean('Complete Set of Taxes', help='This boolean helps you to choose if you want to propose to the user to encode the sales and purchase rates or use the usual m2o fields. This last choice assumes that the set of tax defined for the chosen template is complete'),
|
||||||
}
|
}
|
||||||
|
|
||||||
def onchange_company_id(self, cr, uid, ids, company_id, context=None):
|
|
||||||
currency_id = False
|
def _get_chart_parent_ids(self, cr, uid, chart_template, context=None):
|
||||||
if company_id:
|
""" Returns the IDs of all ancestor charts, including the chart itself.
|
||||||
currency_id = self.pool.get('res.company').browse(cr, uid, company_id, context=context).currency_id.id
|
(inverse of child_of operator)
|
||||||
return {'value': {'currency_id': currency_id}}
|
|
||||||
|
:param browse_record chart_template: the account.chart.template record
|
||||||
|
:return: the IDS of all ancestor charts, including the chart itself.
|
||||||
|
"""
|
||||||
|
result = [chart_template.id]
|
||||||
|
while chart_template.parent_id:
|
||||||
|
chart_template = chart_template.parent_id
|
||||||
|
result.append(chart_template.id)
|
||||||
|
return result
|
||||||
|
|
||||||
def onchange_tax_rate(self, cr, uid, ids, rate=False, context=None):
|
def onchange_tax_rate(self, cr, uid, ids, rate=False, context=None):
|
||||||
return {'value': {'purchase_tax_rate': rate or False}}
|
return {'value': {'purchase_tax_rate': rate or False}}
|
||||||
|
@ -3044,15 +3070,21 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
||||||
res['value'] = {'complete_tax_set': False, 'sale_tax': False, 'purchase_tax': False}
|
res['value'] = {'complete_tax_set': False, 'sale_tax': False, 'purchase_tax': False}
|
||||||
if chart_template_id:
|
if chart_template_id:
|
||||||
data = self.pool.get('account.chart.template').browse(cr, uid, chart_template_id, context=context)
|
data = self.pool.get('account.chart.template').browse(cr, uid, chart_template_id, context=context)
|
||||||
res['value'].update({'complete_tax_set': data.complete_tax_set})
|
currency_id = data.currency_id and data.currency_id.id or self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id
|
||||||
|
res['value'].update({'complete_tax_set': data.complete_tax_set, 'currency_id': currency_id})
|
||||||
if data.complete_tax_set:
|
if data.complete_tax_set:
|
||||||
# default tax is given by the lowest sequence. For same sequence we will take the latest created as it will be the case for tax created while isntalling the generic chart of account
|
# default tax is given by the lowest sequence. For same sequence we will take the latest created as it will be the case for tax created while isntalling the generic chart of account
|
||||||
sale_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id"
|
chart_ids = self._get_chart_parent_ids(cr, uid, data, context=context)
|
||||||
, "=", chart_template_id), ('type_tax_use', 'in', ('sale','all'))], order="sequence, id desc")
|
base_tax_domain = [("chart_template_id", "in", chart_ids), ('parent_id', '=', False)]
|
||||||
purchase_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id"
|
sale_tax_domain = base_tax_domain + [('type_tax_use', 'in', ('sale','all'))]
|
||||||
, "=", chart_template_id), ('type_tax_use', 'in', ('purchase','all'))], order="sequence, id desc")
|
purchase_tax_domain = base_tax_domain + [('type_tax_use', 'in', ('purchase','all'))]
|
||||||
res['value'].update({'sale_tax': sale_tax_ids and sale_tax_ids[0] or False, 'purchase_tax': purchase_tax_ids and purchase_tax_ids[0] or False})
|
sale_tax_ids = tax_templ_obj.search(cr, uid, sale_tax_domain, order="sequence, id desc")
|
||||||
|
purchase_tax_ids = tax_templ_obj.search(cr, uid, purchase_tax_domain, order="sequence, id desc")
|
||||||
|
res['value'].update({'sale_tax': sale_tax_ids and sale_tax_ids[0] or False,
|
||||||
|
'purchase_tax': purchase_tax_ids and purchase_tax_ids[0] or False})
|
||||||
|
res.setdefault('domain', {})
|
||||||
|
res['domain']['sale_tax'] = repr(sale_tax_domain)
|
||||||
|
res['domain']['purchase_tax'] = repr(purchase_tax_domain)
|
||||||
if data.code_digits:
|
if data.code_digits:
|
||||||
res['value'].update({'code_digits': data.code_digits})
|
res['value'].update({'code_digits': data.code_digits})
|
||||||
return res
|
return res
|
||||||
|
@ -3060,6 +3092,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
||||||
def default_get(self, cr, uid, fields, context=None):
|
def default_get(self, cr, uid, fields, context=None):
|
||||||
res = super(wizard_multi_charts_accounts, self).default_get(cr, uid, fields, context=context)
|
res = super(wizard_multi_charts_accounts, self).default_get(cr, uid, fields, context=context)
|
||||||
tax_templ_obj = self.pool.get('account.tax.template')
|
tax_templ_obj = self.pool.get('account.tax.template')
|
||||||
|
account_chart_template = self.pool['account.chart.template']
|
||||||
|
|
||||||
if 'bank_accounts_id' in fields:
|
if 'bank_accounts_id' in fields:
|
||||||
res.update({'bank_accounts_id': [{'acc_name': _('Cash'), 'account_type': 'cash'},{'acc_name': _('Bank'), 'account_type': 'bank'}]})
|
res.update({'bank_accounts_id': [{'acc_name': _('Cash'), 'account_type': 'cash'},{'acc_name': _('Bank'), 'account_type': 'bank'}]})
|
||||||
|
@ -3073,17 +3106,28 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
||||||
currency_id = company_obj.on_change_country(cr, uid, company_id, country_id, context=context)['value']['currency_id']
|
currency_id = company_obj.on_change_country(cr, uid, company_id, country_id, context=context)['value']['currency_id']
|
||||||
res.update({'currency_id': currency_id})
|
res.update({'currency_id': currency_id})
|
||||||
|
|
||||||
ids = self.pool.get('account.chart.template').search(cr, uid, [('visible', '=', True)], context=context)
|
ids = account_chart_template.search(cr, uid, [('visible', '=', True)], context=context)
|
||||||
if ids:
|
if ids:
|
||||||
|
#in order to set default chart which was last created set max of ids.
|
||||||
|
chart_id = max(ids)
|
||||||
|
if context.get("default_charts"):
|
||||||
|
model_data = self.pool.get('ir.model.data').search_read(cr, uid, [('model','=','account.chart.template'),('module','=',context.get("default_charts"))], ['res_id'], context=context)
|
||||||
|
if model_data:
|
||||||
|
chart_id = model_data[0]['res_id']
|
||||||
|
chart = account_chart_template.browse(cr, uid, chart_id, context=context)
|
||||||
|
chart_hierarchy_ids = self._get_chart_parent_ids(cr, uid, chart, context=context)
|
||||||
if 'chart_template_id' in fields:
|
if 'chart_template_id' in fields:
|
||||||
res.update({'only_one_chart_template': len(ids) == 1, 'chart_template_id': ids[0]})
|
res.update({'only_one_chart_template': len(ids) == 1,
|
||||||
|
'chart_template_id': chart_id})
|
||||||
if 'sale_tax' in fields:
|
if 'sale_tax' in fields:
|
||||||
sale_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id"
|
sale_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id", "in", chart_hierarchy_ids),
|
||||||
, "=", ids[0]), ('type_tax_use', 'in', ('sale','all'))], order="sequence")
|
('type_tax_use', 'in', ('sale','all'))],
|
||||||
|
order="sequence")
|
||||||
res.update({'sale_tax': sale_tax_ids and sale_tax_ids[0] or False})
|
res.update({'sale_tax': sale_tax_ids and sale_tax_ids[0] or False})
|
||||||
if 'purchase_tax' in fields:
|
if 'purchase_tax' in fields:
|
||||||
purchase_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id"
|
purchase_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id", "in", chart_hierarchy_ids),
|
||||||
, "=", ids[0]), ('type_tax_use', 'in', ('purchase','all'))], order="sequence")
|
('type_tax_use', 'in', ('purchase','all'))],
|
||||||
|
order="sequence")
|
||||||
res.update({'purchase_tax': purchase_tax_ids and purchase_tax_ids[0] or False})
|
res.update({'purchase_tax': purchase_tax_ids and purchase_tax_ids[0] or False})
|
||||||
res.update({
|
res.update({
|
||||||
'purchase_tax_rate': 15.0,
|
'purchase_tax_rate': 15.0,
|
||||||
|
@ -3351,12 +3395,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
||||||
obj_tax_temp = self.pool.get('account.tax.template')
|
obj_tax_temp = self.pool.get('account.tax.template')
|
||||||
chart_template = obj_wizard.chart_template_id
|
chart_template = obj_wizard.chart_template_id
|
||||||
vals = {}
|
vals = {}
|
||||||
# get the ids of all the parents of the selected account chart template
|
all_parents = self._get_chart_parent_ids(cr, uid, chart_template, context=context)
|
||||||
current_chart_template = chart_template
|
|
||||||
all_parents = [current_chart_template.id]
|
|
||||||
while current_chart_template.parent_id:
|
|
||||||
current_chart_template = current_chart_template.parent_id
|
|
||||||
all_parents.append(current_chart_template.id)
|
|
||||||
# create tax templates and tax code templates from purchase_tax_rate and sale_tax_rate fields
|
# create tax templates and tax code templates from purchase_tax_rate and sale_tax_rate fields
|
||||||
if not chart_template.complete_tax_set:
|
if not chart_template.complete_tax_set:
|
||||||
value = obj_wizard.sale_tax_rate
|
value = obj_wizard.sale_tax_rate
|
||||||
|
@ -3373,6 +3412,8 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
||||||
all the provided information to create the accounts, the banks, the journals, the taxes, the tax codes, the
|
all the provided information to create the accounts, the banks, the journals, the taxes, the tax codes, the
|
||||||
accounting properties... accordingly for the chosen company.
|
accounting properties... accordingly for the chosen company.
|
||||||
'''
|
'''
|
||||||
|
if uid != SUPERUSER_ID and not self.pool['res.users'].has_group(cr, uid, 'base.group_erp_manager'):
|
||||||
|
raise openerp.exceptions.AccessError(_("Only administrators can change the settings"))
|
||||||
obj_data = self.pool.get('ir.model.data')
|
obj_data = self.pool.get('ir.model.data')
|
||||||
ir_values_obj = self.pool.get('ir.values')
|
ir_values_obj = self.pool.get('ir.values')
|
||||||
obj_wizard = self.browse(cr, uid, ids[0])
|
obj_wizard = self.browse(cr, uid, ids[0])
|
||||||
|
@ -3389,7 +3430,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
||||||
self.pool[tmp2[0]].write(cr, uid, tmp2[1], {
|
self.pool[tmp2[0]].write(cr, uid, tmp2[1], {
|
||||||
'currency_id': obj_wizard.currency_id.id
|
'currency_id': obj_wizard.currency_id.id
|
||||||
})
|
})
|
||||||
except ValueError, e:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# If the floats for sale/purchase rates have been filled, create templates from them
|
# If the floats for sale/purchase rates have been filled, create templates from them
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
</form>
|
</form>
|
||||||
<footer position="replace">
|
<footer position="replace">
|
||||||
<footer>
|
<footer>
|
||||||
<button name="action_next" type="object" string="Continue" class="oe_highlight"/>
|
<button name="action_next" context="{'default_charts':charts}" type="object" string="Continue" class="oe_highlight"/>
|
||||||
</footer>
|
</footer>
|
||||||
</footer>
|
</footer>
|
||||||
<separator string="title" position="replace">
|
<separator string="title" position="replace">
|
||||||
|
|
|
@ -1431,6 +1431,7 @@ class account_invoice_line(osv.osv):
|
||||||
|
|
||||||
_name = "account.invoice.line"
|
_name = "account.invoice.line"
|
||||||
_description = "Invoice Line"
|
_description = "Invoice Line"
|
||||||
|
_order = "invoice_id,sequence,id"
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.text('Description', required=True),
|
'name': fields.text('Description', required=True),
|
||||||
'origin': fields.char('Source Document', size=256, help="Reference of the document that produced this invoice."),
|
'origin': fields.char('Source Document', size=256, help="Reference of the document that produced this invoice."),
|
||||||
|
@ -1467,6 +1468,7 @@ class account_invoice_line(osv.osv):
|
||||||
'discount': 0.0,
|
'discount': 0.0,
|
||||||
'price_unit': _price_unit_default,
|
'price_unit': _price_unit_default,
|
||||||
'account_id': _default_account_id,
|
'account_id': _default_account_id,
|
||||||
|
'sequence': 10,
|
||||||
}
|
}
|
||||||
|
|
||||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||||
|
|
|
@ -192,6 +192,7 @@
|
||||||
<page string="Invoice">
|
<page string="Invoice">
|
||||||
<field context="{'partner_id': partner_id, 'price_type': context.get('price_type') or False, 'type': type}" name="invoice_line">
|
<field context="{'partner_id': partner_id, 'price_type': context.get('price_type') or False, 'type': type}" name="invoice_line">
|
||||||
<tree string="Invoice lines" editable="bottom">
|
<tree string="Invoice lines" editable="bottom">
|
||||||
|
<field name="sequence" widget="handle" />
|
||||||
<field name="product_id"
|
<field name="product_id"
|
||||||
on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, context, parent.company_id)"/>
|
on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, context, parent.company_id)"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
|
@ -250,7 +251,7 @@
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field domain="[('partner_id', '=', partner_id)]" name="partner_bank_id" on_change="onchange_partner_bank(partner_bank_id)"/>
|
<field domain="[('partner_id', '=', partner_id)]" name="partner_bank_id" on_change="onchange_partner_bank(partner_bank_id)"/>
|
||||||
<field name="user_id"/>
|
<field name="user_id" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'account.group_account_invoice']}"/>
|
||||||
<field name="name" invisible="1"/>
|
<field name="name" invisible="1"/>
|
||||||
<field name="payment_term" widget="selection"/>
|
<field name="payment_term" widget="selection"/>
|
||||||
</group>
|
</group>
|
||||||
|
@ -348,6 +349,7 @@
|
||||||
<page string="Invoice Lines">
|
<page string="Invoice Lines">
|
||||||
<field name="invoice_line" nolabel="1" widget="one2many_list" context="{'type': type}">
|
<field name="invoice_line" nolabel="1" widget="one2many_list" context="{'type': type}">
|
||||||
<tree string="Invoice Lines" editable="bottom">
|
<tree string="Invoice Lines" editable="bottom">
|
||||||
|
<field name="sequence" widget="handle"/>
|
||||||
<field name="product_id"
|
<field name="product_id"
|
||||||
on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, context, parent.company_id)"/>
|
on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, context, parent.company_id)"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
|
@ -392,7 +394,7 @@
|
||||||
<group col="4">
|
<group col="4">
|
||||||
<group>
|
<group>
|
||||||
<field name="company_id" on_change="onchange_company_id(company_id,partner_id,type,invoice_line,currency_id,context)" widget="selection" groups="base.group_multi_company"/>
|
<field name="company_id" on_change="onchange_company_id(company_id,partner_id,type,invoice_line,currency_id,context)" widget="selection" groups="base.group_multi_company"/>
|
||||||
<field name="user_id" groups="base.group_user"/>
|
<field name="user_id" groups="base.group_user" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'account.group_account_invoice']}"/>
|
||||||
<field domain="[('partner_id.ref_companies', 'in', [company_id])]" name="partner_bank_id"/>
|
<field domain="[('partner_id.ref_companies', 'in', [company_id])]" name="partner_bank_id"/>
|
||||||
<field name="period_id" domain="[('state', '=', 'draft'), ('company_id', '=', company_id)]"
|
<field name="period_id" domain="[('state', '=', 'draft'), ('company_id', '=', company_id)]"
|
||||||
groups="account.group_account_manager"
|
groups="account.group_account_manager"
|
||||||
|
@ -461,14 +463,14 @@
|
||||||
<separator/>
|
<separator/>
|
||||||
<filter domain="[('user_id','=',uid)]" help="My Invoices"/>
|
<filter domain="[('user_id','=',uid)]" help="My Invoices"/>
|
||||||
<group expand="0" string="Group By...">
|
<group expand="0" string="Group By...">
|
||||||
<filter name="partner_id" string="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
<filter name="group_by_partner_id" string="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||||
<filter name="commercial_partner_id" string="Commercial Partner" domain="[]" context="{'group_by':'commercial_partner_id'}"/>
|
<filter name="commercial_partner_id" string="Commercial Partner" domain="[]" context="{'group_by':'commercial_partner_id'}"/>
|
||||||
<filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
|
<filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
|
||||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||||
<filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
<filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/>
|
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/>
|
||||||
<filter string="Invoice Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_invoice'}"/>
|
<filter string="Invoice Month" icon="terp-go-month" domain="[]" context="{'group_by':'date_invoice'}"/>
|
||||||
<filter string="Due Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_due'}"/>
|
<filter string="Due Month" icon="terp-go-month" domain="[]" context="{'group_by':'date_due'}"/>
|
||||||
</group>
|
</group>
|
||||||
</search>
|
</search>
|
||||||
</field>
|
</field>
|
||||||
|
|
|
@ -26,7 +26,7 @@ from operator import itemgetter
|
||||||
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
from openerp import netsvc
|
from openerp import workflow
|
||||||
from openerp.osv import fields, osv, orm
|
from openerp.osv import fields, osv, orm
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
import openerp.addons.decimal_precision as dp
|
import openerp.addons.decimal_precision as dp
|
||||||
|
@ -193,6 +193,8 @@ class account_move_line(osv.osv):
|
||||||
if obj_line.analytic_account_id:
|
if obj_line.analytic_account_id:
|
||||||
if not obj_line.journal_id.analytic_journal_id:
|
if not obj_line.journal_id.analytic_journal_id:
|
||||||
raise osv.except_osv(_('No Analytic Journal!'),_("You have to define an analytic journal on the '%s' journal!") % (obj_line.journal_id.name, ))
|
raise osv.except_osv(_('No Analytic Journal!'),_("You have to define an analytic journal on the '%s' journal!") % (obj_line.journal_id.name, ))
|
||||||
|
if obj_line.analytic_lines:
|
||||||
|
acc_ana_line_obj.unlink(cr,uid,[obj.id for obj in obj_line.analytic_lines])
|
||||||
vals_line = self._prepare_analytic_line(cr, uid, obj_line, context=context)
|
vals_line = self._prepare_analytic_line(cr, uid, obj_line, context=context)
|
||||||
acc_ana_line_obj.create(cr, uid, vals_line)
|
acc_ana_line_obj.create(cr, uid, vals_line)
|
||||||
return True
|
return True
|
||||||
|
@ -311,13 +313,13 @@ class account_move_line(osv.osv):
|
||||||
context = {}
|
context = {}
|
||||||
c = context.copy()
|
c = context.copy()
|
||||||
c['initital_bal'] = True
|
c['initital_bal'] = True
|
||||||
sql = """SELECT l2.id, SUM(l1.debit-l1.credit)
|
sql = """SELECT l1.id, COALESCE(SUM(l2.debit-l2.credit), 0)
|
||||||
FROM account_move_line l1, account_move_line l2
|
FROM account_move_line l1 LEFT JOIN account_move_line l2
|
||||||
WHERE l2.account_id = l1.account_id
|
ON (l1.account_id = l2.account_id
|
||||||
AND l1.id <= l2.id
|
AND l2.id <= l1.id
|
||||||
AND l2.id IN %s AND """ + \
|
AND """ + \
|
||||||
self._query_get(cr, uid, obj='l1', context=c) + \
|
self._query_get(cr, uid, obj='l2', context=c) + \
|
||||||
" GROUP BY l2.id"
|
") WHERE l1.id IN %s GROUP BY l1.id"
|
||||||
|
|
||||||
cr.execute(sql, [tuple(ids)])
|
cr.execute(sql, [tuple(ids)])
|
||||||
return dict(cr.fetchall())
|
return dict(cr.fetchall())
|
||||||
|
@ -932,11 +934,10 @@ class account_move_line(osv.osv):
|
||||||
'line_id': map(lambda x: (4, x, False), ids),
|
'line_id': map(lambda x: (4, x, False), ids),
|
||||||
'line_partial_ids': map(lambda x: (3, x, False), ids)
|
'line_partial_ids': map(lambda x: (3, x, False), ids)
|
||||||
})
|
})
|
||||||
wf_service = netsvc.LocalService("workflow")
|
|
||||||
# the id of the move.reconcile is written in the move.line (self) by the create method above
|
# the id of the move.reconcile is written in the move.line (self) by the create method above
|
||||||
# because of the way the line_id are defined: (4, x, False)
|
# because of the way the line_id are defined: (4, x, False)
|
||||||
for id in ids:
|
for id in ids:
|
||||||
wf_service.trg_trigger(uid, 'account.move.line', id, cr)
|
workflow.trg_trigger(uid, 'account.move.line', id, cr)
|
||||||
|
|
||||||
if lines and lines[0]:
|
if lines and lines[0]:
|
||||||
partner_id = lines[0].partner_id and lines[0].partner_id.id or False
|
partner_id = lines[0].partner_id and lines[0].partner_id.id or False
|
||||||
|
@ -1208,20 +1209,6 @@ class account_move_line(osv.osv):
|
||||||
if not ok:
|
if not ok:
|
||||||
raise osv.except_osv(_('Bad Account!'), _('You cannot use this general account in this journal, check the tab \'Entry Controls\' on the related journal.'))
|
raise osv.except_osv(_('Bad Account!'), _('You cannot use this general account in this journal, check the tab \'Entry Controls\' on the related journal.'))
|
||||||
|
|
||||||
if vals.get('analytic_account_id',False):
|
|
||||||
if journal.analytic_journal_id:
|
|
||||||
vals['analytic_lines'] = [(0,0, {
|
|
||||||
'name': vals['name'],
|
|
||||||
'date': vals.get('date', time.strftime('%Y-%m-%d')),
|
|
||||||
'account_id': vals.get('analytic_account_id', False),
|
|
||||||
'unit_amount': vals.get('quantity', 1.0),
|
|
||||||
'amount': vals.get('debit', 0.0) or vals.get('credit', 0.0),
|
|
||||||
'general_account_id': vals.get('account_id', False),
|
|
||||||
'journal_id': journal.analytic_journal_id.id,
|
|
||||||
'ref': vals.get('ref', False),
|
|
||||||
'user_id': uid
|
|
||||||
})]
|
|
||||||
|
|
||||||
result = super(account_move_line, self).create(cr, uid, vals, context=context)
|
result = super(account_move_line, self).create(cr, uid, vals, context=context)
|
||||||
# CREATE Taxes
|
# CREATE Taxes
|
||||||
if vals.get('account_tax_id', False):
|
if vals.get('account_tax_id', False):
|
||||||
|
@ -1283,7 +1270,7 @@ class account_move_line(osv.osv):
|
||||||
self.create(cr, uid, data, context)
|
self.create(cr, uid, data, context)
|
||||||
del vals['account_tax_id']
|
del vals['account_tax_id']
|
||||||
|
|
||||||
if check and ((not context.get('no_store_function')) or journal.entry_posted):
|
if check and not context.get('novalidate') and ((not context.get('no_store_function')) or journal.entry_posted):
|
||||||
tmp = move_obj.validate(cr, uid, [vals['move_id']], context)
|
tmp = move_obj.validate(cr, uid, [vals['move_id']], context)
|
||||||
if journal.entry_posted and tmp:
|
if journal.entry_posted and tmp:
|
||||||
move_obj.button_validate(cr,uid, [vals['move_id']], context)
|
move_obj.button_validate(cr,uid, [vals['move_id']], context)
|
||||||
|
|
|
@ -413,7 +413,7 @@
|
||||||
<page string="Advanced Settings">
|
<page string="Advanced Settings">
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="user_id"/>
|
<field name="user_id" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'account.group_account_user']}"/>
|
||||||
<field name="sequence_id" required="0"/>
|
<field name="sequence_id" required="0"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
|
@ -1406,7 +1406,7 @@
|
||||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||||
<filter string="States" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
<filter string="States" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||||
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/>
|
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/>
|
||||||
<filter string="Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
|
<filter string="Entries Month" icon="terp-go-month" domain="[]" context="{'group_by':'date'}" help="Journal Entries by Month"/>
|
||||||
</group>
|
</group>
|
||||||
</search>
|
</search>
|
||||||
</field>
|
</field>
|
||||||
|
@ -2120,7 +2120,7 @@
|
||||||
<field name="chart_template_id" widget="selection" on_change="onchange_chart_template_id(chart_template_id)" domain="[('visible','=', True)]"/>
|
<field name="chart_template_id" widget="selection" on_change="onchange_chart_template_id(chart_template_id)" domain="[('visible','=', True)]"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="company_id" widget="selection" on_change="onchange_company_id(company_id)"/> <!-- we assume that this wizard will be run only by administrators and as this field may cause problem if hidden (because of the default company of the user removed from the selection because already configured), we simply choosed to remove the group "multi company" of it -->
|
<field name="company_id" widget="selection"/> <!-- we assume that this wizard will be run only by administrators and as this field may cause problem if hidden (because of the default company of the user removed from the selection because already configured), we simply choosed to remove the group "multi company" of it -->
|
||||||
<field name="currency_id" class="oe_inline"/>
|
<field name="currency_id" class="oe_inline"/>
|
||||||
<field name="sale_tax" attrs="{'invisible': [('complete_tax_set', '!=', True)]}" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False),('type_tax_use','in',('sale','all'))]"/>
|
<field name="sale_tax" attrs="{'invisible': [('complete_tax_set', '!=', True)]}" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False),('type_tax_use','in',('sale','all'))]"/>
|
||||||
<label for="sale_tax_rate" string="Sale Tax" attrs="{'invisible': [('complete_tax_set', '=', True)]}"/>
|
<label for="sale_tax_rate" string="Sale Tax" attrs="{'invisible': [('complete_tax_set', '=', True)]}"/>
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="account_payment_term_line_immediate" model="account.payment.term.line">
|
<record id="account_payment_term_line_immediate" model="account.payment.term.line">
|
||||||
<field name="name">Immediate Payment</field>
|
|
||||||
<field name="value">balance</field>
|
<field name="value">balance</field>
|
||||||
<field eval="0" name="days"/>
|
<field eval="0" name="days"/>
|
||||||
<field eval="0" name="days2"/>
|
<field eval="0" name="days2"/>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<!--Email template -->
|
<!--Email template -->
|
||||||
<record id="email_template_edi_invoice" model="email.template">
|
<record id="email_template_edi_invoice" model="email.template">
|
||||||
<field name="name">Invoice - Send by Email</field>
|
<field name="name">Invoice - Send by Email</field>
|
||||||
<field name="email_from">${object.user_id.email or object.company_id.email or 'noreply@localhost'}</field>
|
<field name="email_from">${(object.user_id.email or object.company_id.email or 'noreply@localhost')|safe}</field>
|
||||||
<field name="subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a'})</field>
|
<field name="subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a'})</field>
|
||||||
<field name="partner_to">${object.partner_id.id}</field>
|
<field name="partner_to">${object.partner_id.id}</field>
|
||||||
<field name="model_id" ref="account.model_account_invoice"/>
|
<field name="model_id" ref="account.model_account_invoice"/>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -14,8 +14,8 @@ msgstr ""
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"X-Launchpad-Export-Date: 2013-07-11 05:17+0000\n"
|
"X-Launchpad-Export-Date: 2013-09-12 05:27+0000\n"
|
||||||
"X-Generator: Launchpad (build 16696)\n"
|
"X-Generator: Launchpad (build 16761)\n"
|
||||||
|
|
||||||
#. module: account
|
#. module: account
|
||||||
#: model:process.transition,name:account.process_transition_supplierreconcilepaid0
|
#: model:process.transition,name:account.process_transition_supplierreconcilepaid0
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -14,8 +14,8 @@ msgstr ""
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"X-Launchpad-Export-Date: 2013-06-30 05:55+0000\n"
|
"X-Launchpad-Export-Date: 2013-09-12 05:35+0000\n"
|
||||||
"X-Generator: Launchpad (build 16692)\n"
|
"X-Generator: Launchpad (build 16761)\n"
|
||||||
|
|
||||||
#. module: account
|
#. module: account
|
||||||
#: model:process.transition,name:account.process_transition_supplierreconcilepaid0
|
#: model:process.transition,name:account.process_transition_supplierreconcilepaid0
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -107,7 +107,9 @@ class res_partner(osv.osv):
|
||||||
_description = 'Partner'
|
_description = 'Partner'
|
||||||
|
|
||||||
def _credit_debit_get(self, cr, uid, ids, field_names, arg, context=None):
|
def _credit_debit_get(self, cr, uid, ids, field_names, arg, context=None):
|
||||||
query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
|
ctx = context.copy()
|
||||||
|
ctx['all_fiscalyear'] = True
|
||||||
|
query = self.pool.get('account.move.line')._query_get(cr, uid, context=ctx)
|
||||||
cr.execute("""SELECT l.partner_id, a.type, SUM(l.debit-l.credit)
|
cr.execute("""SELECT l.partner_id, a.type, SUM(l.debit-l.credit)
|
||||||
FROM account_move_line l
|
FROM account_move_line l
|
||||||
LEFT JOIN account_account a ON (l.account_id=a.id)
|
LEFT JOIN account_account a ON (l.account_id=a.id)
|
||||||
|
|
|
@ -133,7 +133,7 @@
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="account_id"/>
|
<field name="account_id"/>
|
||||||
<field name="journal_id"/>
|
<field name="journal_id"/>
|
||||||
<field name="user_id"/>
|
<field name="user_id" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'account.group_account_invoice']}"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="date"/>
|
<field name="date"/>
|
||||||
|
@ -206,7 +206,7 @@
|
||||||
<filter string="Product" context="{'group_by':'product_id'}"/>
|
<filter string="Product" context="{'group_by':'product_id'}"/>
|
||||||
<filter string="User" context="{'group_by':'user_id'}"/>
|
<filter string="User" context="{'group_by':'user_id'}"/>
|
||||||
<separator/>
|
<separator/>
|
||||||
<filter string="Date" context="{'group_by':'date'}" name="group_date"/>
|
<filter string="Tasks Month" context="{'group_by':'date'}" name="group_date" help="Invoice Tasks by Month"/>
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
</search>
|
</search>
|
||||||
|
|
|
@ -7,16 +7,16 @@
|
||||||
<field name="model">account.analytic.chart</field>
|
<field name="model">account.analytic.chart</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Analytic Account Charts" version="7.0">
|
<form string="Analytic Account Charts" version="7.0">
|
||||||
<header>
|
|
||||||
<button name="analytic_account_chart_open_window" string="Open Charts" type="object" class="oe_highlight"/>
|
|
||||||
or
|
|
||||||
<button string="Cancel" class="oe_link" special="cancel"/>
|
|
||||||
</header>
|
|
||||||
<group string="Select the Period for Analysis" col="4">
|
<group string="Select the Period for Analysis" col="4">
|
||||||
<field name="from_date"/>
|
<field name="from_date"/>
|
||||||
<field name="to_date"/>
|
<field name="to_date"/>
|
||||||
<label string="(Keep empty to open the current situation)" colspan="4"/>
|
<label string="(Keep empty to open the current situation)" colspan="4"/>
|
||||||
</group>
|
</group>
|
||||||
|
<footer>
|
||||||
|
<button name="analytic_account_chart_open_window" string="Open Charts" type="object" class="oe_highlight"/>
|
||||||
|
or
|
||||||
|
<button string="Cancel" class="oe_link" special="cancel"/>
|
||||||
|
</footer>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
|
@ -170,6 +170,7 @@
|
||||||
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
|
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||||
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
|
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||||
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
|
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="terp_default_Centre_7" fontName="Helvetica" fontSize="7.0" leading="9" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||||
<paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
<paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||||
<paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
<paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||||
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
|
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
<filter string="Acc.Type" icon="terp-stock_symbol-selection" context="{'group_by':'user_type'}" name="usertype"/>
|
<filter string="Acc.Type" icon="terp-stock_symbol-selection" context="{'group_by':'user_type'}" name="usertype"/>
|
||||||
<filter string="Int.Type" icon="terp-stock_symbol-selection" context="{'group_by':'type'}"/>
|
<filter string="Int.Type" icon="terp-stock_symbol-selection" context="{'group_by':'type'}"/>
|
||||||
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
|
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
|
||||||
<filter string="Date" icon="terp-go-today" context="{'group_by':'date'}"/>
|
<filter string="Entries Month" icon="terp-go-today" context="{'group_by':'date'}" help="Entries Date by Month"/>
|
||||||
<filter string="Period" icon="terp-go-month" name="group_period" context="{'group_by':'period_id'}"/>
|
<filter string="Period" icon="terp-go-month" name="group_period" context="{'group_by':'period_id'}"/>
|
||||||
<filter string="Fiscal Year" icon="terp-go-year" context="{'group_by':'fiscalyear_id'}"/>
|
<filter string="Fiscal Year" icon="terp-go-year" context="{'group_by':'fiscalyear_id'}"/>
|
||||||
</group>
|
</group>
|
||||||
|
|
|
@ -38,6 +38,7 @@ class report_account_common(report_sxw.rml_parse, common_report_header):
|
||||||
'get_filter': self._get_filter,
|
'get_filter': self._get_filter,
|
||||||
'get_start_date':self._get_start_date,
|
'get_start_date':self._get_start_date,
|
||||||
'get_end_date':self._get_end_date,
|
'get_end_date':self._get_end_date,
|
||||||
|
'get_target_move': self._get_target_move,
|
||||||
})
|
})
|
||||||
self.context = context
|
self.context = context
|
||||||
|
|
||||||
|
|
|
@ -166,11 +166,12 @@
|
||||||
<para style="Standard">
|
<para style="Standard">
|
||||||
<font color="white"> </font>
|
<font color="white"> </font>
|
||||||
</para>
|
</para>
|
||||||
<blockTable colWidths="163.0,163.0,163.0" style="Table2_header">
|
<blockTable colWidths="122.0,122.0,122.0,122.0" style="Table2_header">
|
||||||
<tr>
|
<tr>
|
||||||
<td><para style="terp_tblheader_General_Centre">Chart of Accounts</para></td>
|
<td><para style="terp_tblheader_General_Centre">Chart of Accounts</para></td>
|
||||||
<td><para style="terp_tblheader_General_Centre">Fiscal Year</para></td>
|
<td><para style="terp_tblheader_General_Centre">Fiscal Year</para></td>
|
||||||
<td><para style="terp_tblheader_General_Centre">Filter By [[ get_filter(data)!='No Filters' and get_filter(data) ]]</para></td>
|
<td><para style="terp_tblheader_General_Centre">Filter By [[ get_filter(data)!='No Filters' and get_filter(data) ]]</para></td>
|
||||||
|
<td><para style="terp_tblheader_General_Centre">Target Moves</para></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><para style="terp_default_Centre_8">[[ get_account(data) or removeParentNode('para') ]]</para></td>
|
<td><para style="terp_default_Centre_8">[[ get_account(data) or removeParentNode('para') ]]</para></td>
|
||||||
|
@ -197,6 +198,10 @@
|
||||||
</tr>
|
</tr>
|
||||||
</blockTable>
|
</blockTable>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="terp_default_Centre_8">[[ get_target_move(data) ]]</para>
|
||||||
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</blockTable>
|
</blockTable>
|
||||||
<para style="Standard">
|
<para style="Standard">
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
<filter string="Commercial Partner" name="commercial_partner_id" context="{'group_by':'commercial_partner_id','residual_visible':True}"/>
|
<filter string="Commercial Partner" name="commercial_partner_id" context="{'group_by':'commercial_partner_id','residual_visible':True}"/>
|
||||||
<filter string="Commercial Partner's Country" name="country_id" context="{'group_by':'country_id'}"/>
|
<filter string="Commercial Partner's Country" name="country_id" context="{'group_by':'country_id'}"/>
|
||||||
<filter string="Salesperson" name='user' icon="terp-personal" context="{'group_by':'user_id'}"/>
|
<filter string="Salesperson" name='user' icon="terp-personal" context="{'group_by':'user_id'}"/>
|
||||||
<filter string="Due Date" icon="terp-go-today" context="{'group_by':'date_due'}"/>
|
<filter string="Due Month" icon="terp-go-today" context="{'group_by':'date_due'}"/>
|
||||||
<filter string="Period" icon="terp-go-month" context="{'group_by':'period_id'}" name="period"/>
|
<filter string="Period" icon="terp-go-month" context="{'group_by':'period_id'}" name="period"/>
|
||||||
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id','set_visible':True,'residual_invisible':True}"/>
|
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id','set_visible':True,'residual_invisible':True}"/>
|
||||||
<filter string="Category of Product" name="category_product" icon="terp-stock_symbol-selection" context="{'group_by':'categ_id','residual_invisible':True}"/>
|
<filter string="Category of Product" name="category_product" icon="terp-stock_symbol-selection" context="{'group_by':'categ_id','residual_invisible':True}"/>
|
||||||
|
|
|
@ -295,7 +295,7 @@
|
||||||
</para>
|
</para>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<para style="terp_tblheader_Details"><b>Total:</b></para>
|
<para style="terp_default_9"><b>Total:</b></para>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<para style="terp_default_Bold_Right_9"><b>[[ formatLang(o.amount_total, digits=get_digits(dp='Account'), currency_obj=o.currency_id) ]]</b></para>
|
<para style="terp_default_Bold_Right_9"><b>[[ formatLang(o.amount_total, digits=get_digits(dp='Account'), currency_obj=o.currency_id) ]]</b></para>
|
||||||
|
|
|
@ -22,13 +22,12 @@
|
||||||
import time
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
from operator import itemgetter
|
|
||||||
from os.path import join as opj
|
|
||||||
|
|
||||||
|
import openerp
|
||||||
|
from openerp import SUPERUSER_ID
|
||||||
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as DF
|
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as DF
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
from openerp import tools
|
|
||||||
|
|
||||||
class account_config_settings(osv.osv_memory):
|
class account_config_settings(osv.osv_memory):
|
||||||
_name = 'account.config.settings'
|
_name = 'account.config.settings'
|
||||||
|
@ -81,31 +80,31 @@ class account_config_settings(osv.osv_memory):
|
||||||
'purchase_refund_sequence_next': fields.related('purchase_refund_journal_id', 'sequence_id', 'number_next', type='integer', string='Next supplier credit note number'),
|
'purchase_refund_sequence_next': fields.related('purchase_refund_journal_id', 'sequence_id', 'number_next', type='integer', string='Next supplier credit note number'),
|
||||||
|
|
||||||
'module_account_check_writing': fields.boolean('Pay your suppliers by check',
|
'module_account_check_writing': fields.boolean('Pay your suppliers by check',
|
||||||
help="""This allows you to check writing and printing.
|
help='This allows you to check writing and printing.\n'
|
||||||
This installs the module account_check_writing."""),
|
'-This installs the module account_check_writing.'),
|
||||||
'module_account_accountant': fields.boolean('Full accounting features: journals, legal statements, chart of accounts, etc.',
|
'module_account_accountant': fields.boolean('Full accounting features: journals, legal statements, chart of accounts, etc.',
|
||||||
help="""If you do not check this box, you will be able to do invoicing & payments, but not accounting (Journal Items, Chart of Accounts, ...)"""),
|
help="""If you do not check this box, you will be able to do invoicing & payments, but not accounting (Journal Items, Chart of Accounts, ...)"""),
|
||||||
'module_account_asset': fields.boolean('Assets management',
|
'module_account_asset': fields.boolean('Assets management',
|
||||||
help="""This allows you to manage the assets owned by a company or a person.
|
help='This allows you to manage the assets owned by a company or a person.\n'
|
||||||
It keeps track of the depreciation occurred on those assets, and creates account move for those depreciation lines.
|
'It keeps track of the depreciation occurred on those assets, and creates account move for those depreciation lines.\n'
|
||||||
This installs the module account_asset. If you do not check this box, you will be able to do invoicing & payments,
|
'-This installs the module account_asset. If you do not check this box, you will be able to do invoicing & payments, '
|
||||||
but not accounting (Journal Items, Chart of Accounts, ...)"""),
|
'but not accounting (Journal Items, Chart of Accounts, ...)'),
|
||||||
'module_account_budget': fields.boolean('Budget management',
|
'module_account_budget': fields.boolean('Budget management',
|
||||||
help="""This allows accountants to manage analytic and crossovered budgets.
|
help='This allows accountants to manage analytic and crossovered budgets. '
|
||||||
Once the master budgets and the budgets are defined,
|
'Once the master budgets and the budgets are defined, '
|
||||||
the project managers can set the planned amount on each analytic account.
|
'the project managers can set the planned amount on each analytic account.\n'
|
||||||
This installs the module account_budget."""),
|
'-This installs the module account_budget.'),
|
||||||
'module_account_payment': fields.boolean('Manage payment orders',
|
'module_account_payment': fields.boolean('Manage payment orders',
|
||||||
help="""This allows you to create and manage your payment orders, with purposes to
|
help='This allows you to create and manage your payment orders, with purposes to \n'
|
||||||
* serve as base for an easy plug-in of various automated payment mechanisms, and
|
'* serve as base for an easy plug-in of various automated payment mechanisms, and \n'
|
||||||
* provide a more efficient way to manage invoice payments.
|
'* provide a more efficient way to manage invoice payments.\n'
|
||||||
This installs the module account_payment."""),
|
'-This installs the module account_payment.' ),
|
||||||
'module_account_voucher': fields.boolean('Manage customer payments',
|
'module_account_voucher': fields.boolean('Manage customer payments',
|
||||||
help="""This includes all the basic requirements of voucher entries for bank, cash, sales, purchase, expense, contra, etc.
|
help='This includes all the basic requirements of voucher entries for bank, cash, sales, purchase, expense, contra, etc.\n'
|
||||||
This installs the module account_voucher."""),
|
'-This installs the module account_voucher.'),
|
||||||
'module_account_followup': fields.boolean('Manage customer payment follow-ups',
|
'module_account_followup': fields.boolean('Manage customer payment follow-ups',
|
||||||
help="""This allows to automate letters for unpaid invoices, with multi-level recalls.
|
help='This allows to automate letters for unpaid invoices, with multi-level recalls.\n'
|
||||||
This installs the module account_followup."""),
|
'-This installs the module account_followup.'),
|
||||||
'group_proforma_invoices': fields.boolean('Allow pro-forma invoices',
|
'group_proforma_invoices': fields.boolean('Allow pro-forma invoices',
|
||||||
implied_group='account.group_proforma_invoices',
|
implied_group='account.group_proforma_invoices',
|
||||||
help="Allows you to put invoices in pro-forma state."),
|
help="Allows you to put invoices in pro-forma state."),
|
||||||
|
@ -276,11 +275,13 @@ class account_config_settings(osv.osv_memory):
|
||||||
|
|
||||||
def set_default_taxes(self, cr, uid, ids, context=None):
|
def set_default_taxes(self, cr, uid, ids, context=None):
|
||||||
""" set default sale and purchase taxes for products """
|
""" set default sale and purchase taxes for products """
|
||||||
|
if uid != SUPERUSER_ID and not self.pool['res.users'].has_group(cr, uid, 'base.group_erp_manager'):
|
||||||
|
raise openerp.exceptions.AccessError(_("Only administrators can change the settings"))
|
||||||
ir_values = self.pool.get('ir.values')
|
ir_values = self.pool.get('ir.values')
|
||||||
config = self.browse(cr, uid, ids[0], context)
|
config = self.browse(cr, uid, ids[0], context)
|
||||||
ir_values.set_default(cr, uid, 'product.product', 'taxes_id',
|
ir_values.set_default(cr, SUPERUSER_ID, 'product.product', 'taxes_id',
|
||||||
config.default_sale_tax and [config.default_sale_tax.id] or False, company_id=config.company_id.id)
|
config.default_sale_tax and [config.default_sale_tax.id] or False, company_id=config.company_id.id)
|
||||||
ir_values.set_default(cr, uid, 'product.product', 'supplier_taxes_id',
|
ir_values.set_default(cr, SUPERUSER_ID, 'product.product', 'supplier_taxes_id',
|
||||||
config.default_purchase_tax and [config.default_purchase_tax.id] or False, company_id=config.company_id.id)
|
config.default_purchase_tax and [config.default_purchase_tax.id] or False, company_id=config.company_id.id)
|
||||||
|
|
||||||
def set_chart_of_accounts(self, cr, uid, ids, context=None):
|
def set_chart_of_accounts(self, cr, uid, ids, context=None):
|
||||||
|
|
|
@ -84,7 +84,7 @@ openerp.account.quickadd = function (instance) {
|
||||||
},
|
},
|
||||||
search_by_journal_period: function() {
|
search_by_journal_period: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
var domain = ['|',['debit', '!=', 0], ['credit', '!=', 0]];
|
var domain = [];
|
||||||
if (self.current_journal !== null) domain.push(["journal_id", "=", self.current_journal]);
|
if (self.current_journal !== null) domain.push(["journal_id", "=", self.current_journal]);
|
||||||
if (self.current_period !== null) domain.push(["period_id", "=", self.current_period]);
|
if (self.current_period !== null) domain.push(["period_id", "=", self.current_period]);
|
||||||
self.last_context["journal_id"] = self.current_journal === null ? false : self.current_journal;
|
self.last_context["journal_id"] = self.current_journal === null ? false : self.current_journal;
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
-
|
-
|
||||||
In order to test account invoice I create a new customer invoice
|
In order to test account invoice I create a new customer invoice
|
||||||
-
|
-
|
||||||
I will create bank detail
|
I will create bank detail with using manager access rights because account manager can only create bank details.
|
||||||
|
-
|
||||||
|
!context
|
||||||
|
uid: 'res_users_account_manager'
|
||||||
-
|
-
|
||||||
!record {model: res.partner.bank, id: res_partner_bank_0}:
|
!record {model: res.partner.bank, id: res_partner_bank_0}:
|
||||||
state: bank
|
state: bank
|
||||||
|
@ -11,6 +14,11 @@
|
||||||
footer: True
|
footer: True
|
||||||
bank: base.res_bank_1
|
bank: base.res_bank_1
|
||||||
bank_name: Reserve
|
bank_name: Reserve
|
||||||
|
-
|
||||||
|
Test with that user which have rights to make Invoicing and payment and who is accountant.
|
||||||
|
-
|
||||||
|
!context
|
||||||
|
uid: 'res_users_account_user'
|
||||||
-
|
-
|
||||||
I create a customer invoice
|
I create a customer invoice
|
||||||
-
|
-
|
||||||
|
|
|
@ -4,20 +4,29 @@
|
||||||
!record {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0}:
|
!record {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0}:
|
||||||
code: !eval "'FY%s'% (datetime.now().year+1)"
|
code: !eval "'FY%s'% (datetime.now().year+1)"
|
||||||
company_id: base.main_company
|
company_id: base.main_company
|
||||||
date_start: !eval "'%s-01-01' %(datetime.now().year+1)"
|
date_start: !eval "'%s-01-01' %(datetime.now().year-1)"
|
||||||
date_stop: !eval "'%s-12-31' %(datetime.now().year+1)"
|
date_stop: !eval "'%s-12-31' %(datetime.now().year-1)"
|
||||||
name: !eval "'Fiscal Year %s' %(datetime.now().year+1)"
|
name: !eval "'Fiscal Year %s' %(datetime.now().year-1)"
|
||||||
-
|
-
|
||||||
I create a period for the opening entries for the new fiscalyear
|
I generate periods for the new fiscalyear
|
||||||
-
|
-
|
||||||
!record {model: account.period, id: account_period_jan11}:
|
!python {model: account.fiscalyear}: |
|
||||||
company_id: base.main_company
|
self.create_period(cr, uid, [ref("account_fiscalyear_fiscalyear0")])
|
||||||
date_start: !eval "'%s-01-01'% (datetime.now().year+1)"
|
-
|
||||||
date_stop: !eval "'%s-01-01'% (datetime.now().year+1)"
|
I create a new account invoice in the created fiscalyear
|
||||||
fiscalyear_id: account_fiscalyear_fiscalyear0
|
-
|
||||||
name: !eval "'OP %s' %(datetime.now().year+1)"
|
!record {model: account.invoice, id: account_invoice_current1}:
|
||||||
special: 1
|
partner_id: base.res_partner_2
|
||||||
|
date_invoice: !eval "'%s-01-02' %(datetime.now().year-1)"
|
||||||
|
invoice_line:
|
||||||
|
- partner_id: base.res_partner_2
|
||||||
|
quantity: 1.0
|
||||||
|
price_unit: 15.00
|
||||||
|
name: Bying stuff
|
||||||
|
-
|
||||||
|
I validate the invoice
|
||||||
|
-
|
||||||
|
!workflow {model: account.invoice, action: invoice_open, ref: account.account_invoice_current1}
|
||||||
-
|
-
|
||||||
I made modification in journal so it can move entries
|
I made modification in journal so it can move entries
|
||||||
-
|
-
|
||||||
|
@ -31,19 +40,40 @@
|
||||||
company_id: base.main_company
|
company_id: base.main_company
|
||||||
centralisation: 1
|
centralisation: 1
|
||||||
-
|
-
|
||||||
I called the Generate Fiscalyear Opening Entries wizard
|
I call the Generate Fiscalyear Opening Entries wizard
|
||||||
-
|
-
|
||||||
!record {model: account.fiscalyear.close, id: account_fiscalyear_close_0}:
|
!record {model: account.fiscalyear.close, id: account_fiscalyear_close_0}:
|
||||||
fy2_id: account_fiscalyear_fiscalyear0
|
fy2_id: account.data_fiscalyear
|
||||||
fy_id: account.data_fiscalyear
|
fy_id: account_fiscalyear_fiscalyear0
|
||||||
journal_id: account.close_journal
|
journal_id: account.close_journal
|
||||||
period_id: account_period_jan11
|
period_id: account.period_1
|
||||||
report_name: End of Fiscal Year Entry
|
report_name: End of Fiscal Year Entry
|
||||||
-
|
-
|
||||||
I clicked on create Button
|
I clicked on create Button
|
||||||
|
|
||||||
-
|
-
|
||||||
!python {model: account.fiscalyear.close}: |
|
!python {model: account.fiscalyear.close}: |
|
||||||
self.data_save(cr, uid, [ref("account_fiscalyear_close_0")], {"lang": 'en_US',
|
self.data_save(cr, uid, [ref("account_fiscalyear_close_0")], {"lang": 'en_US',
|
||||||
"active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_fy_close")],
|
"active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_fy_close")],
|
||||||
"tz": False, "active_id": ref("account.menu_wizard_fy_close"), })
|
"tz": False, "active_id": ref("account.menu_wizard_fy_close"), })
|
||||||
|
-
|
||||||
|
I close the previous fiscalyear
|
||||||
|
-
|
||||||
|
!record {model: account.fiscalyear.close.state, id: account_fiscalyear_close_state_0}:
|
||||||
|
fy_id: account_fiscalyear_fiscalyear0
|
||||||
|
-
|
||||||
|
I clicked on Close States Button to close fiscalyear
|
||||||
|
-
|
||||||
|
!python {model: account.fiscalyear.close.state}: |
|
||||||
|
self.data_save(cr, uid, [ref("account_fiscalyear_close_state_0")], {"lang": 'en_US',
|
||||||
|
"active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_fy_close_state")],
|
||||||
|
"tz": False, "active_id": ref("account.menu_wizard_fy_close_state"), })
|
||||||
|
-
|
||||||
|
I check that the fiscalyear state is now "Done"
|
||||||
|
-
|
||||||
|
!assert {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0, string: Fiscal Year is in Done state}:
|
||||||
|
- state == 'done'
|
||||||
|
-
|
||||||
|
I check that the past accounts are taken into account in partner credit
|
||||||
|
-
|
||||||
|
!assert {model: res.partner, id: base.res_partner_2, string: Total Receivable does not takes unreconciled moves of previous years}:
|
||||||
|
- credit == 15.0
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
-
|
|
||||||
I run the Close a Fiscalyear wizard to close the demo fiscalyear
|
|
||||||
-
|
|
||||||
!record {model: account.fiscalyear.close.state, id: account_fiscalyear_close_state_0}:
|
|
||||||
fy_id: data_fiscalyear
|
|
||||||
-
|
|
||||||
I clicked on Close States Button to close fiscalyear
|
|
||||||
|
|
||||||
-
|
|
||||||
!python {model: account.fiscalyear.close.state}: |
|
|
||||||
self.data_save(cr, uid, [ref("account_fiscalyear_close_state_0")], {"lang": 'en_US',
|
|
||||||
"active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_fy_close_state")],
|
|
||||||
"tz": False, "active_id": ref("account.menu_wizard_fy_close_state"), })
|
|
||||||
-
|
|
||||||
I check that the fiscalyear state is now "Done"
|
|
||||||
-
|
|
||||||
!assert {model: account.fiscalyear, id: data_fiscalyear, string: Fiscal Year is in Done state}:
|
|
||||||
- state == 'done'
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
-
|
||||||
|
Test with that user which have rights to make Invoicing.
|
||||||
|
-
|
||||||
|
!context
|
||||||
|
uid: 'res_users_account_user'
|
||||||
-
|
-
|
||||||
In order to test Confirm Draft Invoice wizard I create an invoice and confirm it with this wizard
|
In order to test Confirm Draft Invoice wizard I create an invoice and confirm it with this wizard
|
||||||
-
|
-
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
-
|
||||||
|
Test with that Finance manager who can only create supplier invoice.
|
||||||
|
-
|
||||||
|
!context
|
||||||
|
uid: 'res_users_account_manager'
|
||||||
-
|
-
|
||||||
In order to test account invoice I create a new supplier invoice
|
In order to test account invoice I create a new supplier invoice
|
||||||
-
|
-
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue