diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py
index 67bdee9341e..61e1805b211 100644
--- a/addons/account/__openerp__.py
+++ b/addons/account/__openerp__.py
@@ -98,6 +98,7 @@ module named account_voucher.
'wizard/account_reconcile_view.xml',
'wizard/account_reconcile_partner_process_view.xml',
'wizard/account_automatic_reconcile_view.xml',
+ 'wizard/account_financial_report_view.xml',
'project/wizard/project_account_analytic_line_view.xml',
'account_end_fy.xml',
'account_invoice_view.xml',
diff --git a/addons/account/account.py b/addons/account/account.py
index 39e680fa414..34306b703aa 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -139,7 +139,7 @@ class account_account_type(osv.osv):
'Balance' will generally be used for cash accounts.
'Detail' will copy each existing journal item of the previous year, even the reconciled ones.
'Unreconciled' will copy only the journal items that were unreconciled on the first day of the new fiscal year."""),
- 'sign': fields.selection([(-1, 'Negative'), (1, 'Positive')], 'Sign on Reports', required=True, help='Allows you to change the sign of the balance amount displayed in the reports, so that you can see positive figures instead of negative ones in expenses accounts.'),
+ 'sign': fields.selection([(-1, 'Reverse balance sign'), (1, 'Preserve balance sign')], 'Sign on Reports', required=True, help='For accounts that are typically more debited than credited and that you would like to print as negative amounts in your reports, you should reverse the sign of the balance; e.g.: Expense account. The same applies for accounts that are typically more credited than debited and that you would like to print as positive amounts in your reports; e.g.: Income account.'),
'report_type':fields.selection([
('none','/'),
('income','Profit & Loss (Income Accounts)'),
@@ -250,6 +250,7 @@ class account_account(osv.osv):
#compute for each account the balance/debit/credit from the move lines
accounts = {}
res = {}
+ null_result = dict((fn, 0.0) for fn in field_names)
if children_and_consolidated:
aml_query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
@@ -306,12 +307,11 @@ class account_account(osv.osv):
sums[current.id][fn] += sums[child.id][fn]
else:
sums[current.id][fn] += currency_obj.compute(cr, uid, child.company_id.currency_id.id, current.company_id.currency_id.id, sums[child.id][fn], context=context)
- null_result = dict((fn, 0.0) for fn in field_names)
for id in ids:
res[id] = sums.get(id, null_result)
else:
for id in ids:
- res[id] = 0.0
+ res[id] = null_result
return res
def _get_company_currency(self, cr, uid, ids, field_name, arg, context=None):
@@ -431,9 +431,16 @@ class account_account(osv.osv):
return False
return True
+ def _check_account_type(self, cr, uid, ids, context=None):
+ for account in self.browse(cr, uid, ids, context=context):
+ if account.type in ('receivable', 'payable') and account.user_type.close_method != 'unreconciled':
+ return False
+ return True
+
_constraints = [
(_check_recursion, 'Error ! You can not create recursive accounts.', ['parent_id']),
- (_check_type, 'Configuration Error! \nYou cannot define children to an account with internal type different of "View"! ', ['type']),
+ (_check_type, 'Configuration Error! \nYou can not define children to an account with internal type different of "View"! ', ['type']),
+ (_check_account_type, 'Configuration Error! \nYou can not select an account type with a deferral method different of "Unreconciled" for accounts with internal type "Payable/Receivable"! ', ['user_type','type']),
]
_sql_constraints = [
('code_company_uniq', 'unique (code,company_id)', 'The code of the account must be unique per company !')
@@ -509,14 +516,14 @@ class account_account(osv.osv):
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.'))
+ raise osv.except_osv(_('Error !'), _('You can not desactivate an account that contains some journal items.'))
elif method == 'unlink':
- raise osv.except_osv(_('Error !'), _('You cannot remove an account which has account entries!. '))
+ raise osv.except_osv(_('Error !'), _('You can not remove an account containing journal items!. '))
#Checking whether the account is set as a property to any Partner or not
value = 'account.account,' + str(ids[0])
partner_prop_acc = self.pool.get('ir.property').search(cr, uid, [('value_reference','=',value)], context=context)
if partner_prop_acc:
- raise osv.except_osv(_('Warning !'), _('You cannot remove/deactivate an account which is set as a property to any Partner.'))
+ raise osv.except_osv(_('Warning !'), _('You can not remove/desactivate an account which is set on a customer or supplier.'))
return True
def _check_allow_type_change(self, cr, uid, ids, new_type, context=None):
@@ -529,15 +536,20 @@ class account_account(osv.osv):
if line_obj.search(cr, uid, [('account_id', 'in', account_ids)]):
#Check for 'Closed' type
if old_type == 'closed' and new_type !='closed':
- raise osv.except_osv(_('Warning !'), _("You cannot change the type of account from 'Closed' to any other type which contains account entries!"))
+ raise osv.except_osv(_('Warning !'), _("You cannot change the type of account from 'Closed' to any other type which contains journal items!"))
#Check for change From group1 to group2 and vice versa
if (old_type in group1 and new_type in group2) or (old_type in group2 and new_type in group1):
- raise osv.except_osv(_('Warning !'), _("You cannot change the type of account from '%s' to '%s' type as it contains account entries!") % (old_type,new_type,))
+ raise osv.except_osv(_('Warning !'), _("You cannot change the type of account from '%s' to '%s' type as it contains journal items!") % (old_type,new_type,))
return True
def write(self, cr, uid, ids, vals, context=None):
+
if context is None:
context = {}
+ if not ids:
+ return True
+ if isinstance(ids, (int, long)):
+ ids = [ids]
# Dont allow changing the company_id when account_move_line already exist
if 'company_id' in vals:
@@ -623,7 +635,7 @@ class account_journal(osv.osv):
'currency': fields.many2one('res.currency', 'Currency', help='The currency used to enter statement'),
'entry_posted': fields.boolean('Skip \'Draft\' State for Manual Entries', help='Check this box if you don\'t want new journal entries to pass through the \'draft\' state and instead goes directly to the \'posted state\' without any manual validation. \nNote that journal entries that are automatically created by the system are always skipping that state.'),
'company_id': fields.many2one('res.company', 'Company', required=True, select=1, help="Company related to this journal"),
- 'allow_date':fields.boolean('Check Date not in the Period', help= 'If set to True then do not accept the entry if the entry date is not into the period dates'),
+ 'allow_date':fields.boolean('Check Date in Period', help= 'If set to True then do not accept the entry if the entry date is not into the period dates'),
}
_defaults = {
@@ -650,11 +662,13 @@ class account_journal(osv.osv):
def write(self, cr, uid, ids, vals, context=None):
if context is None:
context = {}
+ if isinstance(ids, (int, long)):
+ ids = [ids]
for journal in self.browse(cr, uid, ids, context=context):
if 'company_id' in vals and journal.company_id.id != vals['company_id']:
move_lines = self.pool.get('account.move.line').search(cr, uid, [('journal_id', 'in', ids)])
if move_lines:
- raise osv.except_osv(_('Warning !'), _('You cannot modify company of this journal as its related record exist in Entry Lines'))
+ raise osv.except_osv(_('Warning !'), _('You can not modify the company of this journal as its related record exist in journal items'))
return super(account_journal, self).write(cr, uid, ids, vals, context=context)
def create_sequence(self, cr, uid, vals, context=None):
@@ -708,8 +722,6 @@ class account_journal(osv.osv):
name = rs.name
if rs.currency:
name = "%s (%s)" % (rs.name, rs.currency.name)
- else:
- name = "%s (%s)" % (rs.name, rs.company_id.currency_id.name)
res += [(rs.id, name)]
return res
@@ -800,8 +812,8 @@ class account_fiscalyear(osv.osv):
return True
_constraints = [
- (_check_duration, 'Error! The duration of the Fiscal Year is invalid. ', ['date_stop']),
- (_check_fiscal_year, 'Error! You cannot define overlapping fiscal years',['date_start', 'date_stop'])
+ (_check_duration, 'Error! The start date of the fiscal year must be before his end date.', ['date_start','date_stop']),
+ (_check_fiscal_year, 'Error! You can not define overlapping fiscal years for the same company.',['date_start', 'date_stop'])
]
def create_period3(self, cr, uid, ids, context=None):
@@ -879,7 +891,10 @@ class account_period(osv.osv):
'state': 'draft',
}
_order = "date_start, special desc"
-
+ _sql_constraints = [
+ ('name_company_uniq', 'unique(name, company_id)', 'The name of the period must be unique per company!'),
+ ]
+
def _check_duration(self,cr,uid,ids,context=None):
obj_period = self.browse(cr, uid, ids[0], context=context)
if obj_period.date_stop < obj_period.date_start:
@@ -915,17 +930,10 @@ class account_period(osv.osv):
return False
def find(self, cr, uid, dt=None, context=None):
- if context is None: context = {}
if not dt:
dt = time.strftime('%Y-%m-%d')
#CHECKME: shouldn't we check the state of the period?
- args = [('date_start', '<=' ,dt), ('date_stop', '>=', dt)]
- if context.get('company_id', False):
- args.append(('company_id', '=', context['company_id']))
- else:
- company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
- args.append(('company_id', '=', company_id))
- ids = self.search(cr, uid, args, context=context)
+ ids = self.search(cr, uid, [('date_start','<=',dt),('date_stop','>=',dt)])
if not ids:
raise osv.except_osv(_('Error !'), _('No period defined for this date: %s !\nPlease create one.')%dt)
return ids
@@ -952,7 +960,7 @@ class account_period(osv.osv):
if 'company_id' in vals:
move_lines = self.pool.get('account.move.line').search(cr, uid, [('period_id', 'in', ids)])
if move_lines:
- raise osv.except_osv(_('Warning !'), _('You cannot modify company of this period as its related record exist in Entry Lines'))
+ raise osv.except_osv(_('Warning !'), _('You can not modify company of this period as some journal items exists.'))
return super(account_period, self).write(cr, uid, ids, vals, context=context)
def build_ctx_periods(self, cr, uid, period_from_id, period_to_id):
@@ -1180,10 +1188,10 @@ class account_move(osv.osv):
_constraints = [
(_check_centralisation,
- 'You cannot create more than one move per period on centralized journal',
+ 'You can not create more than one move per period on centralized journal',
['journal_id']),
(_check_period_journal,
- 'You cannot create entries on different periods/journals in the same move',
+ 'You can not create journal items on different periods/journals in the same journal entry',
['line_id']),
]
@@ -1194,7 +1202,7 @@ class account_move(osv.osv):
valid_moves = self.validate(cr, uid, ids, context)
if not valid_moves:
- raise osv.except_osv(_('Integrity Error !'), _('You cannot validate a non-balanced entry !\nMake sure you have configured Payment Term properly !\nIt should contain atleast one Payment Term Line with type "Balance" !'))
+ raise osv.except_osv(_('Integrity Error !'), _('You can not validate a non-balanced entry !\nMake sure you have configured payment terms properly !\nThe latest payment term line should be of the type "Balance" !'))
obj_sequence = self.pool.get('ir.sequence')
for move in self.browse(cr, uid, valid_moves, context=context):
if move.name =='/':
@@ -1230,7 +1238,7 @@ class account_move(osv.osv):
if not top:
top = account2.id
elif top<>account2.id:
- raise osv.except_osv(_('Error !'), _('You cannot validate a Journal Entry unless all journal items are in same chart of accounts !'))
+ raise osv.except_osv(_('Error !'), _('You can not validate a journal entry unless all journal items belongs to the same chart of accounts !'))
return self.post(cursor, user, ids, context=context)
def button_cancel(self, cr, uid, ids, context=None):
@@ -1248,7 +1256,7 @@ class account_move(osv.osv):
context = {}
c = context.copy()
c['novalidate'] = True
- result = super(osv.osv, self).write(cr, uid, ids, vals, c)
+ result = super(account_move, self).write(cr, uid, ids, vals, c)
self.validate(cr, uid, ids, context=context)
return result
@@ -1317,7 +1325,7 @@ class account_move(osv.osv):
for move in self.browse(cr, uid, ids, context=context):
if move['state'] != 'draft':
raise osv.except_osv(_('UserError'),
- _('You can not delete posted movement: "%s"!') % \
+ _('You can not delete a posted journal entry "%s"!') % \
move['name'])
line_ids = map(lambda x: x.id, move.line_id)
context['journal_id'] = move.journal_id.id
@@ -1337,7 +1345,7 @@ class account_move(osv.osv):
def _centralise(self, cr, uid, move, mode, context=None):
assert mode in ('debit', 'credit'), 'Invalid Mode' #to prevent sql injection
- currency_obj = self.pool.get('res.currency')
+ currency_obj = self.pool.get('res.currency')
if context is None:
context = {}
@@ -1599,7 +1607,7 @@ class account_tax_code(osv.osv):
(parent_ids,) + where_params)
res=dict(cr.fetchall())
obj_precision = self.pool.get('decimal.precision')
- res2 = {}
+ res2 = {}
for record in self.browse(cr, uid, ids, context=context):
def _rec_get(record):
amount = res.get(record.id, 0.0)
@@ -1768,6 +1776,9 @@ class account_tax(osv.osv):
'type_tax_use': fields.selection([('sale','Sale'),('purchase','Purchase'),('all','All')], 'Tax Application', required=True)
}
+ _sql_constraints = [
+ ('name_company_uniq', 'unique(name, company_id)', 'Tax Name must be unique per company!'),
+ ]
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
"""
@@ -2126,7 +2137,11 @@ class account_model(osv.osv):
period_id = period_id[0]
for model in self.browse(cr, uid, ids, context=context):
- entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%Y-%m')}
+ try:
+ entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%Y-%m')}
+ except:
+ raise osv.except_osv(_('Wrong model !'), _('You have a wrong expression "%(...)s" in your model !'))
+
move_id = account_move_obj.create(cr, uid, {
'ref': entry['name'],
'period_id': period_id,
@@ -2198,8 +2213,8 @@ class account_model_line(osv.osv):
}
_order = 'sequence'
_sql_constraints = [
- ('credit_debit1', 'CHECK (credit*debit=0)', 'Wrong credit or debit value in model (Credit Or Debit Must Be "0")!'),
- ('credit_debit2', 'CHECK (credit+debit>=0)', 'Wrong credit or debit value in model (Credit + Debit Must Be greater "0")!'),
+ ('credit_debit1', 'CHECK (credit*debit=0)', 'Wrong credit or debit value in model, they must be positive!'),
+ ('credit_debit2', 'CHECK (credit+debit>=0)', 'Wrong credit or debit value in model, they must be positive!'),
]
account_model_line()
@@ -2365,7 +2380,7 @@ class account_account_template(osv.osv):
_check_recursion = check_cycle
_constraints = [
(_check_recursion, 'Error ! You can not create recursive account templates.', ['parent_id']),
- (_check_type, 'Configuration Error! \nYou cannot define children to an account with internal type different of "View"! ', ['type']),
+ (_check_type, 'Configuration Error!\nYou can not define children to an account with internal type different of "View"! ', ['type']),
]
@@ -2398,7 +2413,7 @@ class account_add_tmpl_wizard(osv.osv_memory):
ptids = tmpl_obj.read(cr, uid, [tids[0]['parent_id'][0]], ['code'])
res = None
if not ptids or not ptids[0]['code']:
- raise osv.except_osv(_('Error !'), _('Cannot locate parent code for template account!'))
+ raise osv.except_osv(_('Error !'), _('I can not locate a parent code for the template account!'))
res = acc_obj.search(cr, uid, [('code','=',ptids[0]['code'])])
return res and res[0] or False
@@ -2613,7 +2628,88 @@ class account_fiscal_position_account_template(osv.osv):
account_fiscal_position_account_template()
- # Multi charts of Accounts wizard
+# ---------------------------------------------------------
+# Account Financial Report
+# ---------------------------------------------------------
+
+class account_financial_report(osv.osv):
+ _name = "account.financial.report"
+ _description = "Account Report"
+
+ def _get_level(self, cr, uid, ids, field_name, arg, context=None):
+ res = {}
+ for report in self.browse(cr, uid, ids, context=context):
+ level = 0
+ if report.parent_id:
+ level = report.parent_id.level + 1
+ res[report.id] = level
+ return res
+
+ def _get_children_by_order(self, cr, uid, ids, context=None):
+ res = []
+ for id in ids:
+ res.append(id)
+ ids2 = self.search(cr, uid, [('parent_id', '=', id)], order='sequence ASC', context=context)
+ res += self._get_children_by_order(cr, uid, ids2, context=context)
+ return res
+
+ def _get_balance(self, cr, uid, ids, name, args, context=None):
+ res = {}
+ res_all = {}
+ for report in self.browse(cr, uid, ids, context=context):
+ balance = 0.0
+ if report.id in res_all:
+ balance = res_all[report.id]
+ elif report.type == 'accounts':
+ # it's the sum of balance of the linked accounts
+ for a in report.account_ids:
+ balance += a.balance
+ elif report.type == 'account_report' and report.account_report_id:
+ # it's the amount of the linked report
+ res2 = self._get_balance(cr, uid, [report.account_report_id.id], 'balance', False, context=context)
+ res_all.update(res2)
+ for key, value in res2.items():
+ balance += value
+ elif report.type == 'sum':
+ # it's the sum of balance of the children of this account.report
+ #for child in report.children_ids:
+ res2 = self._get_balance(cr, uid, [rec.id for rec in report.children_ids], 'balance', False, context=context)
+ res_all.update(res2)
+ for key, value in res2.items():
+ balance += value
+ res[report.id] = balance
+ res_all[report.id] = balance
+ return res
+
+ _columns = {
+ 'name': fields.char('Report Name', size=128, required=True),
+ 'parent_id': fields.many2one('account.financial.report', 'Parent'),
+ 'children_ids': fields.one2many('account.financial.report', 'parent_id', 'Account Report'),
+ 'sequence': fields.integer('Sequence'),
+ 'note': fields.text('Notes'),
+ 'balance': fields.function(_get_balance, 'Balance'),
+ 'level': fields.function(_get_level, string='Level', store=True, type='integer'),
+ 'type': fields.selection([
+ ('sum','View'),
+ ('accounts','Accounts'),
+ ('account_type','Account Type'),
+ ('account_report','Report Value'),
+ ],'Type'),
+ 'account_ids': fields.many2many('account.account', 'account_account_financial_report', 'report_line_id', 'account_id', 'Accounts'),
+ 'display_detail': fields.boolean('Display details', help='Display every account with its balance instead of the sum.'),
+ 'account_report_id': fields.many2one('account.financial.report', 'Report Value'),
+ 'account_type_ids': fields.many2many('account.account.type', 'account_account_financial_report_type', 'report_id', 'account_type_id', 'Account Types'),
+ }
+
+ _defaults = {
+ 'type': 'sum',
+ }
+
+account_financial_report()
+
+# ---------------------------------------------------------
+# Account generation from template wizards
+# ---------------------------------------------------------
class wizard_multi_charts_accounts(osv.osv_memory):
"""
@@ -2706,7 +2802,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
unconfigured_cmp = list(set(company_ids)-set(configured_cmp))
for field in res['fields']:
if field == 'company_id':
- res['fields'][field]['domain'] = unconfigured_cmp
+ res['fields'][field]['domain'] = [('id','in',unconfigured_cmp)]
res['fields'][field]['selection'] = [('', '')]
if unconfigured_cmp:
cmp_select = [(line.id, line.name) for line in self.pool.get('res.company').browse(cr, uid, unconfigured_cmp)]
diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index f712cc9ab0c..4cc2ed89786 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -58,13 +58,6 @@ class account_bank_statement(osv.osv):
journal_id = ids[0]
return journal_id
- def _default_balance_start(self, cr, uid, context=None):
- cr.execute('select id from account_bank_statement where journal_id=%s order by date desc limit 1', (1,))
- res = cr.fetchone()
- if res:
- return self.browse(cr, uid, res[0], context=context).balance_end
- return 0.0
-
def _end_balance(self, cursor, user, ids, name, attr, context=None):
res_currency_obj = self.pool.get('res.currency')
res_users_obj = self.pool.get('res.users')
@@ -90,7 +83,8 @@ class account_bank_statement(osv.osv):
res[statement.id] -= res_currency_obj.compute(cursor,
user, company_currency_id, currency_id,
line.credit, context=context)
- if statement.state == 'draft':
+
+ if statement.state in ('draft', 'open'):
for line in statement.line_ids:
res[statement.id] += line.amount
for r in res:
@@ -123,11 +117,17 @@ class account_bank_statement(osv.osv):
res[statement_id] = (currency_id, currency_names[currency_id])
return res
+ def _get_statement(self, cr, uid, ids, context=None):
+ result = {}
+ for line in self.pool.get('account.bank.statement.line').browse(cr, uid, ids, context=context):
+ result[line.statement_id.id] = True
+ return result.keys()
+
_order = "date desc, id desc"
_name = "account.bank.statement"
_description = "Bank Statement"
_columns = {
- 'name': fields.char('Name', size=64, required=True, help='if you give the Name other then /, its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself', states={'confirm': [('readonly', True)]}),
+ 'name': fields.char('Name', size=64, required=True, states={'draft': [('readonly', False)]}, readonly=True, help='if you give the Name other then /, its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself'), # readonly for account_cash_statement
'date': fields.date('Date', required=True, states={'confirm': [('readonly', True)]}),
'journal_id': fields.many2one('account.journal', 'Journal', required=True,
readonly=True, states={'draft':[('readonly',False)]}),
@@ -136,19 +136,25 @@ class account_bank_statement(osv.osv):
'balance_start': fields.float('Starting Balance', digits_compute=dp.get_precision('Account'),
states={'confirm':[('readonly',True)]}),
'balance_end_real': fields.float('Ending Balance', digits_compute=dp.get_precision('Account'),
- states={'confirm':[('readonly', True)]}),
- 'balance_end': fields.function(_end_balance, string='Balance'),
+ states={'confirm': [('readonly', True)]}),
+ 'balance_end': fields.function(_end_balance,
+ store = {
+ 'account.bank.statement': (lambda self, cr, uid, ids, c={}: ids, ['line_ids','move_line_ids'], 10),
+ 'account.bank.statement.line': (_get_statement, ['amount'], 10),
+ },
+ string="Computed Balance", help='Balance as calculated based on Starting Balance and transaction lines'),
'company_id': fields.related('journal_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
'line_ids': fields.one2many('account.bank.statement.line',
'statement_id', 'Statement lines',
states={'confirm':[('readonly', True)]}),
'move_line_ids': fields.one2many('account.move.line', 'statement_id',
'Entry lines', states={'confirm':[('readonly',True)]}),
- 'state': fields.selection([('draft', 'Draft'),('confirm', 'Confirmed')],
- 'State', required=True,
- states={'confirm': [('readonly', True)]}, readonly="1",
- help='When new statement is created the state will be \'Draft\'. \
- \n* And after getting confirmation from the bank it will be in \'Confirmed\' state.'),
+ 'state': fields.selection([('draft', 'New'),
+ ('open','Open'), # used by cash statements
+ ('confirm', 'Closed')],
+ 'State', required=True, readonly="1",
+ help='When new statement is created the state will be \'Draft\'.\n'
+ 'And after getting confirmation from the bank it will be in \'Confirmed\' state.'),
'currency': fields.function(_currency, string='Currency',
type='many2one', relation='res.currency'),
'account_id': fields.related('journal_id', 'default_debit_account_id', type='many2one', relation='account.account', string='Account used in this journal', readonly=True, help='used in statement reconciliation domain, but shouldn\'t be used elswhere.'),
@@ -158,7 +164,6 @@ class account_bank_statement(osv.osv):
'name': "/",
'date': lambda *a: time.strftime('%Y-%m-%d'),
'state': 'draft',
- 'balance_start': _default_balance_start,
'journal_id': _default_journal_id,
'period_id': _get_period,
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.bank.statement',context=c),
@@ -311,7 +316,7 @@ class account_bank_statement(osv.osv):
return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
def check_status_condition(self, cr, uid, state, journal_type='bank'):
- return state=='draft'
+ return state in ('draft','open')
def button_confirm_bank(self, cr, uid, ids, context=None):
obj_seq = self.pool.get('ir.sequence')
@@ -386,7 +391,7 @@ class account_bank_statement(osv.osv):
if t['state'] in ('draft'):
unlink_ids.append(t['id'])
else:
- raise osv.except_osv(_('Invalid action !'), _('Cannot delete bank statement(s) which are already confirmed !'))
+ raise osv.except_osv(_('Invalid action !'), _('In order to delete a bank statement, you must first cancel it to delete related journal items.'))
osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
return True
@@ -470,7 +475,7 @@ class account_bank_statement_line(osv.osv):
}
_defaults = {
'name': lambda self,cr,uid,context={}: self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement.line'),
- 'date': lambda *a: time.strftime('%Y-%m-%d'),
+ 'date': lambda self,cr,uid,context={}: context.get('date', time.strftime('%Y-%m-%d')),
'type': 'general',
}
diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py
index 982383ea2a7..dc78d19bab4 100644
--- a/addons/account/account_cash_statement.py
+++ b/addons/account/account_cash_statement.py
@@ -119,39 +119,6 @@ class account_cash_statement(osv.osv):
res2[statement.id] = encoding_total
return res2
- def _end_balance(self, cursor, user, ids, name, attr, context=None):
- res_currency_obj = self.pool.get('res.currency')
- res_users_obj = self.pool.get('res.users')
- res = {}
-
- company_currency_id = res_users_obj.browse(cursor, user, user,
- context=context).company_id.currency_id.id
-
- statements = self.browse(cursor, user, ids, context=context)
- for statement in statements:
- res[statement.id] = statement.balance_start
- currency_id = statement.currency.id
- for line in statement.move_line_ids:
- if line.debit > 0:
- if line.account_id.id == \
- statement.journal_id.default_debit_account_id.id:
- res[statement.id] += res_currency_obj.compute(cursor,
- user, company_currency_id, currency_id,
- line.debit, context=context)
- else:
- if line.account_id.id == \
- statement.journal_id.default_credit_account_id.id:
- res[statement.id] -= res_currency_obj.compute(cursor,
- user, company_currency_id, currency_id,
- line.credit, context=context)
-
- if statement.state in ('draft', 'open'):
- for line in statement.line_ids:
- res[statement.id] += line.amount
- for r in res:
- res[r] = round(res[r], 2)
- return res
-
def _get_company(self, cr, uid, context=None):
user_pool = self.pool.get('res.users')
company_pool = self.pool.get('res.company')
@@ -217,38 +184,33 @@ class account_cash_statement(osv.osv):
res['end'] = end_l
return res
+ def _get_statement(self, cr, uid, ids, context=None):
+ result = {}
+ for line in self.pool.get('account.bank.statement.line').browse(cr, uid, ids, context=context):
+ result[line.statement_id.id] = True
+ return result.keys()
+
_columns = {
- 'balance_end_real': fields.float('Closing Balance', digits_compute=dp.get_precision('Account'), states={'confirm': [('readonly', True)]}, help="closing balance entered by the cashbox verifier"),
- 'state': fields.selection(
- [('draft', 'Draft'),
- ('confirm', 'Closed'),
- ('open','Open')], 'State', required=True, states={'confirm': [('readonly', True)]}, readonly="1"),
- 'total_entry_encoding': fields.function(_get_sum_entry_encoding, store=True, string="Cash Transaction", help="Total cash transactions"),
+ 'total_entry_encoding': fields.function(_get_sum_entry_encoding, string="Cash Transaction", help="Total cash transactions",
+ store = {
+ 'account.bank.statement': (lambda self, cr, uid, ids, c={}: ids, ['line_ids','move_line_ids'], 10),
+ 'account.bank.statement.line': (_get_statement, ['amount'], 10),
+ }),
'closing_date': fields.datetime("Closed On"),
- 'balance_end': fields.function(_end_balance, store=True, string='Balance', help="Closing balance based on Starting Balance and Cash Transactions"),
- 'balance_end_cash': fields.function(_balance_end_cash, store=True, string='Balance', help="Closing balance based on cashBox"),
+ 'balance_end_cash': fields.function(_balance_end_cash, store=True, string='Closing Balance', help="Closing balance based on cashBox"),
'starting_details_ids': fields.one2many('account.cashbox.line', 'starting_id', string='Opening Cashbox'),
'ending_details_ids': fields.one2many('account.cashbox.line', 'ending_id', string='Closing Cashbox'),
- 'name': fields.char('Name', size=64, required=True, states={'draft': [('readonly', False)]}, readonly=True, help='if you give the Name other then /, its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself'),
'user_id': fields.many2one('res.users', 'Responsible', required=False),
}
_defaults = {
'state': 'draft',
- 'date': lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
+ 'date': lambda self,cr,uid,context={}: context.get('date', time.strftime("%Y-%m-%d %H:%M:%S")),
'user_id': lambda self, cr, uid, context=None: uid,
'starting_details_ids': _get_cash_open_box_lines,
'ending_details_ids': _get_default_cash_close_box_lines
}
def create(self, cr, uid, vals, context=None):
- sql = [
- ('journal_id', '=', vals.get('journal_id', False)),
- ('state', '=', 'open')
- ]
- open_jrnl = self.search(cr, uid, sql)
- if open_jrnl:
- raise osv.except_osv(_('Error'), _('You can not have two open register for the same journal'))
-
if self.pool.get('account.journal').browse(cr, uid, vals['journal_id'], context=context).type == 'cash':
open_close = self._get_cash_open_close_box_lines(cr, uid, context)
if vals.get('starting_details_ids', False):
@@ -340,7 +302,6 @@ class account_cash_statement(osv.osv):
})
vals.update({
- 'date': time.strftime("%Y-%m-%d %H:%M:%S"),
'state': 'open',
})
self.write(cr, uid, [statement.id], vals, context=context)
@@ -350,7 +311,7 @@ class account_cash_statement(osv.osv):
if journal_type == 'bank':
return super(account_cash_statement, self).balance_check(cr, uid, cash_id, journal_type, context)
if not self._equal_balance(cr, uid, cash_id, context):
- raise osv.except_osv(_('Error !'), _('CashBox Balance is not matching with Calculated Balance !'))
+ raise osv.except_osv(_('Error !'), _('The closing balance should be the same than the computed balance !'))
return True
def statement_close(self, cr, uid, ids, journal_type='bank', context=None):
diff --git a/addons/account/account_installer.xml b/addons/account/account_installer.xml
index 151f7bbc0f0..361a371fb97 100644
--- a/addons/account/account_installer.xml
+++ b/addons/account/account_installer.xml
@@ -23,7 +23,7 @@
23
-
+
@@ -85,5 +85,58 @@
automatic
+
+ Define your Bank Account
+ ir.actions.act_window
+ res.partner.bank
+ form
+ form
+
+
+
+
+
+
+
+
+ Review your Financial Accounts
+ ir.actions.act_window
+ account.account
+ form
+ tree,form
+
+
+
+
+
+
+
+
+
+ Review your Financial Journal
+ ir.actions.act_window
+ account.journal
+ form
+ tree,form
+
+
+
+
+
+
+
+
+ Review your Payment Terms
+ ir.actions.act_window
+ account.payment.term
+ form
+ tree,form
+
+
+
+
+
+
+
diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml
index 545bfd41f10..11ec7d8360a 100644
--- a/addons/account/account_invoice_view.xml
+++ b/addons/account/account_invoice_view.xml
@@ -205,7 +205,7 @@
-
+
@@ -234,7 +234,6 @@
-
@@ -294,13 +293,13 @@
-
+
-
+
@@ -333,7 +332,6 @@
-
@@ -355,7 +353,7 @@
search
-
+
@@ -364,16 +362,16 @@
-
-
+
+
-
-
-
+
+
+
diff --git a/addons/account/account_menuitem.xml b/addons/account/account_menuitem.xml
index 062e1f6382b..89538603ae7 100644
--- a/addons/account/account_menuitem.xml
+++ b/addons/account/account_menuitem.xml
@@ -30,6 +30,7 @@
+
diff --git a/addons/account/report/account_tax_code.rml b/addons/account/report/account_tax_code.rml
index 7489ac72a39..10a7c76a821 100644
--- a/addons/account/report/account_tax_code.rml
+++ b/addons/account/report/account_tax_code.rml
@@ -129,10 +129,10 @@
[[ line['name'] ]]
@@ -141,4 +141,4 @@
-
\ No newline at end of file
+
diff --git a/addons/account/report/account_tax_report.rml b/addons/account/report/account_tax_report.rml
index de4aa415fef..f489ee1143e 100644
--- a/addons/account/report/account_tax_report.rml
+++ b/addons/account/report/account_tax_report.rml
@@ -153,7 +153,7 @@
[[ repeatIn(get_lines(data['form']['based_on'], data['form']['company_id']), 'o') ]][[ (o['level']) ]] [[ (len(o['level'])<5 and setTag('para','para',{'fontName':'Helvetica-Bold'})) or removeParentNode('font') ]][[ o['code'] ]] [[ o['name'] ]]
[[ len(o['level'])<5 and setTag('para','para',{'fontName':"Helvetica-Bold"}) or removeParentNode('font')]][[ o['type']=='view' and removeParentNode('font') ]][[ formatLang(o['debit']) ]][[ o['type']<>'view' and removeParentNode('font') ]][[ formatLang(o['debit']) ]]
[[ len(o['level'])<5 and setTag('para','para',{'fontName':"Helvetica-Bold"}) or removeParentNode('font')]][[ o['type']=='view' and removeParentNode('font') ]][[ formatLang(o['credit']) ]][[ o['type']<>'view' and removeParentNode('font') ]][[ formatLang(o['credit'])]]
-
[[ len(o['level'])<5 and setTag('para','para',{'fontName':"Helvetica-Bold"}) or removeParentNode('font')]][[ o['type']=='view' and removeParentNode('font') ]][[ formatLang(o['tax_amount']) ]] [[ company.currency_id.symbol ]][[ o['type']<>'view' and removeParentNode('font') ]][[ formatLang(o['tax_amount']) ]] [[ company.currency_id.symbol ]]
+
[[ len(o['level'])<5 and setTag('para','para',{'fontName':"Helvetica-Bold"}) or removeParentNode('font')]][[ o['type']=='view' and removeParentNode('font') ]][[ formatLang(o['tax_amount'], currency_obj=company.currency_id) ]][[ o['type']<>'view' and removeParentNode('font') ]][[ formatLang(o['tax_amount'], currency_obj=company.currency_id) ]]
diff --git a/addons/account/report/common_report_header.py b/addons/account/report/common_report_header.py
index 48e26e839d3..5769248405f 100644
--- a/addons/account/report/common_report_header.py
+++ b/addons/account/report/common_report_header.py
@@ -94,10 +94,10 @@ class common_report_header(object):
def _get_filter(self, data):
if data.get('form', False) and data['form'].get('filter', False):
if data['form']['filter'] == 'filter_date':
- return _('Date')
+ return 'Date'
elif data['form']['filter'] == 'filter_period':
- return _('Periods')
- return _('No Filter')
+ return 'Periods'
+ return 'No Filter'
def _sum_debit_period(self, period_id, journal_id=None):
journals = journal_id or self.journal_ids
diff --git a/addons/account/security/ir.model.access.csv b/addons/account/security/ir.model.access.csv
index cd945a2248d..79e4dbb0c03 100644
--- a/addons/account/security/ir.model.access.csv
+++ b/addons/account/security/ir.model.access.csv
@@ -67,6 +67,7 @@
"access_account_fiscalyear_employee","account.fiscalyear employee","model_account_fiscalyear","base.group_user",1,0,0,0
"access_res_currency_account_manager","res.currency account manager","base.model_res_currency","group_account_manager",1,1,1,1
"access_res_currency_rate_account_manager","res.currency.rate account manager","base.model_res_currency_rate","group_account_manager",1,1,1,1
+"access_res_currency_rate_type_account_manager","res.currency.rate.type account manager","base.model_res_currency_rate_type","group_account_manager",1,1,1,1
"access_account_invoice_user","account.invoice user","model_account_invoice","base.group_user",1,0,0,0
"access_account_invoice_user","account.invoice.line user","model_account_invoice_line","base.group_user",1,0,0,0
"access_account_payment_term_partner_manager","account.payment.term partner manager","model_account_payment_term","base.group_user",1,0,0,0
@@ -127,4 +128,7 @@
"access_account_sequence_fiscal_year_sale_user","account.sequence.fiscalyear.sale.user","model_account_sequence_fiscalyear","base.group_sale_salesman",1,1,1,0
"access_account_sequence_fiscal_year_sale_manager","account.sequence.fiscalyear.sale.manager","model_account_sequence_fiscalyear","base.group_sale_manager",1,1,1,1
"access_account_treasury_report_manager","account.treasury.report.manager","model_account_treasury_report","account.group_account_manager",1,0,0,0
+"access_account_financial_report","account.financial.report","model_account_financial_report","account.group_account_user",1,1,1,1
+"access_account_financial_report_invoice","account.financial.report invoice","model_account_financial_report","account.group_account_invoice",1,0,0,0
+"access_account_financial_report_manager","account.financial.report","model_account_financial_report","account.group_account_manager",1,1,1,1
diff --git a/addons/account/test/account_report.yml b/addons/account/test/account_report.yml
index d5bb6bada65..40ba7ea7127 100644
--- a/addons/account/test/account_report.yml
+++ b/addons/account/test/account_report.yml
@@ -147,7 +147,7 @@
!python {model: account.account}: |
ctx={}
ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
- data_dict = {'chart_account_id':ref('account.chart0'),'display_type': False}
+ data_dict = {'chart_account_id':ref('account.chart0'),'display_type': False,'target_move': 'all'}
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_pl_report',wiz_data=data_dict, context=ctx, our_module='account')
-
@@ -156,7 +156,7 @@
!python {model: account.account}: |
ctx={}
ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
- data_dict = {'chart_account_id':ref('account.chart0'),'display_type': True}
+ data_dict = {'chart_account_id':ref('account.chart0'),'display_type': True,'target_move': 'all'}
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_pl_report',wiz_data=data_dict, context=ctx, our_module='account')
-
diff --git a/addons/account/wizard/__init__.py b/addons/account/wizard/__init__.py
index 0d888f8e712..88ae17f3c7b 100644
--- a/addons/account/wizard/__init__.py
+++ b/addons/account/wizard/__init__.py
@@ -47,6 +47,7 @@ import account_open_closed_fiscalyear
import account_invoice_state
import account_chart
import account_tax_chart
+import account_financial_report
#TODO: remove this file no moe used
# also remove related view fiel
diff --git a/addons/account/wizard/account_financial_report.py b/addons/account/wizard/account_financial_report.py
new file mode 100644
index 00000000000..de9cae3a00c
--- /dev/null
+++ b/addons/account/wizard/account_financial_report.py
@@ -0,0 +1,86 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from osv import fields, osv
+
+class accounting_report(osv.osv_memory):
+ _name = "accounting.report"
+ _inherit = "account.common.report"
+ _description = "Accounting Report"
+
+ _columns = {
+ 'enable_filter': fields.boolean('Enable Comparison'),
+ 'account_report_id': fields.many2one('account.financial.report', 'Account Reports', required=True),
+ 'label_filter': fields.char('Column Label', size=32, help="This label will be displayed on report to show the balance computed for the given comparison filter."),
+ 'fiscalyear_id_cmp': fields.many2one('account.fiscalyear', 'Fiscal Year', help='Keep empty for all open fiscal year'),
+ 'filter_cmp': fields.selection([('filter_no', 'No Filters'), ('filter_date', 'Date'), ('filter_period', 'Periods')], "Filter by", required=True),
+ 'period_from_cmp': fields.many2one('account.period', 'Start Period'),
+ 'period_to_cmp': fields.many2one('account.period', 'End Period'),
+ 'date_from_cmp': fields.date("Start Date"),
+ 'date_to_cmp': fields.date("End Date"),
+ }
+
+ _defaults = {
+ 'filter_cmp': 'filter_no',
+ 'target_move': 'posted',
+ }
+
+ def _build_comparison_context(self, cr, uid, ids, data, context=None):
+ if context is None:
+ context = {}
+ result = {}
+ result['fiscalyear'] = 'fiscalyear_id_cmp' in data['form'] and data['form']['fiscalyear_id_cmp'] or False
+ result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False
+ result['chart_account_id'] = 'chart_account_id' in data['form'] and data['form']['chart_account_id'] or False
+ if data['form']['filter_cmp'] == 'filter_date':
+ result['date_from'] = data['form']['date_from_cmp']
+ result['date_to'] = data['form']['date_to_cmp']
+ elif data['form']['filter_cmp'] == 'filter_period':
+ if not data['form']['period_from_cmp'] or not data['form']['period_to_cmp']:
+ raise osv.except_osv(_('Error'),_('Select a starting and an ending period'))
+ result['period_from'] = data['form']['period_from_cmp']
+ result['period_to'] = data['form']['period_to_cmp']
+ return result
+
+ def check_report(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
+ res = super(accounting_report, self).check_report(cr, uid, ids, context=context)
+ data = {}
+ data['form'] = self.read(cr, uid, ids, ['account_report_id', 'date_from_cmp', 'date_to_cmp', 'fiscalyear_id_cmp', 'journal_ids', 'period_from_cmp', 'period_to_cmp', 'filter_cmp', 'chart_account_id', 'target_move'], context=context)[0]
+ for field in ['fiscalyear_id_cmp', 'chart_account_id', 'period_from_cmp', 'period_to_cmp', 'account_report_id']:
+ if isinstance(data['form'][field], tuple):
+ data['form'][field] = data['form'][field][0]
+ comparison_context = self._build_comparison_context(cr, uid, ids, data, context=context)
+ res['datas']['form']['comparison_context'] = comparison_context
+ return res
+
+ def _print_report(self, cr, uid, ids, data, context=None):
+ data['form'].update(self.read(cr, uid, ids, ['date_from_cmp', 'date_to_cmp', 'fiscalyear_id_cmp', 'period_from_cmp', 'period_to_cmp', 'filter_cmp', 'account_report_id', 'enable_filter', 'label_filter'], context=context)[0])
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'account.financial.report',
+ 'datas': data,
+ }
+
+accounting_report()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/wizard/account_financial_report_view.xml b/addons/account/wizard/account_financial_report_view.xml
new file mode 100644
index 00000000000..1472da4ba87
--- /dev/null
+++ b/addons/account/wizard/account_financial_report_view.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+ Accounting Report
+ accounting.report
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Financial Reports
+ accounting.report
+ ir.actions.act_window
+ form
+ form
+
+ new
+
+
+
+
+
+
diff --git a/addons/account/wizard/account_fiscalyear_close.py b/addons/account/wizard/account_fiscalyear_close.py
index 927f895bb3b..297911f15f7 100644
--- a/addons/account/wizard/account_fiscalyear_close.py
+++ b/addons/account/wizard/account_fiscalyear_close.py
@@ -52,9 +52,11 @@ class account_fiscalyear_close(osv.osv_memory):
obj_acc_period = self.pool.get('account.period')
obj_acc_fiscalyear = self.pool.get('account.fiscalyear')
obj_acc_journal = self.pool.get('account.journal')
+ obj_acc_move = self.pool.get('account.move')
obj_acc_move_line = self.pool.get('account.move.line')
obj_acc_account = self.pool.get('account.account')
obj_acc_journal_period = self.pool.get('account.journal.period')
+ currency_obj = self.pool.get('res.currency')
data = self.browse(cr, uid, ids, context=context)
@@ -81,150 +83,178 @@ class account_fiscalyear_close(osv.osv_memory):
raise osv.except_osv(_('UserError'),
_('The journal must have centralised counterpart without the Skipping draft state option checked!'))
- move_ids = obj_acc_move_line.search(cr, uid, [
- ('journal_id', '=', new_journal.id), ('period_id.fiscalyear_id', '=', new_fyear.id)])
-
+ #delete existing move and move lines if any
+ move_ids = obj_acc_move.search(cr, uid, [
+ ('journal_id', '=', new_journal.id), ('period_id', '=', period.id)])
if move_ids:
- obj_acc_move_line._remove_move_reconcile(cr, uid, move_ids, context=context)
- obj_acc_move_line.unlink(cr, uid, move_ids, context=context)
+ move_line_ids = obj_acc_move_line.search(cr, uid, [('move_id', 'in', move_ids)])
+ obj_acc_move_line._remove_move_reconcile(cr, uid, move_line_ids, context=context)
+ obj_acc_move_line.unlink(cr, uid, move_line_ids, context=context)
+ obj_acc_move.unlink(cr, uid, move_ids, context=context)
cr.execute("SELECT id FROM account_fiscalyear WHERE date_stop < %s", (str(new_fyear.date_start),))
result = cr.dictfetchall()
fy_ids = ','.join([str(x['id']) for x in result])
query_line = obj_acc_move_line._query_get(cr, uid,
obj='account_move_line', context={'fiscalyear': fy_ids})
- cr.execute('select id from account_account WHERE active AND company_id = %s', (old_fyear.company_id.id,))
- ids = map(lambda x: x[0], cr.fetchall())
- for account in obj_acc_account.browse(cr, uid, ids,
- context={'fiscalyear': fy_id}):
- accnt_type_data = account.user_type
- if not accnt_type_data:
- continue
- if accnt_type_data.close_method=='none' or account.type == 'view':
- continue
- if accnt_type_data.close_method=='balance':
- balance_in_currency = 0.0
- if account.currency_id:
- cr.execute('SELECT sum(amount_currency) as balance_in_currency FROM account_move_line ' \
- 'WHERE account_id = %s ' \
- 'AND ' + query_line + ' ' \
- 'AND currency_id = %s', (account.id, account.currency_id.id))
- balance_in_currency = cr.dictfetchone()['balance_in_currency']
+ #create the opening move
+ vals = {
+ 'name': '/',
+ 'ref': '',
+ 'period_id': period.id,
+ 'journal_id': new_journal.id,
+ }
+ move_id = obj_acc_move.create(cr, uid, vals, context=context)
- if abs(account.balance)>0.0001:
- obj_acc_move_line.create(cr, uid, {
- 'debit': account.balance>0 and account.balance,
- 'credit': account.balance<0 and -account.balance,
- 'name': data[0].report_name,
- 'date': period.date_start,
- 'journal_id': new_journal.id,
- 'period_id': period.id,
- 'account_id': account.id,
- 'currency_id': account.currency_id and account.currency_id.id or False,
- 'amount_currency': balance_in_currency,
- }, {'journal_id': new_journal.id, 'period_id':period.id})
- if accnt_type_data.close_method == 'unreconciled':
- offset = 0
- limit = 100
- while True:
- cr.execute('SELECT id, name, quantity, debit, credit, account_id, ref, ' \
- 'amount_currency, currency_id, blocked, partner_id, ' \
- 'date_maturity, date_created ' \
- 'FROM account_move_line ' \
- 'WHERE account_id = %s ' \
- 'AND ' + query_line + ' ' \
- 'AND reconcile_id is NULL ' \
- 'ORDER BY id ' \
- 'LIMIT %s OFFSET %s', (account.id, limit, offset))
- result = cr.dictfetchall()
- if not result:
- break
- for move in result:
- move.pop('id')
- move.update({
- 'date': period.date_start,
- 'journal_id': new_journal.id,
- 'period_id': period.id,
- })
- obj_acc_move_line.create(cr, uid, move, {
- 'journal_id': new_journal.id,
- 'period_id': period.id,
- })
- offset += limit
+ #1. report of the accounts with defferal method == 'unreconciled'
+ cr.execute('''
+ SELECT a.id
+ FROM account_account a
+ LEFT JOIN account_account_type t ON (a.user_type = t.id)
+ WHERE a.active
+ AND a.type != 'view'
+ AND t.close_method = %s''', ('unreconciled', ))
+ account_ids = map(lambda x: x[0], cr.fetchall())
- #We have also to consider all move_lines that were reconciled
- #on another fiscal year, and report them too
- offset = 0
- limit = 100
- while True:
- cr.execute('SELECT DISTINCT b.id, b.name, b.quantity, b.debit, b.credit, b.account_id, b.ref, ' \
- 'b.amount_currency, b.currency_id, b.blocked, b.partner_id, ' \
- 'b.date_maturity, b.date_created ' \
- 'FROM account_move_line a, account_move_line b ' \
- 'WHERE b.account_id = %s ' \
- 'AND b.reconcile_id is NOT NULL ' \
- 'AND a.reconcile_id = b.reconcile_id ' \
- 'AND b.period_id IN ('+fy_period_set+') ' \
- 'AND a.period_id IN ('+fy2_period_set+') ' \
- 'ORDER BY id ' \
- 'LIMIT %s OFFSET %s', (account.id, limit, offset))
- result = cr.dictfetchall()
- if not result:
- break
- for move in result:
- move.pop('id')
- move.update({
- 'date': period.date_start,
- 'journal_id': new_journal.id,
- 'period_id': period.id,
- })
- obj_acc_move_line.create(cr, uid, move, {
- 'journal_id': new_journal.id,
- 'period_id': period.id,
- })
- offset += limit
- if accnt_type_data.close_method=='detail':
- offset = 0
- limit = 100
- while True:
- cr.execute('SELECT id, name, quantity, debit, credit, account_id, ref, ' \
- 'amount_currency, currency_id, blocked, partner_id, ' \
- 'date_maturity, date_created ' \
- 'FROM account_move_line ' \
- 'WHERE account_id = %s ' \
- 'AND ' + query_line + ' ' \
- 'ORDER BY id ' \
- 'LIMIT %s OFFSET %s', (account.id, limit, offset))
+ if account_ids:
+ cr.execute('''
+ INSERT INTO account_move_line (
+ name, create_uid, create_date, write_uid, write_date,
+ statement_id, journal_id, currency_id, date_maturity,
+ partner_id, blocked, credit, state, debit,
+ ref, account_id, period_id, date, move_id, amount_currency,
+ quantity, product_id, company_id)
+ (SELECT name, create_uid, create_date, write_uid, write_date,
+ statement_id, %s,currency_id, date_maturity, partner_id,
+ blocked, credit, 'draft', debit, ref, account_id,
+ %s, date, %s, amount_currency, quantity, product_id, company_id
+ FROM account_move_line
+ WHERE account_id IN %s
+ AND ''' + query_line + '''
+ AND reconcile_id IS NULL)''', (new_journal.id, period.id, move_id, tuple(account_ids),))
- result = cr.dictfetchall()
- if not result:
- break
- for move in result:
- move.pop('id')
- move.update({
- 'date': period.date_start,
- 'journal_id': new_journal.id,
- 'period_id': period.id,
- })
- obj_acc_move_line.create(cr, uid, move)
- offset += limit
- ids = obj_acc_move_line.search(cr, uid, [('journal_id','=',new_journal.id),
+ #We have also to consider all move_lines that were reconciled
+ #on another fiscal year, and report them too
+ cr.execute('''
+ INSERT INTO account_move_line (
+ name, create_uid, create_date, write_uid, write_date,
+ statement_id, journal_id, currency_id, date_maturity,
+ partner_id, blocked, credit, state, debit,
+ ref, account_id, period_id, date, move_id, amount_currency,
+ quantity, product_id, company_id)
+ (SELECT
+ b.name, b.create_uid, b.create_date, b.write_uid, b.write_date,
+ b.statement_id, %s, b.currency_id, b.date_maturity,
+ b.partner_id, b.blocked, b.credit, 'draft', b.debit,
+ b.ref, b.account_id, %s, b.date, %s, b.amount_currency,
+ b.quantity, b.product_id, b.company_id
+ FROM account_move_line b
+ WHERE b.account_id IN %s
+ AND b.reconcile_id IS NOT NULL
+ AND b.period_id IN ('''+fy_period_set+''')
+ AND b.reconcile_id IN (SELECT DISTINCT(reconcile_id)
+ FROM account_move_line a
+ WHERE a.period_id IN ('''+fy2_period_set+''')))''', (new_journal.id, period.id, move_id, tuple(account_ids),))
+
+ #2. report of the accounts with defferal method == 'detail'
+ cr.execute('''
+ SELECT a.id
+ FROM account_account a
+ LEFT JOIN account_account_type t ON (a.user_type = t.id)
+ WHERE a.active
+ AND a.type != 'view'
+ AND t.close_method = %s''', ('detail', ))
+ account_ids = map(lambda x: x[0], cr.fetchall())
+
+ if account_ids:
+ cr.execute('''
+ INSERT INTO account_move_line (
+ name, create_uid, create_date, write_uid, write_date,
+ statement_id, journal_id, currency_id, date_maturity,
+ partner_id, blocked, credit, state, debit,
+ ref, account_id, period_id, date, move_id, amount_currency,
+ quantity, product_id, company_id)
+ (SELECT name, create_uid, create_date, write_uid, write_date,
+ statement_id, %s,currency_id, date_maturity, partner_id,
+ blocked, credit, 'draft', debit, ref, account_id,
+ %s, date, %s, amount_currency, quantity, product_id, company_id
+ FROM account_move_line
+ WHERE account_id IN %s
+ AND ''' + query_line + ''')
+ ''', (new_journal.id, period.id, move_id, tuple(account_ids),))
+
+
+ #3. report of the accounts with defferal method == 'balance'
+ cr.execute('''
+ SELECT a.id
+ FROM account_account a
+ LEFT JOIN account_account_type t ON (a.user_type = t.id)
+ WHERE a.active
+ AND a.type != 'view'
+ AND t.close_method = %s''', ('balance', ))
+ account_ids = map(lambda x: x[0], cr.fetchall())
+
+ query_1st_part = """
+ INSERT INTO account_move_line (
+ debit, credit, name, date, move_id, journal_id, period_id,
+ account_id, currency_id, amount_currency, company_id, state) VALUES
+ """
+ query_2nd_part = ""
+ query_2nd_part_args = []
+ for account in obj_acc_account.browse(cr, uid, account_ids, context={'fiscalyear': fy_id}):
+ balance_in_currency = 0.0
+ if account.currency_id:
+ cr.execute('SELECT sum(amount_currency) as balance_in_currency FROM account_move_line ' \
+ 'WHERE account_id = %s ' \
+ 'AND ' + query_line + ' ' \
+ 'AND currency_id = %s', (account.id, account.currency_id.id))
+ balance_in_currency = cr.dictfetchone()['balance_in_currency']
+
+ company_currency_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id
+ if not currency_obj.is_zero(cr, uid, company_currency_id, abs(account.balance)):
+ if query_2nd_part:
+ query_2nd_part += ','
+ query_2nd_part += "(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
+ query_2nd_part_args += (account.balance > 0 and account.balance or 0.0,
+ account.balance < 0 and -account.balance or 0.0,
+ data[0].report_name,
+ period.date_start,
+ move_id,
+ new_journal.id,
+ period.id,
+ account.id,
+ account.currency_id and account.currency_id.id or None,
+ balance_in_currency,
+ account.company_id.id,
+ 'draft')
+ if query_2nd_part:
+ cr.execute(query_1st_part + query_2nd_part, tuple(query_2nd_part_args))
+
+ #validate and centralize the opening move
+ obj_acc_move.validate(cr, uid, [move_id], context=context)
+
+ #reconcile all the move.line of the opening move
+ ids = obj_acc_move_line.search(cr, uid, [('journal_id', '=', new_journal.id),
('period_id.fiscalyear_id','=',new_fyear.id)])
context['fy_closing'] = True
-
if ids:
- obj_acc_move_line.reconcile(cr, uid, ids, context=context)
+ reconcile_id = obj_acc_move_line.reconcile(cr, uid, ids, context=context)
+ #set the creation date of the reconcilation at the first day of the new fiscalyear, in order to have good figures in the aged trial balance
+ self.pool.get('account.move.reconcile').write(cr, uid, [reconcile_id], {'create_date': new_fyear.date_start}, context=context)
+
+ #create the journal.period object and link it to the old fiscalyear
new_period = data[0].period_id.id
- ids = obj_acc_journal_period.search(cr, uid, [('journal_id','=',new_journal.id),('period_id','=',new_period)])
+ ids = obj_acc_journal_period.search(cr, uid, [('journal_id', '=', new_journal.id), ('period_id', '=', new_period)])
if not ids:
ids = [obj_acc_journal_period.create(cr, uid, {
- 'name': (new_journal.name or '')+':'+(period.code or ''),
+ 'name': (new_journal.name or '') + ':' + (period.code or ''),
'journal_id': new_journal.id,
'period_id': period.id
})]
cr.execute('UPDATE account_fiscalyear ' \
'SET end_journal_period_id = %s ' \
'WHERE id = %s', (ids[0], old_fyear.id))
+
return {'type': 'ir.actions.act_window_close'}
account_fiscalyear_close()
diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py
index 74feaca27be..8de1dc79bfb 100644
--- a/addons/account/wizard/account_invoice_refund.py
+++ b/addons/account/wizard/account_invoice_refund.py
@@ -41,12 +41,16 @@ class account_invoice_refund(osv.osv_memory):
def _get_journal(self, cr, uid, context=None):
obj_journal = self.pool.get('account.journal')
+ user_obj = self.pool.get('res.users')
if context is None:
context = {}
- journal = obj_journal.search(cr, uid, [('type', '=', 'sale_refund')])
- if context.get('type', False):
- if context['type'] in ('in_invoice', 'in_refund'):
- journal = obj_journal.search(cr, uid, [('type', '=', 'purchase_refund')])
+ inv_type = context.get('type', 'out_invoice')
+ company_id = user_obj.browse(cr, uid, uid, context=context).company_id.id
+ type = (inv_type == 'out_invoice') and 'sale_refund' or \
+ (inv_type == 'out_refund') and 'sale' or \
+ (inv_type == 'in_invoice') and 'purchase_refund' or \
+ (inv_type == 'in_refund') and 'purchase'
+ journal = obj_journal.search(cr, uid, [('type', '=', type), ('company_id','=',company_id)], limit=1, context=context)
return journal and journal[0] or False
_defaults = {
@@ -57,15 +61,17 @@ class account_invoice_refund(osv.osv_memory):
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
journal_obj = self.pool.get('account.journal')
+ user_obj = self.pool.get('res.users')
res = super(account_invoice_refund,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
- type = context.get('journal_type', 'sale_refund')
- if type in ('sale', 'sale_refund'):
- type = 'sale_refund'
- else:
- type = 'purchase_refund'
+ type = context.get('type', 'out_invoice')
+ company_id = user_obj.browse(cr, uid, uid, context=context).company_id.id
+ journal_type = (type == 'out_invoice') and 'sale_refund' or \
+ (type == 'out_refund') and 'sale' or \
+ (type == 'in_invoice') and 'purchase_refund' or \
+ (type == 'in_refund') and 'purchase'
for field in res['fields']:
if field == 'journal_id':
- journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', type)], context=context, limit=None, name_get_uid=1)
+ journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', journal_type), ('company_id','child_of',[company_id])], context=context)
res['fields'][field]['selection'] = journal_select
return res
@@ -198,10 +204,10 @@ class account_invoice_refund(osv.osv_memory):
if 'value' in data and data['value']:
inv_obj.write(cr, uid, [inv_id], data['value'])
created_inv.append(inv_id)
- if inv.type in ('out_invoice', 'out_refund'):
- xml_id = 'action_invoice_tree3'
- else:
- xml_id = 'action_invoice_tree4'
+ xml_id = (inv.type == 'out_refund') and 'action_invoice_tree1' or \
+ (inv.type == 'in_refund') and 'action_invoice_tree2' or \
+ (inv.type == 'out_invoice') and 'action_invoice_tree3' or \
+ (inv.type == 'in_invoice') and 'action_invoice_tree4'
result = mod_obj.get_object_reference(cr, uid, 'account', xml_id)
id = result and result[1] or False
result = act_obj.read(cr, uid, id, context=context)
diff --git a/addons/account/wizard/account_reconcile.py b/addons/account/wizard/account_reconcile.py
index 30bac2ae1fd..d03051b2ccb 100644
--- a/addons/account/wizard/account_reconcile.py
+++ b/addons/account/wizard/account_reconcile.py
@@ -110,7 +110,7 @@ class account_move_line_reconcile_writeoff(osv.osv_memory):
It opens the write off wizard form, in that user can define the journal, account, analytic account for reconcile
"""
_name = 'account.move.line.reconcile.writeoff'
- _description = 'Account move line reconcile'
+ _description = 'Account move line reconcile (writeoff)'
_columns = {
'journal_id': fields.many2one('account.journal','Write-Off Journal', required=True),
'writeoff_acc_id': fields.many2one('account.account','Write-Off account', required=True),
diff --git a/addons/account/wizard/account_report_account_balance.py b/addons/account/wizard/account_report_account_balance.py
index a72d58dd904..4e52066b49e 100644
--- a/addons/account/wizard/account_report_account_balance.py
+++ b/addons/account/wizard/account_report_account_balance.py
@@ -19,13 +19,17 @@
#
##############################################################################
-from osv import osv
+from osv import osv, fields
class account_balance_report(osv.osv_memory):
_inherit = "account.common.account.report"
_name = 'account.balance.report'
_description = 'Trial Balance Report'
+ _columns = {
+ 'journal_ids': fields.many2many('account.journal', 'account_balance_report_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
+ }
+
_defaults = {
'journal_ids': [],
}
diff --git a/addons/account/wizard/account_report_aged_partner_balance.py b/addons/account/wizard/account_report_aged_partner_balance.py
index 4e6c6dea752..9b89b30c93b 100644
--- a/addons/account/wizard/account_report_aged_partner_balance.py
+++ b/addons/account/wizard/account_report_aged_partner_balance.py
@@ -35,6 +35,7 @@ class account_aged_trial_balance(osv.osv_memory):
'direction_selection': fields.selection([('past','Past'),
('future','Future')],
'Analysis Direction', required=True),
+ 'journal_ids': fields.many2many('account.journal', 'account_aged_trial_balance_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
}
_defaults = {
'period_length': 30,
diff --git a/addons/account/wizard/account_report_balance_sheet.py b/addons/account/wizard/account_report_balance_sheet.py
index 873ede3832c..01a89168a43 100644
--- a/addons/account/wizard/account_report_balance_sheet.py
+++ b/addons/account/wizard/account_report_balance_sheet.py
@@ -40,11 +40,9 @@ class account_bs_report(osv.osv_memory):
_columns = {
'display_type': fields.boolean("Landscape Mode"),
'reserve_account_id': fields.many2one('account.account', 'Reserve & Profit/Loss Account',
- required=True,
- help='This Account is used for transfering Profit/Loss ' \
- '(Profit: Amount will be added, Loss: Amount will be duducted), ' \
- 'which is calculated from Profilt & Loss Report',
+ help='This account is used for transferring Profit/Loss (If It is Profit: Amount will be added, Loss : Amount will be deducted.), as calculated in Profit & Loss Report',
domain = [('type','=','other')]),
+ 'journal_ids': fields.many2many('account.journal', 'account_bs_report_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
}
_defaults={
diff --git a/addons/account/wizard/account_report_balance_sheet_view.xml b/addons/account/wizard/account_report_balance_sheet_view.xml
index 22a6e0608b2..faac52388a1 100644
--- a/addons/account/wizard/account_report_balance_sheet_view.xml
+++ b/addons/account/wizard/account_report_balance_sheet_view.xml
@@ -21,7 +21,7 @@
-
+
diff --git a/addons/account/wizard/account_report_central_journal.py b/addons/account/wizard/account_report_central_journal.py
index d66be0a70e4..eed21f976a5 100644
--- a/addons/account/wizard/account_report_central_journal.py
+++ b/addons/account/wizard/account_report_central_journal.py
@@ -19,13 +19,17 @@
#
##############################################################################
-from osv import osv
+from osv import osv, fields
class account_central_journal(osv.osv_memory):
_name = 'account.central.journal'
_description = 'Account Central Journal'
_inherit = "account.common.journal.report"
+ _columns = {
+ 'journal_ids': fields.many2many('account.journal', 'account_central_journal_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
+ }
+
def _print_report(self, cr, uid, ids, data, context=None):
data = self.pre_print_report(cr, uid, ids, data, context=context)
return {
diff --git a/addons/account/wizard/account_report_common.py b/addons/account/wizard/account_report_common.py
index 7aa4c465e0d..48130b041d0 100644
--- a/addons/account/wizard/account_report_common.py
+++ b/addons/account/wizard/account_report_common.py
@@ -35,7 +35,7 @@ class account_common_report(osv.osv_memory):
'filter': fields.selection([('filter_no', 'No Filters'), ('filter_date', 'Date'), ('filter_period', 'Periods')], "Filter by", required=True),
'period_from': fields.many2one('account.period', 'Start Period'),
'period_to': fields.many2one('account.period', 'End Period'),
- 'journal_ids': fields.many2many('account.journal', 'account_common_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
+ 'journal_ids': fields.many2many('account.journal', string='Journals', required=True),
'date_from': fields.date("Start Date"),
'date_to': fields.date("End Date"),
'target_move': fields.selection([('posted', 'All Posted Entries'),
@@ -68,6 +68,7 @@ class account_common_report(osv.osv_memory):
FROM account_period p
LEFT JOIN account_fiscalyear f ON (p.fiscalyear_id = f.id)
WHERE f.id = %s
+ AND p.special = false
ORDER BY p.date_start ASC, p.special ASC
LIMIT 1) AS period_start
UNION
@@ -76,6 +77,7 @@ class account_common_report(osv.osv_memory):
LEFT JOIN account_fiscalyear f ON (p.fiscalyear_id = f.id)
WHERE f.id = %s
AND p.date_start < NOW()
+ AND p.special = false
ORDER BY p.date_stop DESC
LIMIT 1) AS period_stop''', (fiscalyear_id, fiscalyear_id))
periods = [i[0] for i in cr.fetchall()]
diff --git a/addons/account/wizard/account_report_general_journal.py b/addons/account/wizard/account_report_general_journal.py
index af091d9bc08..521c4667a80 100644
--- a/addons/account/wizard/account_report_general_journal.py
+++ b/addons/account/wizard/account_report_general_journal.py
@@ -19,17 +19,21 @@
#
##############################################################################
-from osv import osv
+from osv import osv, fields
class account_general_journal(osv.osv_memory):
_inherit = "account.common.journal.report"
_name = 'account.general.journal'
_description = 'Account General Journal'
+ _columns = {
+ 'journal_ids': fields.many2many('account.journal', 'account_general_journal_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
+ }
+
def _print_report(self, cr, uid, ids, data, context=None):
data = self.pre_print_report(cr, uid, ids, data, context=context)
return {'type': 'ir.actions.report.xml', 'report_name': 'account.general.journal', 'datas': data}
account_general_journal()
-#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/wizard/account_report_general_ledger.py b/addons/account/wizard/account_report_general_ledger.py
index ed75b3c1dce..d0b3c0fa3d3 100644
--- a/addons/account/wizard/account_report_general_ledger.py
+++ b/addons/account/wizard/account_report_general_ledger.py
@@ -32,6 +32,7 @@ class account_report_general_ledger(osv.osv_memory):
help='If you selected to filter by date or period, this field allow you to add a row to display the amount of debit/credit/balance that precedes the filter you\'ve set.'),
'amount_currency': fields.boolean("With Currency", help="It adds the currency column if the currency is different then the company currency"),
'sortby': fields.selection([('sort_date', 'Date'), ('sort_journal_partner', 'Journal & Partner')], 'Sort by', required=True),
+ 'journal_ids': fields.many2many('account.journal', 'account_report_general_ledger_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
}
_defaults = {
'landscape': True,
diff --git a/addons/account/wizard/account_report_partner_balance.py b/addons/account/wizard/account_report_partner_balance.py
index eff9e71cb72..80ee455456c 100644
--- a/addons/account/wizard/account_report_partner_balance.py
+++ b/addons/account/wizard/account_report_partner_balance.py
@@ -31,6 +31,7 @@ class account_partner_balance(osv.osv_memory):
_columns = {
'display_partner': fields.selection([('non-zero_balance', 'With balance is not equal to 0'), ('all', 'All Partners')]
,'Display Partners'),
+ 'journal_ids': fields.many2many('account.journal', 'account_partner_balance_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
}
_defaults = {
@@ -51,4 +52,4 @@ class account_partner_balance(osv.osv_memory):
account_partner_balance()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/wizard/account_report_partner_ledger.py b/addons/account/wizard/account_report_partner_ledger.py
index 8a2b6c7bacb..7a3f3932f1b 100644
--- a/addons/account/wizard/account_report_partner_ledger.py
+++ b/addons/account/wizard/account_report_partner_ledger.py
@@ -35,6 +35,7 @@ class account_partner_ledger(osv.osv_memory):
'filter': fields.selection([('filter_no', 'No Filters'), ('filter_date', 'Date'), ('filter_period', 'Periods'), ('unreconciled', 'Unreconciled Entries')], "Filter by", required=True),
'page_split': fields.boolean('One Partner Per Page', help='Display Ledger Report with One partner per page'),
'amount_currency': fields.boolean("With Currency", help="It adds the currency column if the currency is different then the company currency"),
+ 'journal_ids': fields.many2many('account.journal', 'account_partner_ledger_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
}
_defaults = {
'initial_balance': False,
diff --git a/addons/account/wizard/account_report_print_journal.py b/addons/account/wizard/account_report_print_journal.py
index f4a5fcaf9f9..d7e8f11a7f8 100644
--- a/addons/account/wizard/account_report_print_journal.py
+++ b/addons/account/wizard/account_report_print_journal.py
@@ -30,6 +30,7 @@ class account_print_journal(osv.osv_memory):
'sort_selection': fields.selection([('date', 'Date'),
('ref', 'Reference Number'),],
'Entries Sorted by', required=True),
+ 'journal_ids': fields.many2many('account.journal', 'account_print_journal_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
}
_defaults = {
'sort_selection': 'date',
@@ -44,4 +45,4 @@ class account_print_journal(osv.osv_memory):
account_print_journal()
-#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/wizard/account_report_profit_loss.py b/addons/account/wizard/account_report_profit_loss.py
index 6372539c056..f4c2897bfe0 100644
--- a/addons/account/wizard/account_report_profit_loss.py
+++ b/addons/account/wizard/account_report_profit_loss.py
@@ -28,14 +28,15 @@ class account_pl_report(osv.osv_memory):
_inherit = "account.common.account.report"
_name = "account.pl.report"
_description = "Account Profit And Loss Report"
+
_columns = {
'display_type': fields.boolean("Landscape Mode"),
+ 'journal_ids': fields.many2many('account.journal', 'account_pl_report_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
}
_defaults = {
'display_type': False,
'journal_ids': [],
- 'target_move': False
}
def _print_report(self, cr, uid, ids, data, context=None):
diff --git a/addons/account/wizard/account_report_profit_loss_view.xml b/addons/account/wizard/account_report_profit_loss_view.xml
index d9876f57454..75b6766ff87 100644
--- a/addons/account/wizard/account_report_profit_loss_view.xml
+++ b/addons/account/wizard/account_report_profit_loss_view.xml
@@ -9,9 +9,6 @@
-
-
-
diff --git a/addons/account_analytic_analysis/account_analytic_analysis_menu.xml b/addons/account_analytic_analysis/account_analytic_analysis_menu.xml
index 4ee4693abcb..bfb7a892668 100644
--- a/addons/account_analytic_analysis/account_analytic_analysis_menu.xml
+++ b/addons/account_analytic_analysis/account_analytic_analysis_menu.xml
@@ -11,7 +11,7 @@
[('invoice_id','=',False)]
-
+ Overpassed Accounts
@@ -20,6 +20,6 @@
tree,form,graph[('date','<=',time.strftime('%Y-%m-%d')),('state','=','open')]
-
+
diff --git a/addons/account_analytic_analysis/i18n/mk.po b/addons/account_analytic_analysis/i18n/mk.po
new file mode 100644
index 00000000000..81d5d115207
--- /dev/null
+++ b/addons/account_analytic_analysis/i18n/mk.po
@@ -0,0 +1,296 @@
+# Macedonian translation for openobject-addons
+# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
+# This file is distributed under the same license as the openobject-addons package.
+# FIRST AUTHOR , 2011.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: openobject-addons\n"
+"Report-Msgid-Bugs-To: FULL NAME \n"
+"POT-Creation-Date: 2011-01-11 11:14+0000\n"
+"PO-Revision-Date: 2011-09-14 08:10+0000\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: Macedonian \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2011-09-15 04:47+0000\n"
+"X-Generator: Launchpad (build 13921)\n"
+
+#. module: account_analytic_analysis
+#: help:account.analytic.account,hours_qtt_invoiced:0
+msgid ""
+"Number of hours that can be invoiced plus those that already have been "
+"invoiced."
+msgstr ""
+"Број на часови кои можат да бидат фактурирани, плус часови кои веќе се "
+"фактурирани."
+
+#. module: account_analytic_analysis
+#: help:account.analytic.account,remaining_ca:0
+msgid "Computed using the formula: Max Invoice Price - Invoiced Amount."
+msgstr ""
+"Пресметано според формулата: Максимална фактурирана цена - Фактурирана цена."
+
+#. module: account_analytic_analysis
+#: help:account.analytic.account,remaining_hours:0
+msgid "Computed using the formula: Maximum Quantity - Hours Tot."
+msgstr "Пресметано според формулата: Максимална количина - Вкупно часови"
+
+#. module: account_analytic_analysis
+#: code:addons/account_analytic_analysis/account_analytic_analysis.py:532
+#: code:addons/account_analytic_analysis/account_analytic_analysis.py:703
+#, python-format
+msgid "AccessError"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: help:account.analytic.account,last_invoice_date:0
+msgid "Date of the last invoice created for this analytic account."
+msgstr ""
+
+#. module: account_analytic_analysis
+#: model:ir.module.module,description:account_analytic_analysis.module_meta_information
+msgid ""
+"\n"
+"This module is for modifying account analytic view to show\n"
+"important data to project manager of services companies.\n"
+"Adds menu to show relevant information to each manager..\n"
+"\n"
+"You can also view the report of account analytic summary\n"
+"user-wise as well as month wise.\n"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account.analytic.account,last_invoice_date:0
+msgid "Last Invoice Date"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: help:account.analytic.account,theorical_margin:0
+msgid "Computed using the formula: Theorial Revenue - Total Costs"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account.analytic.account,real_margin_rate:0
+msgid "Real Margin Rate (%)"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account.analytic.account,ca_theorical:0
+msgid "Theoretical Revenue"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: help:account.analytic.account,last_worked_invoiced_date:0
+msgid ""
+"If invoice from the costs, this is the date of the latest work or cost that "
+"have been invoiced."
+msgstr ""
+
+#. module: account_analytic_analysis
+#: model:ir.ui.menu,name:account_analytic_analysis.menu_invoicing
+msgid "Billing"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account.analytic.account,last_worked_date:0
+msgid "Date of Last Cost/Work"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account.analytic.account,total_cost:0
+msgid "Total Costs"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: help:account.analytic.account,hours_quantity:0
+msgid ""
+"Number of hours you spent on the analytic account (from timesheet). It "
+"computes on all journal of type 'general'."
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account.analytic.account,remaining_hours:0
+msgid "Remaining Hours"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account.analytic.account,theorical_margin:0
+msgid "Theoretical Margin"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: help:account.analytic.account,ca_theorical:0
+msgid ""
+"Based on the costs you had on the project, what would have been the revenue "
+"if all these costs have been invoiced at the normal sale price provided by "
+"the pricelist."
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account.analytic.account,user_ids:0
+#: field:account_analytic_analysis.summary.user,user:0
+msgid "User"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account.analytic.account,ca_to_invoice:0
+msgid "Uninvoiced Amount"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: help:account.analytic.account,real_margin:0
+msgid "Computed using the formula: Invoiced Amount - Total Costs."
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account.analytic.account,hours_qtt_non_invoiced:0
+msgid "Uninvoiced Hours"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: help:account.analytic.account,last_worked_date:0
+msgid "Date of the latest work done on this account."
+msgstr ""
+
+#. module: account_analytic_analysis
+#: model:ir.module.module,shortdesc:account_analytic_analysis.module_meta_information
+msgid "report_account_analytic"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: model:ir.model,name:account_analytic_analysis.model_account_analytic_analysis_summary_user
+msgid "Hours Summary by User"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account.analytic.account,ca_invoiced:0
+msgid "Invoiced Amount"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: code:addons/account_analytic_analysis/account_analytic_analysis.py:533
+#: code:addons/account_analytic_analysis/account_analytic_analysis.py:704
+#, python-format
+msgid "You try to bypass an access rule (Document type: %s)."
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account.analytic.account,last_worked_invoiced_date:0
+msgid "Date of Last Invoiced Cost"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account.analytic.account,hours_qtt_invoiced:0
+msgid "Invoiced Hours"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account.analytic.account,real_margin:0
+msgid "Real Margin"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: constraint:account.analytic.account:0
+msgid ""
+"Error! The currency has to be the same as the currency of the selected "
+"company"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: help:account.analytic.account,ca_invoiced:0
+msgid "Total customer invoiced amount for this account."
+msgstr ""
+
+#. module: account_analytic_analysis
+#: model:ir.model,name:account_analytic_analysis.model_account_analytic_analysis_summary_month
+msgid "Hours summary by month"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: help:account.analytic.account,real_margin_rate:0
+msgid "Computes using the formula: (Real Margin / Total Costs) * 100."
+msgstr ""
+
+#. module: account_analytic_analysis
+#: help:account.analytic.account,hours_qtt_non_invoiced:0
+msgid ""
+"Number of hours (from journal of type 'general') that can be invoiced if you "
+"invoice based on analytic account."
+msgstr ""
+
+#. module: account_analytic_analysis
+#: view:account.analytic.account:0
+msgid "Analytic accounts"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account.analytic.account,remaining_ca:0
+msgid "Remaining Revenue"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: help:account.analytic.account,ca_to_invoice:0
+msgid ""
+"If invoice from analytic account, the remaining amount you can invoice to "
+"the customer based on the total costs."
+msgstr ""
+
+#. module: account_analytic_analysis
+#: help:account.analytic.account,revenue_per_hour:0
+msgid "Computed using the formula: Invoiced Amount / Hours Tot."
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account.analytic.account,revenue_per_hour:0
+msgid "Revenue per Hours (real)"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account_analytic_analysis.summary.month,unit_amount:0
+#: field:account_analytic_analysis.summary.user,unit_amount:0
+msgid "Total Time"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account.analytic.account,month_ids:0
+#: field:account_analytic_analysis.summary.month,month:0
+msgid "Month"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account_analytic_analysis.summary.month,account_id:0
+#: field:account_analytic_analysis.summary.user,account_id:0
+#: model:ir.model,name:account_analytic_analysis.model_account_analytic_account
+msgid "Analytic Account"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: model:ir.actions.act_window,name:account_analytic_analysis.action_account_analytic_managed_overpassed
+#: model:ir.ui.menu,name:account_analytic_analysis.menu_action_account_analytic_managed_overpassed
+msgid "Overpassed Accounts"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: model:ir.actions.act_window,name:account_analytic_analysis.action_hr_tree_invoiced_all
+#: model:ir.ui.menu,name:account_analytic_analysis.menu_action_hr_tree_invoiced_all
+msgid "All Uninvoiced Entries"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: field:account.analytic.account,hours_quantity:0
+msgid "Hours Tot"
+msgstr ""
+
+#. module: account_analytic_analysis
+#: constraint:account.analytic.account:0
+msgid "Error! You can not create recursive analytic accounts."
+msgstr ""
+
+#. module: account_analytic_analysis
+#: help:account.analytic.account,total_cost:0
+msgid ""
+"Total of costs for this account. It includes real costs (from invoices) and "
+"indirect costs, like time spent on timesheets."
+msgstr ""
diff --git a/addons/account_analytic_default/__openerp__.py b/addons/account_analytic_default/__openerp__.py
index c2bea6783df..07cde53d003 100644
--- a/addons/account_analytic_default/__openerp__.py
+++ b/addons/account_analytic_default/__openerp__.py
@@ -39,7 +39,11 @@ Allows to automatically select analytic accounts based on criterions:
'images' : ['images/analytic_defaults.jpeg'],
'depends' : ['sale'],
'init_xml' : [],
- 'update_xml': ['security/ir.model.access.csv', 'account_analytic_default_view.xml'],
+ 'update_xml': [
+ 'security/ir.model.access.csv',
+ 'security/account_analytic_default_security.xml',
+ 'account_analytic_default_view.xml'
+ ],
'demo_xml' : [],
'installable': True,
'active': False,
diff --git a/addons/account_analytic_default/account_analytic_default_view.xml b/addons/account_analytic_default/account_analytic_default_view.xml
index f078ba09c22..753765019f6 100644
--- a/addons/account_analytic_default/account_analytic_default_view.xml
+++ b/addons/account_analytic_default/account_analytic_default_view.xml
@@ -44,7 +44,7 @@
search
-
+
diff --git a/addons/account_analytic_default/security/account_analytic_default_security.xml b/addons/account_analytic_default/security/account_analytic_default_security.xml
new file mode 100644
index 00000000000..7ff68c7d849
--- /dev/null
+++ b/addons/account_analytic_default/security/account_analytic_default_security.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+ Analytic Default multi company rule
+
+
+ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
+
+
+
+
diff --git a/addons/account_analytic_plans/account_analytic_plans.py b/addons/account_analytic_plans/account_analytic_plans.py
index c8ab5334d8a..c62e6ea98d0 100644
--- a/addons/account_analytic_plans/account_analytic_plans.py
+++ b/addons/account_analytic_plans/account_analytic_plans.py
@@ -366,7 +366,7 @@ class account_move_line(osv.osv):
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
if context is None:
context = {}
- result = super(osv.osv, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
+ result = super(account_move_line, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
return result
account_move_line()
@@ -496,4 +496,4 @@ class account_bank_statement_line(osv.osv):
}
account_bank_statement_line()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account_analytic_plans/account_analytic_plans_installer_view.xml b/addons/account_analytic_plans/account_analytic_plans_installer_view.xml
index fa40ef1e618..c9d21147458 100644
--- a/addons/account_analytic_plans/account_analytic_plans_installer_view.xml
+++ b/addons/account_analytic_plans/account_analytic_plans_installer_view.xml
@@ -2,7 +2,7 @@
- Account Analytic Plans
+ Define your Analytic Plansir.actions.act_windowaccount.analytic.planform
diff --git a/addons/account_analytic_plans/report/crossovered_analytic.rml b/addons/account_analytic_plans/report/crossovered_analytic.rml
index 6e331ed1b83..f374aa5a2c2 100644
--- a/addons/account_analytic_plans/report/crossovered_analytic.rml
+++ b/addons/account_analytic_plans/report/crossovered_analytic.rml
@@ -240,7 +240,7 @@
[[ formatLang(a['ref_qty']) ]]