[MERGE]merge with latest addons

bzr revid: csn@openerp.com-20121119154551-y8uizex6hu7fu1eo
This commit is contained in:
Cedric Snauwaert 2012-11-19 16:45:51 +01:00
commit 7e193e691c
7423 changed files with 335462 additions and 360905 deletions

View File

@ -19,11 +19,11 @@
#
##############################################################################
{
"name" : "eInvoicing",
"version" : "1.1",
"author" : "OpenERP SA",
"category": 'Accounting & Finance',
"description": """
'name' : 'eInvoicing',
'version' : '1.1',
'author' : 'OpenERP SA',
'category' : 'Accounting & Finance',
'description' : """
Accounting and Financial Management.
====================================
@ -44,14 +44,13 @@ Creates a dashboard for accountants that includes:
* Company Analysis
* Graph of Treasury
The processes like maintaining of general ledger is done through the defined financial Journals (entry move line orgrouping is maintained through journal) for a particular
financial year and for preparation of vouchers there is a module named account_voucher.
The processes like maintaining of general ledger is done through the defined financial Journals (entry move line orgrouping is maintained through journal)
for a particular financial year and for preparation of vouchers there is a module named account_voucher.
""",
'website': 'http://www.openerp.com',
'images' : ['images/accounts.jpeg','images/bank_statement.jpeg','images/cash_register.jpeg','images/chart_of_accounts.jpeg','images/customer_invoice.jpeg','images/journal_entries.jpeg'],
'init_xml': [],
"depends" : ["base_setup", "product", "analytic", "process", "board", "edi"],
'update_xml': [
'depends' : ['base_setup', 'product', 'analytic', 'process', 'board', 'edi'],
'data': [
'security/account_security.xml',
'security/ir.model.access.csv',
'account_menuitem.xml',
@ -64,6 +63,8 @@ financial year and for preparation of vouchers there is a module named account_v
'wizard/account_use_model_view.xml',
'account_installer.xml',
'wizard/account_period_close_view.xml',
'wizard/account_reconcile_view.xml',
'wizard/account_unreconcile_view.xml',
'account_view.xml',
'account_report.xml',
'account_financial_report_data.xml',
@ -86,14 +87,12 @@ financial year and for preparation of vouchers there is a module named account_v
'wizard/account_journal_select_view.xml',
'wizard/account_change_currency_view.xml',
'wizard/account_validate_move_view.xml',
'wizard/account_unreconcile_view.xml',
'wizard/account_report_general_ledger_view.xml',
'wizard/account_invoice_state_view.xml',
'wizard/account_report_partner_balance_view.xml',
'wizard/account_report_account_balance_view.xml',
'wizard/account_report_aged_partner_balance_view.xml',
'wizard/account_report_partner_ledger_view.xml',
'wizard/account_reconcile_view.xml',
'wizard/account_reconcile_partner_process_view.xml',
'wizard/account_automatic_reconcile_view.xml',
'wizard/account_financial_report_view.xml',
@ -122,12 +121,20 @@ financial year and for preparation of vouchers there is a module named account_v
'ir_sequence_view.xml',
'company_view.xml',
'board_account_view.xml',
"edi/invoice_action_data.xml",
"account_bank_view.xml",
"res_config_view.xml",
"account_pre_install.yml"
'edi/invoice_action_data.xml',
'account_bank_view.xml',
'res_config_view.xml',
'account_pre_install.yml'
],
'demo_xml': [
'js': [
'static/src/js/account_move_reconciliation.js',
],
'qweb' : [
"static/src/xml/account_move_reconciliation.xml",
],
'css':['static/src/css/account_move_reconciliation.css'
],
'demo': [
'demo/account_demo.xml',
'project/project_demo.xml',
'project/analytic_account_demo.xml',
@ -152,6 +159,5 @@ financial year and for preparation of vouchers there is a module named account_v
],
'installable': True,
'auto_install': False,
'certificate': '0080331923549',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -30,6 +30,8 @@ from osv import fields, osv
import decimal_precision as dp
from tools.translate import _
from tools.float_utils import float_round
from openerp import SUPERUSER_ID
import tools
_logger = logging.getLogger(__name__)
@ -109,7 +111,7 @@ class account_payment_term_line(osv.osv):
'days': fields.integer('Number of Days', required=True, help="Number of days to add before computation of the day of month." \
"If Date=15/01, Number of Days=22, Day of Month=-1, then the due date is 28/02."),
'days2': fields.integer('Day of the Month', required=True, help="Day of the month, set -1 for the last day of the current month. If it's positive, it gives the day of the next month. Set 0 for net days (otherwise it's based on the beginning of the month)."),
'payment_id': fields.many2one('account.payment.term', 'Payment Term', required=True, select=True),
'payment_id': fields.many2one('account.payment.term', 'Payment Term', required=True, select=True, ondelete='cascade'),
}
_defaults = {
'value': 'balance',
@ -153,6 +155,7 @@ class account_account_type(osv.osv):
return res
def _save_report_type(self, cr, uid, account_type_id, field_name, field_value, arg, context=None):
field_value = field_value or 'none'
obj_data = self.pool.get('ir.model.data')
obj_financial_report = self.pool.get('account.financial.report')
#unlink if it exists somewhere in the financial reports related to BS or PL
@ -179,7 +182,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."""),
'report_type': fields.function(_get_current_report_type, fnct_inv=_save_report_type, type='selection', string='P&L / BS Category',
'report_type': fields.function(_get_current_report_type, fnct_inv=_save_report_type, type='selection', string='P&L / BS Category', store=True,
selection= [('none','/'),
('income', _('Profit & Loss (Income account)')),
('expense', _('Profit & Loss (Expense account)')),
@ -225,7 +228,7 @@ class account_account(osv.osv):
while pos < len(args):
if args[pos][0] == 'code' and args[pos][1] in ('like', 'ilike') and args[pos][2]:
args[pos] = ('code', '=like', str(args[pos][2].replace('%', ''))+'%')
args[pos] = ('code', '=like', tools.ustr(args[pos][2].replace('%', ''))+'%')
if args[pos][0] == 'journal_id':
if not args[pos][2]:
del args[pos]
@ -297,7 +300,6 @@ class account_account(osv.osv):
if aml_query.strip():
wheres.append(aml_query.strip())
filters = " AND ".join(wheres)
_logger.debug('Filters: %s',(filters))
# IN might not work ideally in case there are too many
# children_and_consolidated, in that case join on a
# values() e.g.:
@ -313,7 +315,6 @@ class account_account(osv.osv):
" GROUP BY l.account_id")
params = (tuple(children_and_consolidated),) + query_params
cr.execute(request, params)
_logger.debug('Status: %s',(cr.statusmessage))
for row in cr.dictfetchall():
accounts[row['id']] = row
@ -540,10 +541,18 @@ class account_account(osv.osv):
return False
return True
def _check_company_account(self, cr, uid, ids, context=None):
for account in self.browse(cr, uid, ids, context=context):
if account.parent_id:
if account.company_id != account.parent_id.company_id:
return False
return True
_constraints = [
(_check_recursion, 'Error!\nYou cannot create recursive accounts.', ['parent_id']),
(_check_type, 'Configuration Error!\nYou cannot define children to an account with internal type different of "View".', ['type']),
(_check_account_type, 'Configuration Error!\nYou cannot select an account type with a deferral method different of "Unreconciled" for accounts with internal type "Payable/Receivable".', ['user_type','type']),
(_check_company_account, 'Error!\nYou cannot create an account which has parent account of different company.', ['parent_id']),
]
_sql_constraints = [
('code_company_uniq', 'unique (code,company_id)', 'The code of the account must be unique per company !')
@ -582,6 +591,8 @@ class account_account(osv.osv):
def name_get(self, cr, uid, ids, context=None):
if not ids:
return []
if isinstance(ids, (int, long)):
ids = [ids]
reads = self.read(cr, uid, ids, ['name', 'code'], context=context)
res = []
for record in reads:
@ -591,13 +602,13 @@ class account_account(osv.osv):
res.append((record['id'], name))
return res
def copy(self, cr, uid, id, default={}, context=None, done_list=[], local=False):
def copy(self, cr, uid, id, default=None, context=None, done_list=None, local=False):
default = {} if default is None else default.copy()
if done_list is None:
done_list = []
account = self.browse(cr, uid, id, context=context)
new_child_ids = []
if not default:
default = {}
default = default.copy()
default['code'] = (account['code'] or '') + '(copy)'
default.update(code=_("%s (copy)") % (account['code'] or ''))
if not local:
done_list = []
if account.id in done_list:
@ -678,7 +689,7 @@ class account_journal_view(osv.osv):
_name = "account.journal.view"
_description = "Journal View"
_columns = {
'name': fields.char('Journal View', size=64, required=True),
'name': fields.char('Journal View', size=64, required=True, translate=True),
'columns_id': fields.one2many('account.journal.column', 'view_id', 'Columns')
}
_order = "name"
@ -744,9 +755,11 @@ class account_journal(osv.osv):
'profit_account_id' : fields.many2one('account.account', 'Profit Account'),
'loss_account_id' : fields.many2one('account.account', 'Loss Account'),
'internal_account_id' : fields.many2one('account.account', 'Internal Transfers Account', select=1),
'cash_control' : fields.boolean('Cash Control', help='If you want the journal should be control at opening/closing, check this option'),
}
_defaults = {
'cash_control' : False,
'with_last_closing_balance' : False,
'user_id': lambda self, cr, uid, context: uid,
'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
@ -771,14 +784,15 @@ class account_journal(osv.osv):
(_check_currency, 'Configuration error!\nThe currency chosen should be shared by the default accounts too.', ['currency','default_debit_account_id','default_credit_account_id']),
]
def copy(self, cr, uid, id, default={}, context=None, done_list=[], local=False):
def copy(self, cr, uid, id, default=None, context=None, done_list=None, local=False):
default = {} if default is None else default.copy()
if done_list is None:
done_list = []
journal = self.browse(cr, uid, id, context=context)
if not default:
default = {}
default = default.copy()
default['code'] = (journal['code'] or '') + '(copy)'
default['name'] = (journal['name'] or '') + '(copy)'
default['sequence_id'] = False
default.update(
code=_("%s (copy)") % (journal['code'] or ''),
name=_("%s (copy)") % (journal['name'] or ''),
sequence_id=False)
return super(account_journal, self).copy(cr, uid, id, default, context=context)
def write(self, cr, uid, ids, vals, context=None):
@ -815,7 +829,7 @@ class account_journal(osv.osv):
if not 'sequence_id' in vals or not vals['sequence_id']:
# if we have the right to create a journal, we should be able to
# create it's sequence.
vals.update({'sequence_id': self.create_sequence(cr, 1, vals, context)})
vals.update({'sequence_id': self.create_sequence(cr, SUPERUSER_ID, vals, context)})
return super(account_journal, self).create(cr, uid, vals, context)
def name_get(self, cr, user, ids, context=None):
@ -830,6 +844,10 @@ class account_journal(osv.osv):
@return: Returns a list of tupples containing id, name
"""
if not ids:
return []
if isinstance(ids, (int, long)):
ids = [ids]
result = self.browse(cr, user, ids, context=context)
res = []
for rs in result:
@ -997,7 +1015,7 @@ class account_period(osv.osv):
'date_stop': fields.date('End of Period', required=True, states={'done':[('readonly',True)]}),
'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True, states={'done':[('readonly',True)]}, select=True),
'state': fields.selection([('draft','Open'), ('done','Closed')], 'Status', readonly=True,
help='When monthly periods are created. The state is \'Draft\'. At the end of monthly period it is in \'Done\' state.'),
help='When monthly periods are created. The status is \'Draft\'. At the end of monthly period it is in \'Done\' status.'),
'company_id': fields.related('fiscalyear_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True)
}
_defaults = {
@ -1124,7 +1142,7 @@ class account_journal_period(osv.osv):
'icon': fields.function(_icon_get, string='Icon', type='char', size=32),
'active': fields.boolean('Active', required=True, help="If the active field is set to False, it will allow you to hide the journal period without removing it."),
'state': fields.selection([('draft','Draft'), ('printed','Printed'), ('done','Done')], 'Status', required=True, readonly=True,
help='When journal period is created. The state is \'Draft\'. If a report is printed it comes to \'Printed\' state. When all transactions are done, it comes in \'Done\' state.'),
help='When journal period is created. The status is \'Draft\'. If a report is printed it comes to \'Printed\' status. When all transactions are done, it comes in \'Done\' status.'),
'fiscalyear_id': fields.related('period_id', 'fiscalyear_id', string='Fiscal Year', type='many2one', relation='account.fiscalyear'),
'company_id': fields.related('journal_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True)
}
@ -1167,7 +1185,8 @@ class account_fiscalyear(osv.osv):
'end_journal_period_id':fields.many2one('account.journal.period','End of Year Entries Journal', readonly=True),
}
def copy(self, cr, uid, id, default={}, context=None):
def copy(self, cr, uid, id, default=None, context=None):
default = {} if default is None else default.copy()
default.update({
'period_ids': [],
'end_journal_period_id': False
@ -1271,7 +1290,7 @@ class account_move(osv.osv):
'period_id': fields.many2one('account.period', 'Period', required=True, states={'posted':[('readonly',True)]}),
'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'posted':[('readonly',True)]}),
'state': fields.selection([('draft','Unposted'), ('posted','Posted')], 'Status', required=True, readonly=True,
help='All manually created new journal entries are usually in the state \'Unposted\', but you can set the option to skip that state 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\' state.'),
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)]}),
'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),
@ -1369,7 +1388,7 @@ class account_move(osv.osv):
balance = 0.0
for line in line_ids:
if line[2]:
balance += (line[2]['debit'] or 0.00)- (line[2]['credit'] or 0.00)
balance += (line[2].get('debit',0.00)- (line[2].get('credit',0.00)))
return {'value': {'balance': balance}}
def write(self, cr, uid, ids, vals, context=None):
@ -1392,7 +1411,7 @@ class account_move(osv.osv):
if not l[0]:
l[2].update({
'reconcile_id':False,
'reconcil_partial_id':False,
'reconcile_partial_id':False,
'analytic_lines':False,
'invoice':False,
'ref':False,
@ -1420,15 +1439,18 @@ class account_move(osv.osv):
if 'line_id' in vals:
c = context.copy()
c['novalidate'] = True
c['period_id'] = vals['period_id']
c['journal_id'] = vals['journal_id']
c['date'] = vals['date']
result = super(account_move, self).create(cr, uid, vals, c)
self.validate(cr, uid, [result], context)
else:
result = super(account_move, self).create(cr, uid, vals, context)
return result
def copy(self, cr, uid, id, default={}, context=None):
if context is None:
context = {}
def copy(self, cr, uid, id, default=None, context=None):
default = {} if default is None else default.copy()
context = {} if context is None else context.copy()
default.update({
'state':'draft',
'name':'/',
@ -1854,7 +1876,7 @@ class account_tax(osv.osv):
def get_precision_tax():
def change_digit_tax(cr):
res = pooler.get_pool(cr.dbname).get('decimal.precision').precision_get(cr, 1, 'Account')
res = pooler.get_pool(cr.dbname).get('decimal.precision').precision_get(cr, SUPERUSER_ID, 'Account')
return (16, res+2)
return change_digit_tax
@ -1897,7 +1919,7 @@ class account_tax(osv.osv):
'ref_tax_sign': fields.float('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"),
'company_id': fields.many2one('res.company', 'Company', required=True),
'description': fields.char('Tax Code',size=32),
'description': fields.char('Tax Code'),
'price_include': fields.boolean('Tax Included in Price', help="Check this if the price you use on the product and invoices includes this tax."),
'type_tax_use': fields.selection([('sale','Sale'),('purchase','Purchase'),('all','All')], 'Tax Application', required=True)
@ -2258,7 +2280,10 @@ class account_model(osv.osv):
_defaults = {
'legend': lambda self, cr, uid, context:_('You can specify year, month and date in the name of the model using the following labels:\n\n%(year)s: To Specify Year \n%(month)s: To Specify Month \n%(date)s: Current Date\n\ne.g. My model on %(date)s'),
}
def generate(self, cr, uid, ids, datas={}, context=None):
def generate(self, cr, uid, ids, data=None, context=None):
if data is None:
data = {}
move_ids = []
entry = {}
account_move_obj = self.pool.get('account.move')
@ -2269,8 +2294,8 @@ class account_model(osv.osv):
if context is None:
context = {}
if datas.get('date', False):
context.update({'date': datas['date']})
if data.get('date', False):
context.update({'date': data['date']})
move_date = context.get('date', time.strftime('%Y-%m-%d'))
move_date = datetime.strptime(move_date,"%Y-%m-%d")
@ -2332,6 +2357,16 @@ class account_model(osv.osv):
return move_ids
def onchange_journal_id(self, cr, uid, ids, journal_id, context=None):
company_id = False
if journal_id:
journal = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context)
if journal.company_id.id:
company_id = journal.company_id.id
return {'value': {'company_id': company_id}}
account_model()
class account_model_line(osv.osv):
@ -2446,10 +2481,10 @@ class account_subscription_line(osv.osv):
all_moves = []
obj_model = self.pool.get('account.model')
for line in self.browse(cr, uid, ids, context=context):
datas = {
data = {
'date': line.date,
}
move_ids = obj_model.generate(cr, uid, [line.subscription_id.model_id.id], datas, context)
move_ids = obj_model.generate(cr, uid, [line.subscription_id.model_id.id], data, context)
tocheck[line.subscription_id.id] = True
self.write(cr, uid, [line.id], {'move_id':move_ids[0]})
all_moves.extend(move_ids)
@ -2497,7 +2532,7 @@ class account_account_template(osv.osv):
'reconcile': fields.boolean('Allow Reconciliation', help="Check this option if you want the user to reconcile entries in this account."),
'shortcut': fields.char('Shortcut', size=12),
'note': fields.text('Note'),
'parent_id': fields.many2one('account.account.template', 'Parent Account Template', ondelete='cascade'),
'parent_id': fields.many2one('account.account.template', 'Parent Account Template', ondelete='cascade', domain=[('type','=','view')]),
'child_parent_ids':fields.one2many('account.account.template', 'parent_id', 'Children'),
'tax_ids': fields.many2many('account.tax.template', 'account_account_template_tax_rel', 'account_id', 'tax_id', 'Default Taxes'),
'nocreate': fields.boolean('Optional create', help="If checked, the new chart of accounts will not contain this by default."),
@ -2510,20 +2545,9 @@ class account_account_template(osv.osv):
'nocreate': False,
}
def _check_type(self, cr, uid, ids, context=None):
if context is None:
context = {}
accounts = self.browse(cr, uid, ids, context=context)
for account in accounts:
if account.parent_id and account.parent_id.type != 'view':
return False
return True
_check_recursion = check_cycle
_constraints = [
(_check_recursion, 'Error!\nYou cannot create recursive account templates.', ['parent_id']),
(_check_type, 'Configuration Error!\nYou cannot define children to an account that has internal type other than "View".', ['type']),
]
def name_get(self, cr, uid, ids, context=None):
@ -2755,7 +2779,6 @@ class account_chart_template(osv.osv):
'property_account_income_categ': fields.many2one('account.account.template', 'Income Category Account'),
'property_account_expense': fields.many2one('account.account.template', 'Expense Account on Product Template'),
'property_account_income': fields.many2one('account.account.template', 'Income Account on Product Template'),
'property_reserve_and_surplus_account': fields.many2one('account.account.template', 'Reserve and Profit/Loss Account', domain=[('type', '=', 'payable')], help='This Account is used for transferring Profit/Loss(If It is Profit: Amount will be added, Loss: Amount will be deducted.), Which is calculated from Profilt & Loss Report'),
'property_account_income_opening': fields.many2one('account.account.template', 'Opening Entries Income Account'),
'property_account_expense_opening': fields.many2one('account.account.template', 'Opening Entries Expense Account'),
}
@ -2804,7 +2827,7 @@ class account_tax_template(osv.osv):
'ref_base_sign': fields.float('Base Code Sign', help="Usually 1 or -1."),
'ref_tax_sign': fields.float('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."),
'description': fields.char('Internal Name', size=32),
'description': fields.char('Internal Name'),
'type_tax_use': fields.selection([('sale','Sale'),('purchase','Purchase'),('all','All')], 'Tax Use In', required=True,),
'price_include': fields.boolean('Tax Included in Price', help="Check this if the price you use on the product and invoices includes this tax."),
}
@ -2993,6 +3016,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
_columns = {
'company_id':fields.many2one('res.company', 'Company', required=True),
'currency_id': fields.many2one('res.currency', 'Currency', help="Currency as per company's country."),
'only_one_chart_template': fields.boolean('Only One Chart Template Available'),
'chart_template_id': fields.many2one('account.chart.template', 'Chart Template', required=True),
'bank_accounts_id': fields.one2many('account.bank.accounts.wizard', 'bank_account_id', 'Cash and Banks', required=True),
@ -3003,6 +3027,13 @@ class wizard_multi_charts_accounts(osv.osv_memory):
'purchase_tax_rate': fields.float('Purchase Tax(%)'),
'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
if company_id:
currency_id = self.pool.get('res.company').browse(cr, uid, company_id, context=context).currency_id.id
return {'value': {'currency_id': currency_id}}
def onchange_tax_rate(self, cr, uid, ids, rate=False, context=None):
return {'value': {'purchase_tax_rate': rate or False}}
@ -3033,6 +3064,13 @@ class wizard_multi_charts_accounts(osv.osv_memory):
res.update({'bank_accounts_id': [{'acc_name': _('Cash'), 'account_type': 'cash'},{'acc_name': _('Bank'), 'account_type': 'bank'}]})
if 'company_id' in fields:
res.update({'company_id': self.pool.get('res.users').browse(cr, uid, [uid], context=context)[0].company_id.id})
if 'currency_id' in fields:
company_id = res.get('company_id') or False
if company_id:
company_obj = self.pool.get('res.company')
country_id = company_obj.browse(cr, uid, company_id, context=context).country_id.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})
ids = self.pool.get('account.chart.template').search(cr, uid, [('visible', '=', True)], context=context)
if ids:
@ -3188,7 +3226,6 @@ class wizard_multi_charts_accounts(osv.osv_memory):
('property_account_income_categ','product.category','account.account'),
('property_account_expense','product.template','account.account'),
('property_account_income','product.template','account.account'),
('property_reserve_and_surplus_account','res.company','account.account')
]
template = self.pool.get('account.chart.template').browse(cr, uid, chart_template_id, context=context)
for record in todo_list:
@ -3211,7 +3248,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
property_obj.create(cr, uid, vals, context=context)
return True
def _install_template(self, cr, uid, template_id, company_id, code_digits=None, obj_wizard=None, acc_ref={}, taxes_ref={}, tax_code_ref={}, context=None):
def _install_template(self, cr, uid, template_id, company_id, code_digits=None, obj_wizard=None, acc_ref=None, taxes_ref=None, tax_code_ref=None, context=None):
'''
This function recursively loads the template objects and create the real objects from them.
@ -3229,6 +3266,12 @@ class wizard_multi_charts_accounts(osv.osv_memory):
* a last identical containing the mapping of tax code templates and tax codes
:rtype: tuple(dict, dict, dict)
'''
if acc_ref is None:
acc_ref = {}
if taxes_ref is None:
taxes_ref = {}
if tax_code_ref is None:
tax_code_ref = {}
template = self.pool.get('account.chart.template').browse(cr, uid, template_id, context=context)
if template.parent_id:
tmp1, tmp2, tmp3 = self._install_template(cr, uid, template.parent_id.id, company_id, code_digits=code_digits, acc_ref=acc_ref, taxes_ref=taxes_ref, tax_code_ref=tax_code_ref, context=context)
@ -3241,7 +3284,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
tax_code_ref.update(tmp3)
return acc_ref, taxes_ref, tax_code_ref
def _load_template(self, cr, uid, template_id, company_id, code_digits=None, obj_wizard=None, account_ref={}, taxes_ref={}, tax_code_ref={}, context=None):
def _load_template(self, cr, uid, template_id, company_id, code_digits=None, obj_wizard=None, account_ref=None, taxes_ref=None, tax_code_ref=None, context=None):
'''
This function generates all the objects from the templates
@ -3259,6 +3302,12 @@ class wizard_multi_charts_accounts(osv.osv_memory):
* a last identical containing the mapping of tax code templates and tax codes
:rtype: tuple(dict, dict, dict)
'''
if account_ref is None:
account_ref = {}
if taxes_ref is None:
taxes_ref = {}
if tax_code_ref is None:
tax_code_ref = {}
template = self.pool.get('account.chart.template').browse(cr, uid, template_id, context=context)
obj_tax_code_template = self.pool.get('account.tax.code.template')
obj_acc_tax = self.pool.get('account.tax')
@ -3337,19 +3386,18 @@ class wizard_multi_charts_accounts(osv.osv_memory):
ir_values_obj = self.pool.get('ir.values')
obj_wizard = self.browse(cr, uid, ids[0])
company_id = obj_wizard.company_id.id
self.pool.get('res.company').write(cr, uid, [company_id], {'currency_id': obj_wizard.currency_id.id})
# If the floats for sale/purchase rates have been filled, create templates from them
self._create_tax_templates_from_rates(cr, uid, obj_wizard, company_id, context=context)
# Install all the templates objects and generate the real objects
acc_template_ref, taxes_ref, tax_code_ref = self._install_template(cr, uid, obj_wizard.chart_template_id.id, company_id, code_digits=obj_wizard.code_digits, obj_wizard=obj_wizard, context=context)
# write values of default taxes for product
# write values of default taxes for product as super user
if obj_wizard.sale_tax and taxes_ref:
ir_values_obj.set(cr, uid, key='default', key2=False, name="taxes_id", company=company_id,
models =[('product.product',False)], value=[taxes_ref[obj_wizard.sale_tax.id]])
ir_values_obj.set_default(cr, SUPERUSER_ID, 'product.product', "taxes_id", [taxes_ref[obj_wizard.sale_tax.id]], for_all_users=True, company_id=company_id)
if obj_wizard.purchase_tax and taxes_ref:
ir_values_obj.set(cr, uid, key='default', key2=False, name="supplier_taxes_id", company=company_id,
models =[('product.product',False)], value=[taxes_ref[obj_wizard.purchase_tax.id]])
ir_values_obj.set_default(cr, SUPERUSER_ID, 'product.product', "supplier_taxes_id", [taxes_ref[obj_wizard.purchase_tax.id]], for_all_users=True, company_id=company_id)
# Create Bank journals
self._create_bank_journals_from_o2m(cr, uid, obj_wizard, company_id, acc_template_ref, context=context)

View File

@ -39,7 +39,6 @@ class account_analytic_line(osv.osv):
}
_defaults = {
'date': fields.date.context_today,
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=c),
}
_order = 'date desc'
@ -108,7 +107,7 @@ class account_analytic_line(osv.osv):
if journal_id:
journal = analytic_journal_obj.browse(cr, uid, journal_id, context=context)
if journal.type == 'sale':
product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context)
product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context=context)
if product_price_type_ids:
pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context=context)[0]
# Take the company currency as the reference one

View File

@ -29,12 +29,12 @@ class bank(osv.osv):
'currency_id': fields.related('journal_id', 'currency', type="many2one", relation='res.currency', readonly=True,
string="Currency", help="Currency of the related account journal."),
}
def create(self, cr, uid, data, context={}):
def create(self, cr, uid, data, context=None):
result = super(bank, self).create(cr, uid, data, context=context)
self.post_write(cr, uid, [result], context=context)
return result
def write(self, cr, uid, ids, data, context={}):
def write(self, cr, uid, ids, data, context=None):
result = super(bank, self).write(cr, uid, ids, data, context=context)
self.post_write(cr, uid, ids, context=context)
return result
@ -43,13 +43,17 @@ class bank(osv.osv):
"Return the name to use when creating a bank journal"
return (bank.bank_name or '') + ' ' + bank.acc_number
def _prepare_name_get(self, cr, uid, bank_type_obj, bank_obj, context=None):
"""Add ability to have %(currency_name)s in the format_layout of
res.partner.bank.type"""
bank_obj._data[bank_obj.id]['currency_name'] = bank_obj.currency_id and bank_obj.currency_id.name or ''
return super(bank, self)._prepare_name_get(cr, uid, bank_type_obj, bank_obj, context=context)
def _prepare_name_get(self, cr, uid, bank_dicts, context=None):
"""Add ability to have %(currency_name)s in the format_layout of res.partner.bank.type"""
currency_ids = list(set(data['currency_id'][0] for data in bank_dicts if data['currency_id']))
currencies = self.pool.get('res.currency').browse(cr, uid, currency_ids, context=context)
currency_name = dict((currency.id, currency.name) for currency in currencies)
def post_write(self, cr, uid, ids, context={}):
for data in bank_dicts:
data['currency_name'] = data['currency_id'] and currency_name[data['currency_id'][0]] or ''
return super(bank, self)._prepare_name_get(cr, uid, bank_dicts, context=context)
def post_write(self, cr, uid, ids, context=None):
if isinstance(ids, (int, long)):
ids = [ids]

View File

@ -61,7 +61,7 @@ class account_bank_statement(osv.osv):
return res
def _get_period(self, cr, uid, context=None):
periods = self.pool.get('account.period').find(cr, uid)
periods = self.pool.get('account.period').find(cr, uid,context=context)
if periods:
return periods[0]
return False
@ -123,8 +123,8 @@ class account_bank_statement(osv.osv):
('open','Open'), # used by cash statements
('confirm', 'Closed')],
'Status', 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.'),
help='When new statement is created the status will be \'Draft\'.\n'
'And after getting confirmation from the bank it will be in \'Confirmed\' status.'),
'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.'),
@ -304,7 +304,7 @@ class account_bank_statement(osv.osv):
'date': st_line.date,
'ref': st_line.ref,
'move_id': move_id,
'partner_id': partner_id,
'partner_id': par_id,
'account_id': acc_id,
'credit': credit,
'debit': debit,
@ -430,7 +430,7 @@ class account_bank_statement(osv.osv):
'name': st_number,
'balance_end_real': st.balance_end
}, context=context)
self.message_append_note(cr, uid, [st.id], body=_('Statement %s is confirmed, journal items are created.') % (st_number,), context=context)
self.message_post(cr, uid, [st.id], body=_('Statement %s confirmed, journal items were created.') % (st_number,), context=context)
return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
def button_cancel(self, cr, uid, ids, context=None):
@ -447,20 +447,24 @@ class account_bank_statement(osv.osv):
return self.write(cr, uid, done, {'state':'draft'}, context=context)
def _compute_balance_end_real(self, cr, uid, journal_id, context=None):
cr.execute('SELECT balance_end_real \
FROM account_bank_statement \
WHERE journal_id = %s AND NOT state = %s \
ORDER BY date DESC,id DESC LIMIT 1', (journal_id, 'draft'))
res = cr.fetchone()
res = False
if journal_id:
cr.execute('SELECT balance_end_real \
FROM account_bank_statement \
WHERE journal_id = %s AND NOT state = %s \
ORDER BY date DESC,id DESC LIMIT 1', (journal_id, 'draft'))
res = cr.fetchone()
return res and res[0] or 0.0
def onchange_journal_id(self, cr, uid, statement_id, journal_id, context=None):
if not journal_id:
return {}
balance_start = self._compute_balance_end_real(cr, uid, journal_id, context=context)
journal_data = self.pool.get('account.journal').read(cr, uid, journal_id, ['default_debit_account_id', 'company_id'], context=context)
account_id = journal_data['default_debit_account_id']
journal_data = self.pool.get('account.journal').read(cr, uid, journal_id, ['company_id', 'currency'], context=context)
company_id = journal_data['company_id']
return {'value': {'balance_start': balance_start, 'account_id': account_id, 'company_id': company_id}}
currency_id = journal_data['currency'] or self.pool.get('res.company').browse(cr, uid, company_id[0], context=context).currency_id.id
return {'value': {'balance_start': balance_start, 'company_id': company_id, 'currency': currency_id}}
def unlink(self, cr, uid, ids, context=None):
stat = self.read(cr, uid, ids, ['state'], context=context)
@ -482,6 +486,19 @@ class account_bank_statement(osv.osv):
default['move_line_ids'] = []
return super(account_bank_statement, self).copy(cr, uid, id, default, context=context)
def button_journal_entries(self, cr, uid, ids, context=None):
ctx = (context or {}).copy()
ctx['journal_id'] = self.browse(cr, uid, ids[0], context=context).journal_id.id
return {
'view_type':'form',
'view_mode':'tree',
'res_model':'account.move.line',
'view_id':False,
'type':'ir.actions.act_window',
'domain':[('statement_id','in',ids)],
'context':ctx,
}
account_bank_statement()
class account_bank_statement_line(osv.osv):

View File

@ -15,7 +15,7 @@
<group name="accounting" col="2" colspan="2" attrs="{'invisible': [('company_id','=', False)]}">
<separator string="Accounting Information" colspan="2"/>
<field name="journal_id"/>
<field name="currency_id"/>
<field name="currency_id" groups="base.group_multi_currency"/>
</group>
</group>
</field>
@ -28,7 +28,7 @@
<field name="inherit_id" ref="base.view_partner_bank_tree"/>
<field name="arch" type="xml">
<field name="acc_number" position="after">
<field name="currency_id"/>
<field name="currency_id" groups="base.group_multi_currency"/>
</field>
</field>
</record>

View File

@ -78,7 +78,7 @@ class account_cash_statement(osv.osv):
"""
res = {}
for statement in self.browse(cr, uid, ids, context=context):
if statement.journal_id.type not in ('cash',):
if (statement.journal_id.type not in ('cash',)) or (not statement.journal_id.cash_control):
continue
start = end = 0
for line in statement.details_ids:
@ -194,12 +194,27 @@ class account_cash_statement(osv.osv):
journal = self.pool.get('account.journal').browse(cr, uid, vals['journal_id'], context=context)
if journal and (journal.type == 'cash') and not vals.get('details_ids'):
vals['details_ids'] = []
last_pieces = None
if journal.with_last_closing_balance == True:
domain = [('journal_id', '=', journal.id),
('state', '=', 'confirm')]
last_bank_statement_ids = self.search(cr, uid, domain, limit=1, order='create_date desc', context=context)
if last_bank_statement_ids:
last_bank_statement = self.browse(cr, uid, last_bank_statement_ids[0], context=context)
last_pieces = dict(
(line.pieces, line.number_closing) for line in last_bank_statement.details_ids
)
for value in journal.cashbox_line_ids:
nested_values = {
'number_closing' : 0,
'number_opening' : 0,
'number_opening' : last_pieces.get(value.pieces, 0) if isinstance(last_pieces, dict) else 0,
'pieces' : value.pieces
}
vals['details_ids'].append([0, False, nested_values])
res_id = super(account_cash_statement, self).create(cr, uid, vals, context=context)
@ -274,13 +289,13 @@ class account_cash_statement(osv.osv):
super(account_cash_statement, self).button_confirm_bank(cr, uid, ids, context=context)
absl_proxy = self.pool.get('account.bank.statement.line')
TABLES = (('Profit', 'profit_account_id'), ('Loss', 'loss_account_id'),)
TABLES = ((_('Profit'), 'profit_account_id'), (_('Loss'), 'loss_account_id'),)
for obj in self.browse(cr, uid, ids, context=context):
if obj.difference == 0.0:
continue
for item_label, item_account in TALBES:
for item_label, item_account in TABLES:
if getattr(obj.journal_id, item_account):
raise osv.except_osv(_('Error!'),
_('There is no %s Account on the journal %s.') % (item_label, obj.journal_id.name,))

View File

@ -14,8 +14,12 @@
</footer>
</footer>
<separator string="title" position="replace">
<p class="oe_grey">
Select a configuration package to setup automatically your
taxes and chart of accounts.
</p>
<group>
<field name="charts"/>
<field name="charts" class="oe_inline"/>
</group>
<group string="Configure your Fiscal Year" groups="account.group_account_user">
<field name="has_default_company" invisible="1" />
@ -32,7 +36,7 @@
</record>
<record id="action_account_configuration_installer" model="ir.actions.act_window">
<field name="name">Configure your Chart of Accounts</field>
<field name="name">Configure Accounting Data</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.installer</field>
<field name="view_id" ref="view_account_configuration_installer"/>

View File

@ -185,6 +185,7 @@ class account_invoice(osv.osv):
_columns = {
'name': fields.char('Description', size=64, select=True, readonly=True, states={'draft':[('readonly',False)]}),
'origin': fields.char('Source Document', size=64, help="Reference of the document that produced this invoice.", readonly=True, states={'draft':[('readonly',False)]}),
'supplier_invoice_number': fields.char('Supplier Invoice Number', size=64, help="The reference of this invoice as provided by the supplier.", readonly=True, states={'draft':[('readonly',False)]}),
'type': fields.selection([
('out_invoice','Customer Invoice'),
('in_invoice','Supplier Invoice'),
@ -206,15 +207,15 @@ class account_invoice(osv.osv):
('open','Open'),
('paid','Paid'),
('cancel','Cancelled'),
],'State', select=True, readonly=True,
help=' * The \'Draft\' state is used when a user is encoding a new and unconfirmed Invoice. \
\n* The \'Pro-forma\' when invoice is in Pro-forma state,invoice does not have an invoice number. \
\n* The \'Open\' state is used when user create invoice,a invoice number is generated.Its in open state till user does not pay invoice. \
\n* The \'Paid\' state is set automatically when the invoice is paid. Its related journal entries may or may not be reconciled. \
\n* The \'Cancelled\' state is used when user cancel invoice.'),
],'Status', select=True, readonly=True,
help=' * The \'Draft\' status is used when a user is encoding a new and unconfirmed Invoice. \
\n* The \'Pro-forma\' when invoice is in Pro-forma status,invoice does not have an invoice number. \
\n* The \'Open\' status is used when user create invoice,a invoice number is generated.Its in open status till user does not pay invoice. \
\n* The \'Paid\' status is set automatically when the invoice is paid. Its related journal entries may or may not be reconciled. \
\n* The \'Cancelled\' status is used when user cancel invoice.'),
'sent': fields.boolean('Sent', readonly=True, help="It indicates that the invoice has been sent."),
'date_invoice': fields.date('Invoice Date', readonly=True, states={'draft':[('readonly',False)]}, select=True, help="Keep empty to use the current date"),
'date_due': fields.date('Due Date', states={'paid':[('readonly',True)], 'open':[('readonly',True)], 'close':[('readonly',True)]}, select=True,
'date_due': fields.date('Due Date', readonly=True, states={'draft':[('readonly',False)]}, select=True,
help="If you use payment terms, the due date will be computed automatically at the generation "\
"of accounting entries. If you keep the payment term and the due date empty, it means direct payment. The payment term may compute several due dates, for example 50% now, 50% in one month."),
'partner_id': fields.many2one('res.partner', 'Partner', change_default=True, readonly=True, required=True, states={'draft':[('readonly',False)]}),
@ -253,7 +254,7 @@ class account_invoice(osv.osv):
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'journal_id': fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'company_id': fields.many2one('res.company', 'Company', required=True, change_default=True, readonly=True, states={'draft':[('readonly',False)]}),
'check_total': fields.float('Verification Total', digits_compute=dp.get_precision('Account'), states={'open':[('readonly',True)],'close':[('readonly',True)]}),
'check_total': fields.float('Verification Total', digits_compute=dp.get_precision('Account'), readonly=True, states={'draft':[('readonly',False)]}),
'reconciled': fields.function(_reconciled, string='Paid/Reconciled', type='boolean',
store={
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 50), # Check if we can remove ?
@ -395,18 +396,24 @@ class account_invoice(osv.osv):
template_id = template and template[1] or False
res = mod_obj.get_object_reference(cr, uid, 'mail', 'email_compose_message_wizard_form')
res_id = res and res[1] or False
ctx = dict(context, active_model='account.invoice', active_id=ids[0])
ctx.update({'mail.compose.template_id': template_id})
ctx = dict(context)
ctx.update({
'default_model': 'account.invoice',
'default_res_id': ids[0],
'default_use_template': True,
'default_template_id': template_id,
'default_composition_mode': 'comment',
})
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'mail.compose.message',
'views': [(res_id, 'form')],
'view_id': res_id,
'type': 'ir.actions.act_window',
'target': 'new',
'context': ctx,
'nodestroy': True,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'mail.compose.message',
'views': [(res_id, 'form')],
'view_id': res_id,
'type': 'ir.actions.act_window',
'target': 'new',
'context': ctx,
'nodestroy': True,
}
def confirm_paid(self, cr, uid, ids, context=None):
@ -425,7 +432,7 @@ class account_invoice(osv.osv):
if t['state'] in ('draft', 'cancel') and t['internal_number']== False:
unlink_ids.append(t['id'])
else:
raise osv.except_osv(_('Invalid Action!'), _('You cannot delete an invoice which is open or paid. You should refund it instead.'))
raise osv.except_osv(_('Invalid Action!'), _('You can not delete an invoice which is not cancelled. You should refund it instead.'))
osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
return True
@ -503,8 +510,10 @@ class account_invoice(osv.osv):
if journal_id:
journal = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context)
currency_id = journal.currency and journal.currency.id or journal.company_id.currency_id.id
company_id = journal.company_id.id
result = {'value': {
'currency_id': currency_id,
'company_id': company_id,
}
}
return result
@ -767,17 +776,20 @@ class account_invoice(osv.osv):
if not key in tax_key:
raise osv.except_osv(_('Warning!'), _('Taxes are missing!\nClick on compute button.'))
def compute_invoice_totals(self, cr, uid, inv, company_currency, ref, invoice_move_lines):
def compute_invoice_totals(self, cr, uid, inv, company_currency, ref, invoice_move_lines, context=None):
if context is None:
context={}
total = 0
total_currency = 0
cur_obj = self.pool.get('res.currency')
for i in invoice_move_lines:
if inv.currency_id.id != company_currency:
context.update({'date': inv.date_invoice or time.strftime('%Y-%m-%d')})
i['currency_id'] = inv.currency_id.id
i['amount_currency'] = i['price']
i['price'] = cur_obj.compute(cr, uid, inv.currency_id.id,
company_currency, i['price'],
context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')})
context=context)
else:
i['amount_currency'] = False
i['currency_id'] = False
@ -854,8 +866,11 @@ class account_invoice(osv.osv):
self.check_tax_lines(cr, uid, inv, compute_taxes, ait_obj)
# I disabled the check_total feature
#if inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding/2.0):
# raise osv.except_osv(_('Bad total !'), _('Please verify the price of the invoice !\nThe real total does not match the computed total.'))
group_check_total_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'group_supplier_inv_check_total')[1]
group_check_total = self.pool.get('res.groups').browse(cr, uid, group_check_total_id, context=context)
if group_check_total and uid in [x.id for x in group_check_total.users]:
if (inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding/2.0)):
raise osv.except_osv(_('Bad total !'), _('Please verify the price of the invoice !\nThe encoded total does not match the computed total.'))
if inv.payment_term:
total_fixed = total_percent = 0
@ -887,7 +902,7 @@ class account_invoice(osv.osv):
# create one move line for the total and possibly adjust the other lines amount
total = 0
total_currency = 0
total, total_currency, iml = self.compute_invoice_totals(cr, uid, inv, company_currency, ref, iml)
total, total_currency, iml = self.compute_invoice_totals(cr, uid, inv, company_currency, ref, iml, context=ctx)
acc_id = inv.account_id.id
name = inv['name'] or '/'
@ -969,13 +984,13 @@ class account_invoice(osv.osv):
for i in line:
i[2]['period_id'] = period_id
ctx.update(invoice=inv)
move_id = move_obj.create(cr, uid, move, context=ctx)
new_move_name = move_obj.browse(cr, uid, move_id, context=ctx).name
# make the invoice point to that move
self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id, 'move_name':new_move_name}, context=ctx)
# Pass invoice in context in method post: used if you want to get the same
# account move reference when creating the same invoice after a cancelled one:
ctx.update({'invoice':inv})
move_obj.post(cr, uid, [move_id], context=ctx)
self._log_event(cr, uid, ids)
return True
@ -1045,7 +1060,7 @@ class account_invoice(osv.osv):
if obj_inv.type in ('out_invoice', 'out_refund'):
ctx = self.get_log_context(cr, uid, context=ctx)
message = _("Invoice '%s' is validated.") % name
self.message_append_note(cr, uid, [inv_id], body=message, context=context)
self.message_post(cr, uid, [inv_id], body=message, context=context)
return True
def action_cancel(self, cr, uid, ids, *args):
@ -1095,10 +1110,10 @@ class account_invoice(osv.osv):
if not ids:
return []
types = {
'out_invoice': 'CI: ',
'in_invoice': 'SI: ',
'out_refund': 'OR: ',
'in_refund': 'SR: ',
'out_invoice': 'Invoice ',
'in_invoice': 'Sup. Invoice ',
'out_refund': 'Refund ',
'in_refund': 'Supplier Refund ',
}
return [(r['id'], (r['number']) or types[r['type']] + (r['name'] or '')) for r in self.read(cr, uid, ids, ['type', 'number', 'name'], context, load='_classic_write')]
@ -1127,7 +1142,7 @@ class account_invoice(osv.osv):
return map(lambda x: (0,0,x), lines)
def refund(self, cr, uid, ids, date=None, period_id=None, description=None, journal_id=None):
invoices = self.read(cr, uid, ids, ['name', 'type', 'number', 'reference', 'comment', 'date_due', 'partner_id', 'partner_contact', 'partner_insite', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', 'journal_id'])
invoices = self.read(cr, uid, ids, ['name', 'type', 'number', 'reference', 'comment', 'date_due', 'partner_id', 'partner_contact', 'partner_insite', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', 'journal_id', 'company_id'])
obj_invoice_line = self.pool.get('account.invoice.line')
obj_invoice_tax = self.pool.get('account.invoice.tax')
obj_journal = self.pool.get('account.journal')
@ -1175,7 +1190,7 @@ class account_invoice(osv.osv):
'name': description,
})
# take the id part of the tuple returned for many2one fields
for field in ('partner_id',
for field in ('partner_id', 'company_id',
'account_id', 'currency_id', 'payment_term', 'journal_id'):
invoice[field] = invoice[field] and invoice[field][0]
# create the new invoice
@ -1275,7 +1290,7 @@ class account_invoice(osv.osv):
# TODO: use currency's formatting function
msg = _("Invoice '%s' is paid partially: %s%s of %s%s (%s%s remaining).") % \
(name, pay_amount, code, invoice.amount_total, code, total, code)
self.message_append_note(cr, uid, [inv_id], body=msg, context=context)
self.message_post(cr, uid, [inv_id], body=msg, context=context)
self.pool.get('account.move.line').reconcile_partial(cr, uid, line_ids, 'manual', context)
# Update the stored value (fields.function), so we write to trigger recompute
@ -1288,26 +1303,29 @@ class account_invoice(osv.osv):
def _get_document_type(self, type):
type_dict = {
'out_invoice': 'Customer invoice',
'in_invoice': 'Supplier invoice',
'out_refund': 'Customer Refund',
'in_refund': 'Supplier Refund',
# Translation markers will have no effect at runtime, only used to properly flag export
'out_invoice': _('Customer invoice'),
'in_invoice': _('Supplier invoice'),
'out_refund': _('Customer Refund'),
'in_refund': _('Supplier Refund'),
}
return type_dict.get(type, 'Invoice')
def create_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, [obj.id],body=_("%s <b>created</b>.") % (self._get_document_type(obj.type)), context=context)
self.message_post(cr, uid, [obj.id], body=_("%s <b>created</b>.") % (self._get_document_type(obj.type)),
subtype="account.mt_invoice_new", context=context)
def confirm_paid_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, [obj.id], body=_("%s <b>paid</b>.") % (self._get_document_type(obj.type)), context=context)
self.message_post(cr, uid, [obj.id], body=_("%s <b>paid</b>.") % (self._get_document_type(obj.type)),
subtype="account.mt_invoice_paid", context=context)
def invoice_cancel_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, [obj.id], body=_("%s <b>cancelled</b>.") % (self._get_document_type(obj.type)), context=context)
self.message_post(cr, uid, [obj.id], body=_("%s <b>cancelled</b>.") % (self._get_document_type(obj.type)),
context=context)
account_invoice()
class account_invoice_line(osv.osv):
@ -1346,7 +1364,8 @@ class account_invoice_line(osv.osv):
_description = "Invoice Line"
_columns = {
'name': fields.text('Description', required=True),
'origin': fields.char('Source', 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."),
'sequence': fields.integer('Sequence', help="Gives the sequence of this line when displaying the invoice."),
'invoice_id': fields.many2one('account.invoice', 'Invoice Reference', ondelete='cascade', select=True),
'uos_id': fields.many2one('product.uom', 'Unit of Measure', ondelete='set null'),
'product_id': fields.many2one('product.product', 'Product', ondelete='set null'),
@ -1361,10 +1380,19 @@ class account_invoice_line(osv.osv):
'company_id': fields.related('invoice_id','company_id',type='many2one',relation='res.company',string='Company', store=True, readonly=True),
'partner_id': fields.related('invoice_id','partner_id',type='many2one',relation='res.partner',string='Partner',store=True)
}
def _default_account_id(self, cr, uid, context=None):
# XXX this gets the default account for the user's company,
# it should get the default account for the invoice's company
# however, the invoice's company does not reach this point
prop = self.pool.get('ir.property').get(cr, uid, 'property_account_income_categ', 'product.category', context=context)
return prop and prop.id or False
_defaults = {
'quantity': 1,
'discount': 0.0,
'price_unit': _price_unit_default,
'account_id': _default_account_id,
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
@ -1386,7 +1414,7 @@ class account_invoice_line(osv.osv):
context = {}
company_id = company_id if company_id != None else context.get('company_id',False)
context = dict(context)
context.update({'company_id': company_id})
context.update({'company_id': company_id, 'force_company': company_id})
if not partner_id:
raise osv.except_osv(_('No Partner Defined !'),_("You must first select a partner !") )
if not product:
@ -1473,10 +1501,11 @@ class account_invoice_line(osv.osv):
prod = self.pool.get('product.product').browse(cr, uid, product, context=context)
prod_uom = self.pool.get('product.uom').browse(cr, uid, uom, context=context)
if prod.uom_id.category_id.id != prod_uom.category_id.id:
warning = {
warning = {
'title': _('Warning!'),
'message': _('The selected unit of measure is not compatible with the unit of measure of the product.')
}
}
res['value'].update({'uos_id': prod.uom_id.id})
return {'value': res['value'], 'warning': warning}
return res
@ -1540,16 +1569,19 @@ class account_invoice_line(osv.osv):
def onchange_account_id(self, cr, uid, ids, product_id, partner_id, inv_type, fposition_id, account_id):
if not account_id:
return {}
taxes = self.pool.get('account.account').browse(cr, uid, account_id).tax_ids
unique_tax_ids = []
fpos = fposition_id and self.pool.get('account.fiscal.position').browse(cr, uid, fposition_id) or False
tax_ids = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
product_change_result = self.product_id_change(cr, uid, ids, product_id, False, type=inv_type,
partner_id=partner_id, fposition_id=fposition_id)
unique_tax_ids = set(tax_ids)
if product_change_result and 'value' in product_change_result and 'invoice_line_tax_id' in product_change_result['value']:
unique_tax_ids |= set(product_change_result['value']['invoice_line_tax_id'])
return {'value':{'invoice_line_tax_id': list(unique_tax_ids)}}
account = self.pool.get('account.account').browse(cr, uid, account_id)
if not product_id:
taxes = account.tax_ids
unique_tax_ids = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
else:
product_change_result = self.product_id_change(cr, uid, ids, product_id, False, type=inv_type,
partner_id=partner_id, fposition_id=fposition_id,
company_id=account.company_id.id)
if product_change_result and 'value' in product_change_result and 'invoice_line_tax_id' in product_change_result['value']:
unique_tax_ids = product_change_result['value']['invoice_line_tax_id']
return {'value':{'invoice_line_tax_id': unique_tax_ids}}
account_invoice_line()
@ -1634,14 +1666,13 @@ class account_invoice_tax(osv.osv):
for line in inv.invoice_line:
for tax in tax_obj.compute_all(cr, uid, line.invoice_line_tax_id, (line.price_unit* (1-(line.discount or 0.0)/100.0)), line.quantity, line.product_id, inv.partner_id)['taxes']:
tax['price_unit'] = cur_obj.round(cr, uid, cur, tax['price_unit'])
val={}
val['invoice_id'] = inv.id
val['name'] = tax['name']
val['amount'] = tax['amount']
val['manual'] = False
val['sequence'] = tax['sequence']
val['base'] = tax['price_unit'] * line['quantity']
val['base'] = cur_obj.round(cr, uid, cur, tax['price_unit'] * line['quantity'])
if inv.type in ('out_invoice','in_invoice'):
val['base_code_id'] = tax['base_code_id']

View File

@ -127,7 +127,7 @@
<field name="user_id"/>
<field name="date_due"/>
<field name="origin"/>
<field name="currency_id"/>
<field name="currency_id" groups="base.group_multi_currency"/>
<field name="residual" sum="Residual Amount"/>
<field name="amount_untaxed" sum="Untaxed Amount"/>
<field name="amount_total" sum="Total Amount"/>
@ -143,13 +143,11 @@
<field name="arch" type="xml">
<form string="Supplier Invoice" version="7.0">
<header>
<span groups="base.group_user">
<button name="invoice_open" states="draft,proforma2" string="Validate" class="oe_highlight"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Ask Refund' states='open,paid' />
<button name="invoice_open" states="draft,proforma2" string="Validate" class="oe_highlight" groups="account.group_account_invoice"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Ask Refund' states='open,paid' groups="account.group_account_invoice"/>
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" groups="base.group_no_one"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" groups="account.group_account_invoice"/>
<button name='%(action_account_state_open)d' type='action' string='Re-Open' groups="account.group_account_invoice" attrs="{'invisible':['|', ('state','&lt;&gt;','paid'), ('reconciled', '=', True)]}" help="This button only appears when the state of the invoice is 'paid' (showing that it has been fully reconciled) and auto-computed boolean 'reconciled' is False (depicting that it's not the case anymore). In other words, the invoice has been dereconciled and it does not fit anymore the 'paid' state. You should press this button to re-open it and let it continue its normal process after having resolved the eventual exceptions it may have created."/>
</span>
<field name="state" widget="statusbar" statusbar_visible="draft,open,paid" statusbar_colors='{"proforma":"blue","proforma2":"blue"}'/>
</header>
<sheet string="Supplier Invoice">
@ -171,11 +169,12 @@
domain="[('supplier', '=', True)]"/>
<field name="fiscal_position" widget="selection"/>
<field name="origin"/>
<label for="reference_type"/>
<div>
<field name="supplier_invoice_number"/>
<label for="reference_type"/>
<div>
<field name="reference_type" class="oe_inline oe_edit_only"/>
<field name="reference" class="oe_inline"/>
</div>
</div>
</group>
<group>
<field name="date_invoice"/>
@ -184,38 +183,45 @@
name="account_id" groups="account.group_account_user"/>
<field name="journal_id" groups="account.group_account_user"
on_change="onchange_journal_id(journal_id, context)" widget="selection"/>
<field name="currency_id"/>
<field name="currency_id" groups="base.group_multi_currency"/>
<field name="check_total" groups="account.group_supplier_inv_check_total"/>
</group>
</group>
<notebook>
<page string="Invoice">
<field context="{'partner_id': partner_id, 'price_type': 'price_type' in dir() and 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">
<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)"/>
<field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id" on_change="onchange_account_id(product_id,parent.partner_id,parent.type,parent.fiscal_position,account_id)" groups="base.group_account_user"/>
<field name="invoice_line_tax_id" view_mode="2" context="{'type':parent.type}" domain="[('parent_id','=',False)]"/>
<field domain="[('type','&lt;&gt;','view'), ('company_id', '=', parent.company_id), ('parent_id', '!=', False)]" name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
<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)"/>
<field name="name"/>
<field name="company_id" groups="base.group_multi_company" readonly="1"/>
<field name="account_id" groups="account.group_account_user"
domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '!=', 'view')]"
on_change="onchange_account_id(product_id, parent.partner_id, parent.type, parent.fiscal_position,account_id)"/>
<field name="account_analytic_id" groups="analytic.group_analytic_accounting"
domain="[('type','!=','view'), ('company_id', '=', parent.company_id), ('parent_id', '!=', False)]"/>
<field name="quantity"/>
<field name="uos_id" groups="product.group_uom"
on_change="uos_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="price_unit"/>
<field name="discount" groups="sale.group_discount_per_so_line"/>
<field name="invoice_line_tax_id" widget="many2many_tags" context="{'type':parent.type}"
domain="[('parent_id','=',False),('company_id', '=', parent.company_id)]"/>
<field name="price_subtotal"/>
<field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id" on_change="onchange_account_id(product_id,parent.partner_id,parent.type,parent.fiscal_position,account_id)" invisible="1"/>
<!-- Removed if subtotal is set -->
<field name="name" invisible="1"/>
<field name="uos_id" invisible="1"/>
</tree>
</field>
<group class="oe_subtotal_footer oe_right">
<field name="amount_untaxed"/>
<field name="amount_untaxed" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<div>
<label for="amount_tax"/>
<button name="button_reset_taxes" states="draft,proforma2"
string="(update)" class="oe_link oe_edit_only"
type="object" help="Recompute taxes and total"/>
</div>
<field name="amount_tax" nolabel="1"/>
<field name="amount_total" class="oe_subtotal_footer_separator"/>
<field name="amount_tax" nolabel="1" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="amount_total" class="oe_subtotal_footer_separator" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="residual"/>
<field name="residual" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="reconciled" invisible="1"/>
</group>
<div style="width: 50%%">
@ -265,15 +271,15 @@
<field name="debit"/>
<field name="credit"/>
<field name="amount_currency"/>
<field name="currency_id"/>
<field name="currency_id" groups="base.group_multi_currency"/>
</tree>
</field>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_ids" widget="mail_thread"/>
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
@ -285,20 +291,18 @@
<field name="arch" type="xml">
<form string="Invoice" version="7.0">
<header>
<span groups="base.group_user">
<button name="action_invoice_sent" type="object" string="Send by Email" attrs="{'invisible':['|',('sent','=',True), ('state', '!=', 'open')]}" class="oe_highlight"/>
<button name="invoice_print" string="Print Invoice" type="object" attrs="{'invisible':['|',('sent','=',True), ('state', '!=', 'open')]}" class="oe_highlight"/>
<button name="action_invoice_sent" type="object" string="Send by Email" attrs="{'invisible':['|',('sent','=',False), ('state', '!=', 'open')]}"/>
<button name="invoice_print" string="Print Invoice" type="object" attrs="{'invisible':['|',('sent','=',False), ('state', '!=', 'open')]}"/>
<button name="invoice_open" states="draft" string="Validate" class="oe_highlight"/>
<button name="invoice_open" states="proforma2" string="Validate"/>
<button name="invoice_proforma2" states="draft" string="PRO-FORMA" groups="account.group_proforma_invoices"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Refund Invoice' states='paid'/>
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" groups="base.group_no_one"/>
<button name="action_cancel_draft" states="cancel" string="Reset to Draft" type="object"/>
<button name='%(action_account_state_open)d' type='action' string='Re-Open' groups="account.group_account_invoice" attrs="{'invisible':['|', ('state','&lt;&gt;','paid'), ('reconciled', '=', True)]}" help="This button only appears when the state of the invoice is 'paid' (showing that it has been fully reconciled) and auto-computed boolean 'reconciled' is False (depicting that it's not the case anymore). In other words, the invoice has been dereconciled and it does not fit anymore the 'paid' state. You should press this button to re-open it and let it continue its normal process after having resolved the eventual exceptions it may have created."/>
<!--button name="%(account_invoices)d" string="Print Invoice" type="action" states="open,paid,proforma,sale,proforma2"/-->
</span>
<button name="action_invoice_sent" type="object" string="Send by Email" attrs="{'invisible':['|',('sent','=',True), ('state', '!=', 'open')]}" class="oe_highlight" groups="base.group_user"/>
<button name="invoice_print" string="Print Invoice" type="object" attrs="{'invisible':['|',('sent','=',True), ('state', '!=', 'open')]}" class="oe_highlight" groups="base.group_user"/>
<button name="action_invoice_sent" type="object" string="Send by Email" attrs="{'invisible':['|',('sent','=',False), ('state', '!=', 'open')]}" groups="base.group_user"/>
<button name="invoice_print" string="Print Invoice" type="object" attrs="{'invisible':['|',('sent','=',False), ('state', '!=', 'open')]}" groups="base.group_user"/>
<button name="invoice_open" states="draft" string="Validate" class="oe_highlight" groups="base.group_user"/>
<button name="invoice_open" states="proforma2" string="Validate" groups="base.group_user"/>
<button name="invoice_proforma2" states="draft" string="PRO-FORMA" groups="account.group_proforma_invoices"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Refund Invoice' states='open,proforma2,paid' groups="base.group_user"/>
<button name="invoice_cancel" states="draft,proforma2,open" string="Cancel" groups="base.group_no_one"/>
<button name="action_cancel_draft" states="cancel" string="Reset to Draft" type="object" groups="base.group_user"/>
<button name='%(action_account_state_open)d' type='action' string='Re-Open' groups="account.group_account_invoice" attrs="{'invisible':['|', ('state','&lt;&gt;','paid'), ('reconciled', '=', True)]}" help="This button only appears when the state of the invoice is 'paid' (showing that it has been fully reconciled) and auto-computed boolean 'reconciled' is False (depicting that it's not the case anymore). In other words, the invoice has been dereconciled and it does not fit anymore the 'paid' state. You should press this button to re-open it and let it continue its normal process after having resolved the eventual exceptions it may have created."/>
<!--button name="%(account_invoices)d" string="Print Invoice" type="action" states="open,paid,proforma,sale,proforma2"/-->
<field name="state" widget="statusbar" nolabel="1" statusbar_visible="draft,open,paid" statusbar_colors='{"proforma":"blue","proforma2":"blue"}'/>
</header>
<sheet string="Invoice">
@ -316,7 +320,7 @@
<field string="Customer" name="partner_id"
on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)"
groups="base.group_user" context="{'search_default_customer':1, 'show_address': 1}"
options='{"always_reload": true}'/>
options='{"always_reload": True}'/>
<field name="fiscal_position" widget="selection" />
</group>
<group>
@ -326,8 +330,8 @@
<field domain="[('company_id', '=', company_id),('type','=', 'receivable')]"
name="account_id" groups="account.group_account_user"/>
<label for="currency_id"/>
<div>
<label for="currency_id" groups="base.group_multi_currency"/>
<div groups="base.group_multi_currency">
<field name="currency_id" class="oe_inline"/>
<!-- note fp: I don't think we need this feature ?
<button name="%(action_account_change_currency)d" type="action"
@ -342,31 +346,36 @@
<page string="Invoice Lines">
<field name="invoice_line" nolabel="1" widget="one2many_list" context="{'type': type}">
<tree string="Invoice Lines" editable="bottom">
<field name="invoice_line_tax_id" invisible="1"/>
<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)"/>
<field name="name"/>
<field name="company_id" groups="base.group_multi_company" readonly="1"/>
<field name="account_id" groups="account.group_account_user"
domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]"
domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '!=', 'view')]"
on_change="onchange_account_id(product_id, parent.partner_id, parent.type, parent.fiscal_position,account_id)"/>
<field name="account_analytic_id" groups="analytic.group_analytic_accounting"
domain="[('type','!=','view'), ('company_id', '=', parent.company_id), ('parent_id', '!=', False)]"/>
<field name="quantity"/>
<field name="uos_id" groups="product.group_uom"
on_change="uos_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="price_unit"/>
<field name="discount" groups="sale.group_discount_per_so_line"/>
<field name="invoice_line_tax_id" widget="many2many_tags" context="{'type':parent.type}"
domain="[('parent_id','=',False),('company_id', '=', parent.company_id)]"/>
<field name="price_subtotal"/>
</tree>
</field>
<group class="oe_subtotal_footer oe_right">
<field name="amount_untaxed"/>
<field name="amount_untaxed" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<div>
<label for="amount_tax"/>
<button name="button_reset_taxes" states="draft,proforma2"
string="(update)" class="oe_link oe_edit_only"
type="object" help="Recompute taxes and total"/>
</div>
<field name="amount_tax" nolabel="1"/>
<field name="amount_total" class="oe_subtotal_footer_separator"/>
<field name="residual" groups="account.group_account_user"/>
<field name="amount_tax" nolabel="1" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="amount_total" class="oe_subtotal_footer_separator" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="residual" groups="account.group_account_user" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="reconciled" invisible="1"/>
</group>
<group>
@ -418,16 +427,16 @@
<field name="journal_id" groups="base.group_user"/>
<field name="debit"/>
<field name="credit"/>
<field name="amount_currency"/>
<field name="currency_id"/>
<field name="amount_currency" groups="base.group_multi_currency"/>
<field name="currency_id" groups="base.group_multi_currency"/>
</tree>
</field>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_ids" colspan="4" widget="mail_thread" nolabel="1"/>
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread" placeholder="Share a note..."/>
</div>
</form>
</field>
@ -438,7 +447,7 @@
<field name="model">account.invoice</field>
<field name="arch" type="xml">
<search string="Search Invoice">
<field name="number" string="Invoice" filter_domain="['|', ('number','ilike',self),('origin','ilike',self)]"/>
<field name="number" string="Invoice" filter_domain="['|','|', ('number','ilike',self), ('origin','ilike',self), ('supplier_invoice_number', 'ilike', self)]"/>
<filter name="draft" icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Invoices"/>
<filter name="proforma" icon="terp-gtk-media-pause" string="Proforma" domain="[('state','=','proforma2')]" help="Proforma Invoices" groups="account.group_proforma_invoices"/>
<filter name="invoices" icon="terp-dolar" string="Invoices" domain="[('state','not in',['draft','cancel'])]" help="Proforma/Open/Paid Invoices"/>
@ -447,7 +456,6 @@
<filter domain="[('user_id','=',uid)]" help="My Invoices" icon="terp-personal"/>
<field name="partner_id"/>
<field name="user_id" string="Salesperson"/>
<field name="journal_id"/>
<field name="period_id" string="Period"/>
<group expand="0" string="Group By...">
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>

View File

@ -30,7 +30,7 @@
<menuitem id="menu_analytic" parent="menu_analytic_accounting" name="Accounts" groups="analytic.group_analytic_accounting"/>
<menuitem id="menu_journals" sequence="15" name="Journals" parent="menu_finance_configuration" groups="group_account_manager"/>
<menuitem id="menu_configuration_misc" name="Miscellaneous" parent="menu_finance_configuration" sequence="55"/>
<menuitem id="base.menu_action_currency_form" parent="menu_configuration_misc" sequence="20" groups="base.group_no_one"/>
<menuitem id="base.menu_action_currency_form" name="Currencies" parent="menu_configuration_misc" sequence="20" groups="base.group_no_one"/>
<menuitem id="menu_finance_generic_reporting" name="Generic Reporting" parent="menu_finance_reports" sequence="100"/>
<menuitem id="menu_finance_entries" name="Journal Entries" parent="menu_finance" sequence="5" groups="group_account_user,group_account_manager"/>
<menuitem id="menu_account_reports" name="Financial Reports" parent="menu_finance_configuration" sequence="30" />
@ -44,7 +44,7 @@
<menuitem id="menu_finance_periodical_processing_billing" name="Billing" parent="menu_finance_periodical_processing" sequence="35"/>
<menuitem id="next_id_22" name="Partners" parent="menu_finance_generic_reporting" sequence="1"/>
<menuitem id="menu_multi_currency" name="Multi-Currencies" parent="menu_finance_generic_reporting" sequence="10"/>
<menuitem id="menu_multi_currency" name="Multi-Currencies" parent="menu_finance_generic_reporting" sequence="10" groups="base.group_multi_currency"/>
<menuitem
parent="account.menu_finance_legal_statement"
id="final_accounting_reports"

View File

@ -208,15 +208,17 @@ class account_move_line(osv.osv):
if type(period_id) == str:
ids = period_obj.search(cr, uid, [('name', 'ilike', period_id)])
context.update({
'period_id': ids[0]
'period_id': ids and ids[0] or False
})
return context
def _default_get(self, cr, uid, fields, context=None):
if context is None:
context = {}
if not context.get('journal_id', False) and context.get('search_default_journal_id', False):
if not context.get('journal_id', False):
context['journal_id'] = context.get('search_default_journal_id')
if not context.get('period_id', False):
context['period_id'] = context.get('search_default_period_id')
account_obj = self.pool.get('account.account')
period_obj = self.pool.get('account.period')
journal_obj = self.pool.get('account.journal')
@ -226,6 +228,9 @@ class account_move_line(osv.osv):
partner_obj = self.pool.get('res.partner')
currency_obj = self.pool.get('res.currency')
context = self.convert_to_period(cr, uid, context)
#pass the right context when search_defaul_journal_id
if context.get('search_default_journal_id',False):
context['journal_id'] = context.get('search_default_journal_id')
# Compute simple values
data = super(account_move_line, self).default_get(cr, uid, fields, context=context)
# Starts: Manual entry from account.move form
@ -480,7 +485,7 @@ class account_move_line(osv.osv):
'debit': fields.float('Debit', digits_compute=dp.get_precision('Account')),
'credit': fields.float('Credit', digits_compute=dp.get_precision('Account')),
'account_id': fields.many2one('account.account', 'Account', required=True, ondelete="cascade", domain=[('type','<>','view'), ('type', '<>', 'closed')], select=2),
'move_id': fields.many2one('account.move', 'Move', ondelete="cascade", help="The move of this entry line.", select=2, required=True),
'move_id': fields.many2one('account.move', 'Journal Entry', ondelete="cascade", help="The move of this entry line.", select=2, required=True),
'narration': fields.related('move_id','narration', type='text', relation='account.move', string='Internal Note'),
'ref': fields.related('move_id', 'ref', string='Reference', type='char', size=64, store=True),
'statement_id': fields.many2one('account.bank.statement', 'Statement', help="The bank statement used for bank reconciliation", select=1),
@ -509,8 +514,7 @@ class account_move_line(osv.osv):
'analytic_lines': fields.one2many('account.analytic.line', 'move_id', 'Analytic lines'),
'centralisation': fields.selection([('normal','Normal'),('credit','Credit Centralisation'),('debit','Debit Centralisation'),('currency','Currency Adjustment')], 'Centralisation', size=8),
'balance': fields.function(_balance, fnct_search=_balance_search, string='Balance'),
'state': fields.selection([('draft','Unbalanced'), ('valid','Valid')], 'Status', readonly=True,
help='When new move line is created the state will be \'Draft\'.\n* When all the payments are done it will be in \'Valid\' state.'),
'state': fields.selection([('draft','Unbalanced'), ('valid','Balanced')], 'Status', readonly=True),
'tax_code_id': fields.many2one('account.tax.code', 'Tax Account', help="The Account can either be a base tax code or a tax code account."),
'tax_amount': fields.float('Tax/Base Amount', digits_compute=dp.get_precision('Account'), select=True, help="If the Tax account is a tax code account, this field will contain the taxed amount.If the tax account is base tax code, "\
"this field will contain the basic amount(without tax)."),
@ -557,6 +561,7 @@ class account_move_line(osv.osv):
'journal_id': lambda self, cr, uid, c: c.get('journal_id', False),
'credit': 0.0,
'debit': 0.0,
'amount_currency': 0.0,
'account_id': lambda self, cr, uid, c: c.get('account_id', False),
'period_id': lambda self, cr, uid, c: c.get('period_id', False),
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.move.line', context=c)
@ -577,7 +582,7 @@ class account_move_line(osv.osv):
lines = self.browse(cr, uid, ids, context=context)
for l in lines:
if l.account_id.type == 'view':
raise osv.except_osv(_('Error!'), _('You cannot create journal items on “View” type account %s %s.') % (l.account_id.code, l.account_id.name))
return False
return True
def _check_no_closed(self, cr, uid, ids, context=None):
@ -703,7 +708,9 @@ class account_move_line(osv.osv):
context = {}
if context and context.get('next_partner_only', False):
if not context.get('partner_id', False):
partner = self.get_next_partner_only(cr, uid, offset, context)
partner = self.list_partners_to_reconcile(cr, uid, context=context)
if partner:
partner = partner[0]
else:
partner = context.get('partner_id', False)
if not partner:
@ -711,26 +718,26 @@ class account_move_line(osv.osv):
args.append(('partner_id', '=', partner[0]))
return super(account_move_line, self).search(cr, uid, args, offset, limit, order, context, count)
def get_next_partner_only(self, cr, uid, offset=0, context=None):
def list_partners_to_reconcile(self, cr, uid, context=None):
cr.execute(
"""
SELECT p.id
FROM res_partner p
RIGHT JOIN (
SELECT l.partner_id AS partner_id, SUM(l.debit) AS debit, SUM(l.credit) AS credit
SELECT partner_id
FROM (
SELECT l.partner_id, p.last_reconciliation_date, SUM(l.debit) AS debit, SUM(l.credit) AS credit
FROM account_move_line l
LEFT JOIN account_account a ON (a.id = l.account_id)
LEFT JOIN res_partner p ON (l.partner_id = p.id)
RIGHT JOIN account_account a ON (a.id = l.account_id)
RIGHT JOIN res_partner p ON (l.partner_id = p.id)
WHERE a.reconcile IS TRUE
AND l.reconcile_id IS NULL
AND (p.last_reconciliation_date IS NULL OR l.date > p.last_reconciliation_date)
AND l.state <> 'draft'
GROUP BY l.partner_id
) AS s ON (p.id = s.partner_id)
GROUP BY l.partner_id, p.last_reconciliation_date
) AS s
WHERE debit > 0 AND credit > 0
ORDER BY p.last_reconciliation_date LIMIT 1 OFFSET %s""", (offset, )
)
return cr.fetchone()
ORDER BY last_reconciliation_date""")
ids = cr.fetchall()
ids = len(ids) and [x[0] for x in ids] or []
return self.pool.get('res.partner').name_get(cr, uid, ids, context=context)
def reconcile_partial(self, cr, uid, ids, type='auto', context=None, writeoff_acc_id=False, writeoff_period_id=False, writeoff_journal_id=False):
move_rec_obj = self.pool.get('account.move.reconcile')
@ -910,8 +917,8 @@ class account_move_line(osv.osv):
if lines and lines[0]:
partner_id = lines[0].partner_id and lines[0].partner_id.id or False
if partner_id and context and context.get('stop_reconcile', False):
partner_obj.write(cr, uid, [partner_id], {'last_reconciliation_date': time.strftime('%Y-%m-%d %H:%M:%S')})
if partner_id and not partner_obj.has_something_to_reconcile(cr, uid, partner_id, context=context):
partner_obj.mark_as_reconciled(cr, uid, [partner_id], context=context)
return r_id
def view_header_get(self, cr, user, view_id, view_type, context=None):
@ -926,6 +933,8 @@ class account_move_line(osv.osv):
return res
if (not context.get('journal_id', False)) or (not context.get('period_id', False)):
return False
if context.get('search_default_journal_id', False):
context['journal_id'] = context.get('search_default_journal_id')
cr.execute('SELECT code FROM account_journal WHERE id = %s', (context['journal_id'], ))
j = cr.fetchone()[0] or ''
cr.execute('SELECT code FROM account_period WHERE id = %s', (context['period_id'], ))
@ -966,7 +975,7 @@ class account_move_line(osv.osv):
if context is None:
context = {}
result = super(account_move_line, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar, submenu=submenu)
if view_type != 'tree':
if (view_type != 'tree') or view_id:
#Remove the toolbar from the form view
if view_type == 'form':
if result.get('toolbar', False):
@ -1095,7 +1104,7 @@ class account_move_line(osv.osv):
'has been confirmed.') % res[2])
return res
def _remove_move_reconcile(self, cr, uid, move_ids=[], context=None):
def _remove_move_reconcile(self, cr, uid, move_ids=None, context=None):
# Function remove move rencocile ids related with moves
obj_move_line = self.pool.get('account.move.line')
obj_move_rec = self.pool.get('account.move.reconcile')
@ -1184,12 +1193,12 @@ class account_move_line(osv.osv):
jour_period_obj = self.pool.get('account.journal.period')
cr.execute('SELECT state FROM account_journal_period WHERE journal_id = %s AND period_id = %s', (journal_id, period_id))
result = cr.fetchall()
journal = journal_obj.browse(cr, uid, journal_id, context=context)
period = period_obj.browse(cr, uid, period_id, context=context)
for (state,) in result:
if state == 'done':
raise osv.except_osv(_('Error!'), _('You cannot add/modify entries in a closed journal.'))
raise osv.except_osv(_('Error !'), _('You can not add/modify entries in a closed period %s of journal %s.' % (period.name,journal.name)))
if not result:
journal = journal_obj.browse(cr, uid, journal_id, context=context)
period = period_obj.browse(cr, uid, period_id, context=context)
jour_period_obj.create(cr, uid, {
'name': (journal.code or journal.name)+':'+(period.name or ''),
'journal_id': journal.id,
@ -1225,16 +1234,16 @@ class account_move_line(osv.osv):
vals['company_id'] = company_id[0]
if ('account_id' in vals) and not account_obj.read(cr, uid, vals['account_id'], ['active'])['active']:
raise osv.except_osv(_('Bad Account!'), _('You cannot use an inactive account.'))
if 'journal_id' in vals:
if 'journal_id' in vals and vals['journal_id']:
context['journal_id'] = vals['journal_id']
if 'period_id' in vals:
if 'period_id' in vals and vals['period_id']:
context['period_id'] = vals['period_id']
if ('journal_id' not in context) and ('move_id' in vals) and vals['move_id']:
m = move_obj.browse(cr, uid, vals['move_id'])
context['journal_id'] = m.journal_id.id
context['period_id'] = m.period_id.id
#we need to treat the case where a value is given in the context for period_id as a string
if 'period_id' not in context or not isinstance(context.get('period_id', ''), (int, long)):
if 'period_id' in context and not isinstance(context.get('period_id', ''), (int, long)):
period_candidate_ids = self.pool.get('account.period').name_search(cr, uid, name=context.get('period_id',''))
if len(period_candidate_ids) != 1:
raise osv.except_osv(_('Error!'), _('No period found or more than one period found for the given date.'))
@ -1244,6 +1253,9 @@ class account_move_line(osv.osv):
self._update_journal_check(cr, uid, context['journal_id'], context['period_id'], context)
move_id = vals.get('move_id', False)
journal = journal_obj.browse(cr, uid, context['journal_id'], context=context)
vals['journal_id'] = vals.get('journal_id') or context.get('journal_id')
vals['period_id'] = vals.get('period_id') or context.get('period_id')
vals['date'] = vals.get('date') or context.get('date')
if not move_id:
if journal.centralisation:
#Check for centralisation

View File

@ -41,13 +41,5 @@
groups="group_account_user,group_account_manager"
parent="account.menu_finance_generic_reporting" sequence="3"/>
<report id="account_account_balance_landscape"
string="Account balance"
model="account.account"
name="account.account.balance.landscape"
rml="account/report/account_balance_landscape.rml"
auto="False"
menu="False"/>
</data>
</openerp>

View File

@ -101,28 +101,29 @@
<field name="model">account.period</field>
<field name="arch" type="xml">
<form string="Account Period" version="7.0">
<header>
<button name="action_draft" states="done" string="Set to Draft" type="object" groups="account.group_account_manager"/>
<field name="state" widget="statusbar" nolabel="1"/>
</header>
<sheet>
<group>
<group>
<field name="name"/>
<field name="fiscalyear_id" widget="selection"/>
<label for="date_start" string="Duration"/>
<div>
<field name="date_start" class="oe_inline" nolabel="1"/> -
<field name="date_stop" nolabel="1" class="oe_inline"/>
</div>
</group>
<group>
<field name="code"/>
<field name="special"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</group>
</group>
</sheet>
<header>
<button string="Close Period" name="%(account.action_account_period_close)d" type="action" class="oe_highlight" states="draft"/>
<button name="action_draft" states="done" string="Set to Draft" type="object" groups="account.group_account_manager"/>
<field name="state" widget="statusbar" nolabel="1"/>
</header>
<sheet>
<group>
<group>
<field name="name"/>
<field name="fiscalyear_id" widget="selection"/>
<label for="date_start" string="Duration"/>
<div>
<field name="date_start" class="oe_inline" nolabel="1"/> -
<field name="date_stop" nolabel="1" class="oe_inline"/>
</div>
</group>
<group>
<field name="code"/>
<field name="special"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
@ -181,7 +182,7 @@
<form string="Account" version="7.0">
<label for="code" class="oe_edit_only" string="Account Code and Name"/>
<h1>
<field name="code" class="oe_inline" placeholder="Account code" style="width: 6em"/> -
<field name="code" class="oe_inline" placeholder="Account code" style="width: 6em"/> -
<field name="name" class="oe_inline" placeholder="Account name"/>
</h1>
<group>
@ -204,7 +205,7 @@
attrs="{'invisible':[('type','!=','consolidation')]}"
widget="many2many_tags"/>
</group>
<group>
<group groups="base.group_multi_currency">
<field name="currency_id"/>
<field name="currency_mode" attrs="{'readonly': [('currency_id','=',False)]}"/>
</group>
@ -252,16 +253,6 @@
</tree>
</field>
</record>
<record id="view_treasory_graph" model="ir.ui.view">
<field name="name">account.treasury.graph</field>
<field name="model">account.account</field>
<field name="arch" type="xml">
<graph string="Treasury Analysis" type="bar">
<field name="name"/>
<field name="balance" operator="+"/>
</graph>
</field>
</record>
<record id="action_account_form" model="ir.actions.act_window">
<field name="name">Accounts</field>
<field name="res_model">account.account</field>
@ -311,11 +302,11 @@
<field name="domain">[('parent_id','=',False)]</field>
</record>
<record id="view_account_gain_loss_tree" model="ir.ui.view">
<record id="view_account_gain_loss_tree" model="ir.ui.view">
<field name="name">Unrealized Gain or Loss</field>
<field name="model">account.account</field>
<field name="arch" type="xml">
<tree string="Unrealized Gains and losses">
<tree string="Unrealized Gains and losses" create="false">
<field name="code"/>
<field name="name"/>
<field name="parent_id" invisible="1"/>
@ -331,7 +322,7 @@
</field>
</record>
<record id="action_account_gain_loss" model="ir.actions.act_window">
<record id="action_account_gain_loss" model="ir.actions.act_window">
<field name="name">Unrealized Gain or Loss</field>
<field name="res_model">account.account</field>
<field name="view_type">form</field>
@ -489,7 +480,7 @@
<group>
<field name="default_debit_account_id" attrs="{'required':[('type','in', ('cash', 'bank'))]}" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="default_credit_account_id" attrs="{'required':[('type','in',('cash', 'bank'))]}" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="currency"/>
<field name="currency" groups="base.group_multi_currency"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
</group>
@ -515,19 +506,20 @@
<separator colspan="4" string="Accounts Allowed (empty for no control)"/>
<field colspan="4" name="account_control_ids" nolabel="1"/>
</page>
<page string="Cash Registers" attrs="{'invisible':[('type', '!=', 'cash')]}">
<page string="Cash Registers">
<group>
<group string="Accounts">
<field name="profit_account_id"/>
<field name="loss_account_id"/>
<field name="profit_account_id" domain="[('type','!=','view')]"/>
<field name="loss_account_id" domain="[('type','!=','view')]"/>
<field name="internal_account_id"/>
</group>
<group string="Miscellaneous">
<field name="with_last_closing_balance"/>
<field name="cash_control"/>
</group>
</group>
<separator string="Available Coins" colspan="4" />
<field name="cashbox_line_ids" nolabel="1" string="Unit Of Currency Definition" colspan="4">
<separator string="Available Coins" colspan="4" attrs="{'invisible' : [('cash_control', '=', False)] }"/>
<field name="cashbox_line_ids" nolabel="1" string="Unit Of Currency Definition" colspan="4" attrs="{'invisible' : [('cash_control', '=', False)]}">
<tree string="CashBox Lines" editable="bottom">
<field name="pieces" />
</tree>
@ -641,13 +633,10 @@
<field name="period_id" class="oe_inline"/>
</div>
<field name='company_id' widget="selection" groups="base.group_multi_company" />
<field name="currency" invisible="1"/>
</group><group>
<label for="balance_start"/>
<div>
<field name="balance_start" class="oe_inline"/>
<field name="currency" class="oe_inline"/>
</div>
<field name="balance_end_real"/>
<field name="balance_start" widget="monetary" options='{"currency_field" : "currency"}'/>
<field name="balance_end_real" widget="monetary" options='{"currency_field" : "currency"}'/>
</group>
</group>
@ -661,7 +650,7 @@
<field name="ref"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
<field name="type" on_change="onchange_type(partner_id, type)"/>
<field domain="[('journal_id','=',parent.journal_id), ('company_id', '=', parent.company_id)]" name="account_id"/>
<field name="account_id" options='{"no_open":True}' domain="[('journal_id','=',parent.journal_id), ('company_id', '=', parent.company_id)]"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/>
<field name="amount"/>
</tree>
@ -672,7 +661,7 @@
<field name="ref"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
<field name="type" on_change="onchange_type(partner_id, type)"/>
<field domain="[('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view'), ('company_id', '=', parent.company_id)]" name="account_id"/>
<field name="account_id" domain="[('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view'), ('company_id', '=', parent.company_id)]"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/>
<field name="amount"/>
<field name="sequence" readonly="0"/>
@ -682,15 +671,24 @@
</form>
</field>
</page>
<page string="Journal Entries" name="move_live_ids">
<field name="move_line_ids"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="view_bank_statement_form_journal_items" model="ir.ui.view">
<field name="name">account.bank.statement.journal.items.form.inherit</field>
<field name="model">account.bank.statement</field>
<field name="inherit_id" ref="view_bank_statement_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='import_buttons']" position="inside">
<button name="button_journal_entries"
string="Journal Items" type="object"
attrs="{'invisible':[('state','!=','confirm')]}"/>
</xpath>
</field>
</record>
<record id="action_bank_statement_tree" model="ir.actions.act_window">
<field name="name">Bank Statements</field>
@ -1047,6 +1045,25 @@
Entries lines
-->
<record id="view_move_line_tree_reconcile" model="ir.ui.view">
<field name="model">account.move.line</field>
<field eval="24" name="priority"/>
<field name="arch" type="xml">
<tree_account_reconciliation colors="red:state == 'draft';black:state == 'valid'" string="Journal Items to Reconcile" create="false" version="7.0">
<field name="date"/>
<field name="move_id"/>
<field name="ref"/>
<field name="name"/>
<field name="partner_id"/>
<field name="account_id"/>
<field name="reconcile_partial_id"/>
<field name="state" invisible="1"/>
<field name="debit" sum="Total debit"/>
<field name="credit" sum="Total credit"/>
</tree_account_reconciliation>
</field>
</record>
<record id="view_move_line_tree" model="ir.ui.view">
<field name="name">account.move.line.tree</field>
<field name="model">account.move.line</field>
@ -1067,10 +1084,10 @@
<field name="account_tax_id"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('parent_id','!=',False)]"/>
<field name="amount_currency" attrs="{'readonly':[('state','=','valid')]}"/>
<field name="currency_id" attrs="{'readonly':[('state','=','valid')]}"/>
<field name="currency_id" attrs="{'readonly':[('state','=','valid')]}" groups="base.group_multi_currency"/>
<field name="reconcile_partial_id"/>
<field name="reconcile_id"/>
<field name="state"/>
<field name="state" invisible="1"/>
</tree>
</field>
</record>
@ -1081,65 +1098,65 @@
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<form string="Journal Item" version="7.0">
<sheet>
<group>
<group>
<field name="name"/>
<field name="ref"/>
<field name="partner_id" on_change="onchange_partner_id(False,partner_id,account_id,debit,credit,date)"/>
</group>
<group>
<field name="journal_id"/>
<field name="period_id"/>
<field name="company_id" required="1" groups="base.group_multi_company"/>
</group>
</group>
<notebook colspan="4">
<page string="Information">
<group>
<group string="Amount">
<field name="account_id" domain="[('company_id', '=', company_id), ('type','&lt;&gt;','view'), ('type','&lt;&gt;','consolidation')]"/>
<field name="debit"/>
<field name="credit"/>
<field name="quantity"/>
</group>
<group string="Accounting Documents">
<field name="invoice" readonly="True"/>
<field name="move_id" required="False"/>
<field name="statement_id" readonly="True"/>
</group>
<group string="Dates">
<field name="date"/>
<field name="date_maturity"/>
<field name="date_created" readonly="True"/>
</group>
<group string="Taxes">
<field name="tax_code_id"/>
<field name="tax_amount"/>
<field name="account_tax_id" domain="[('parent_id','=',False)]"/>
</group>
<group attrs="{'readonly':[('state','=','valid')]}" string="Currency">
<field name="currency_id"/>
<field name="amount_currency"/>
</group>
<group string="Reconciliation">
<field name="reconcile_id"/>
<field name="reconcile_partial_id"/>
</group>
<group string="States">
<field name="state"/>
<field name="blocked"/>
</group>
<group groups="analytic.group_analytic_accounting" string="Analytic">
<field name="analytic_account_id" domain="[('parent_id','!=',False)]"/>
</group>
</group>
<field name="narration" colspan="4" nolabel="1" placeholder="Add an internal note..."/>
</page>
<page string="Analytic Lines" groups="analytic.group_analytic_accounting">
<field name="analytic_lines" context="{'default_general_account_id':account_id, 'default_name': name, 'default_date':date, 'amount': (debit or 0.0)-(credit or 0.0)}"/>
</page>
</notebook>
<sheet>
<group>
<group>
<field name="name"/>
<field name="ref"/>
<field name="partner_id" on_change="onchange_partner_id(False,partner_id,account_id,debit,credit,date)"/>
</group>
<group>
<field name="journal_id"/>
<field name="period_id"/>
<field name="company_id" required="1" groups="base.group_multi_company"/>
</group>
</group>
<notebook colspan="4">
<page string="Information">
<group>
<group string="Amount">
<field name="account_id" domain="[('company_id', '=', company_id), ('type','&lt;&gt;','view'), ('type','&lt;&gt;','consolidation')]"/>
<field name="debit"/>
<field name="credit"/>
<field name="quantity"/>
</group>
<group string="Accounting Documents">
<field name="invoice" readonly="True"/>
<field name="move_id" required="False"/>
<field name="statement_id" readonly="True"/>
</group>
<group string="Dates">
<field name="date"/>
<field name="date_maturity"/>
<field name="date_created" readonly="True"/>
</group>
<group string="Taxes">
<field name="tax_code_id"/>
<field name="tax_amount"/>
<field name="account_tax_id" domain="[('parent_id','=',False)]"/>
</group>
<group attrs="{'readonly':[('state','=','valid')]}" string="Currency" groups="base.group_multi_currency">
<field name="currency_id" invisible="1"/>
<field name="amount_currency" widget="monetary" options="{'currency_field': 'currency_id'}"/>
</group>
<group string="Reconciliation">
<field name="reconcile_id"/>
<field name="reconcile_partial_id"/>
</group>
<group string="States">
<field name="state"/>
<field name="blocked"/>
</group>
<group groups="analytic.group_analytic_accounting" string="Analytic">
<field name="analytic_account_id" domain="[('parent_id','!=',False)]"/>
</group>
</group>
<field name="narration" colspan="4" nolabel="1" placeholder="Add an internal note..."/>
</page>
<page string="Analytic Lines" groups="analytic.group_analytic_accounting">
<field name="analytic_lines" context="{'default_general_account_id':account_id, 'default_name': name, 'default_date':date, 'amount': (debit or 0.0)-(credit or 0.0)}"/>
</page>
</notebook>
</sheet>
</form>
</field>
@ -1166,8 +1183,8 @@
<field name="credit"/>
<separator colspan="4" string="Optional Information"/>
<field name="currency_id"/>
<field name="amount_currency"/>
<field name="currency_id" invisible="1"/>
<field name="amount_currency" groups="base.group_multi_currency" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="quantity"/>
<field name="move_id" required="False"/>
<newline/>
@ -1222,8 +1239,8 @@
<field name="move_id" string="Number (Move)"/>
<field name="account_id"/>
<field name="partner_id"/>
<field name="journal_id" context="{'journal_id':self}"/>
<field name="period_id" context="{'period_id':self}"/>
<field name="journal_id" context="{'journal_id':self}" widget="selection"/> <!-- it's important to keep widget='selection' in this filter viewbecause without that the value passed in the context is not the ID but the textual value (name) of the selected journal -->
<field name="period_id" context="{'period_id':self}" widget="selection"/> <!-- it's important to keep the widget='selection' in this field, for the same reason as explained above -->
<group expand="0" string="Group By...">
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
@ -1294,16 +1311,6 @@
Account.Entry Edition
-->
<record id="account_move_graph" model="ir.ui.view">
<field name="name">account.move.graph</field>
<field name="model">account.move</field>
<field name="arch" type="xml">
<graph string="Account Statistics" type="bar">
<field name="period_id"/>
<field name="amount" operator="+"/>
</graph>
</field>
</record>
<record id="view_move_tree" model="ir.ui.view">
<field name="name">account.move.tree</field>
<field name="model">account.move</field>
@ -1327,8 +1334,8 @@
<field name="arch" type="xml">
<form string="Account Entry" version="7.0">
<header>
<button name="button_validate" states="draft" string="Post" type="object" class="oe_highlight"/>
<button name="button_cancel" states="posted" string="Cancel" type="object"/>
<button name="button_validate" states="draft" string="Post" type="object" class="oe_highlight" groups="account.group_account_invoice"/>
<button name="button_cancel" states="posted" string="Cancel" type="object" groups="account.group_account_invoice"/>
<field name="state" widget="statusbar"/>
</header>
<sheet string="Journal Entries" >
@ -1348,7 +1355,7 @@
<field name="date"/>
<field name="to_check"/>
<field name="amount" invisible="1"/>
</group>
</group>
</group>
<notebook>
<page string="Journal Items">
@ -1394,7 +1401,7 @@
<field name="account_tax_id" domain="[('parent_id','=',False)]"/>
</group>
<group string="Currency">
<group string="Currency" groups="base.group_multi_currency">
<field name="currency_id"/>
<field name="amount_currency"/>
</group>
@ -1432,7 +1439,7 @@
<field name="credit" sum="Total Credit"/>
<field name="analytic_account_id" domain="[('parent_id','!=',False)]" groups="analytic.group_analytic_accounting"/>
<field name="amount_currency"/>
<field name="currency_id"/>
<field name="currency_id" groups="base.group_multi_currency"/>
<field name="tax_code_id"/>
<field name="tax_amount"/>
<field name="state"/>
@ -1477,7 +1484,7 @@
<field name="name">Journal Entries</field>
<field name="res_model">account.move</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,graph</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_move_tree"/>
<field name="search_view_id" ref="view_account_move_filter"/>
<field name="help" type="html">
@ -1521,7 +1528,6 @@
<record id="action_move_line_search" model="ir.actions.act_window">
<field name="name">Journal Items</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.move.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
@ -1540,15 +1546,27 @@
<field name="act_window_id" ref="action_move_line_search"/>
</record>
<act_window
context="{'search_default_next_partner':1,'view_mode':True}"
id="action_account_manual_reconcile" name="Journal Items"
res_model="account.move.line"
view_id="view_move_line_tree"/>
<record id="action_account_manual_reconcile" model="ir.actions.act_window">
<field name="context">{'search_default_unreconciled': 1,'view_mode':True}</field>
<field name="name">Journal Items to Reconcile</field>
<field name="res_model">account.move.line</field>
<field name="view_id" ref="view_move_line_tree_reconcile"/>
<field name="view_mode">tree_account_reconciliation</field>
<field name="help" type="html">
<p>
No journal items found.
</p>
</field>
</record>
<menuitem
name="Journal Items to Reconcile"
action="action_account_manual_reconcile"
id="menu_manual_reconcile_bank"
sequence="20"
parent="account.menu_finance_bank_and_cash"/>
<menuitem
name="Manual Reconciliation" icon="STOCK_EXECUTE"
name="Manual Reconciliation"
action="action_account_manual_reconcile"
id="menu_manual_reconcile"
parent="account.periodical_processing_reconciliation"/>
@ -1650,8 +1668,8 @@
<form string="Journal Entry Model" version="7.0">
<group col="4">
<field name="name"/>
<field name="journal_id"/>
<field name="company_id" widget='selection' groups="base.group_multi_company"/>
<field name="journal_id" on_change="onchange_journal_id(journal_id)"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</group>
<field name="lines_id" widget="one2many_list"/>
@ -1727,8 +1745,10 @@
<field name="model">account.payment.term.line</field>
<field name="arch" type="xml">
<form string="Payment Term" version="7.0">
<field name="name"/>
<field name="sequence"/>
<group>
<field name="name"/>
<field name="sequence"/>
</group>
<group>
<group string="Amount Computation">
<field name="value"/>
@ -1776,12 +1796,11 @@
<field name="model">account.payment.term</field>
<field name="arch" type="xml">
<form string="Payment Term" version="7.0">
<group>
<group col="4">
<field name="name"/>
<field name="active"/>
</group>
<separator string="Description on Invoices"/>
<field name="note"/>
<field name="note" placeholder="Note for the invoice..."/>
<separator string="Computation"/>
<field name="line_ids"/>
</form>
@ -1840,7 +1859,7 @@
</field>
</record>
<record id="view_subscription_search" model="ir.ui.view">
<record id="view_subscription_search" model="ir.ui.view">
<field name="name">account.subscription.search</field>
<field name="model">account.subscription</field>
<field name="arch" type="xml">
@ -1852,7 +1871,7 @@
<field name="model_id"/>
<group expand="0" string="Group By...">
<filter string="Model" icon="terp-folder-orange" domain="[]" context="{'group_by':'model_id'}"/>
<filter string="State" 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'}"/>
</group>
</search>
</field>
@ -1970,7 +1989,7 @@
<field name="credit" sum="Total credit"/>
<field name="account_tax_id"/>
<field name="analytic_account_id" domain="[('parent_id','!=',False)]" groups="analytic.group_analytic_accounting"/>
<field name="state"/>
<field name="state" invisible="1"/>
</tree>
</field>
</record>
@ -2010,7 +2029,7 @@
src_model="account.journal"/>
<act_window
context="{'search_default_reconcile_id':False, 'search_default_partner_id':[active_id], 'default_partner_id': active_id}"
context="{'search_default_unreconciled':True, 'search_default_partner_id':[active_id], 'default_partner_id': active_id}"
domain="[('account_id.reconcile', '=', True),('account_id.type', 'in', ['receivable', 'payable'])]"
id="act_account_partner_account_move_all"
name="Receivables &amp; Payables"
@ -2046,7 +2065,7 @@
id="account_template_folder"
name="Templates"
parent="menu_finance_accounting"
groups="base.group_multi_company"/>
groups="account.group_account_manager"/>
<menuitem
id="account_template_taxes"
name="Taxes"
@ -2075,7 +2094,7 @@
<field name="type"/>
<field name="user_type"/>
<field name="currency_id"/>
<field name="currency_id" groups="base.group_multi_currency"/>
<field name="reconcile"/>
<field name="chart_template_id"/>
</group>
@ -2149,7 +2168,8 @@
<field name="visible" />
<field name="complete_tax_set" />
</group>
<field name="tax_template_ids" colspan="4" readonly="1" nolabel="1"/>
<separator string="Default Taxes" colspan="4"/>
<field name="tax_template_ids" colspan="4" nolabel="1"/>
<separator string="Properties" colspan="4"/>
<group col="4">
<field name="property_account_receivable" domain="[('id', 'child_of', [account_root_id])]"/>
@ -2160,7 +2180,6 @@
<field name="property_account_income" domain="[('id', 'child_of', [account_root_id])]"/>
<field name="property_account_income_opening" domain="[('id', 'child_of', [account_root_id])]"/>
<field name="property_account_expense_opening" domain="[('id', 'child_of', [account_root_id])]"/>
<field name="property_reserve_and_surplus_account" />
</group>
</form>
</field>
@ -2368,20 +2387,15 @@
<group string="res_config_contents" position="replace">
<field name="only_one_chart_template" invisible="1"/>
<field name="complete_tax_set" invisible="1"/>
<div groups="base.group_multi_company">
<label for="company_id"/>
<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 -->
</div>
<group>
<div attrs="{'invisible': [('only_one_chart_template','=',True)]}">
<label for="chart_template_id"/>
<group col="1">
<group attrs="{'invisible': [('only_one_chart_template','=',True)]}">
<field name="chart_template_id" widget="selection" on_change="onchange_chart_template_id(chart_template_id)" domain="[('visible','=', True)]"/>
</div>
<newline/>
<group groups="account.group_account_user">
<field name="code_digits"/>
</group>
<group groups="base.group_multi_company">
<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 -->
</group>
<group>
<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'))]"/>
<label for="sale_tax_rate" string="Sale Tax" attrs="{'invisible': [('complete_tax_set', '=', True)]}"/>
<div attrs="{'invisible': [('complete_tax_set', '=', True)]}">
@ -2393,17 +2407,10 @@
<field name="purchase_tax_rate" class="oe_inline"/> %%
</div>
</group>
<group groups="account.group_account_user">
<field name="code_digits"/>
</group>
</group>
<div groups="account.group_account_user">
<label for="bank_accounts_id" string="Bank Information"/>
<field name="bank_accounts_id">
<tree editable="bottom">
<field name="acc_name"/>
<field name="account_type"/>
<field name="currency_id" widget="selection"/>
</tree>
</field>
</div>
</group>
</field>
</record>
@ -2417,32 +2424,6 @@
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record id="ir_actions_server_action_wizard_multi_chart" model="ir.actions.server">
<field name="type">ir.actions.server</field>
<field name="condition">True</field>
<field name="state">code</field>
<field name="model_id" ref="base.model_ir_actions_todo"/>
<field eval="5" name="sequence"/>
<field name="code">
# check for unconfigured companies
account_installer_obj = self.pool.get('account.installer')
account_installer_obj.check_unconfigured_cmp(cr, uid, context=context)
action_ids = []
# fetch the act_window actions related to chart of account configuration
# we use ir.actions.todo to enable the possibility for other modules to insert their own
# wizards during the configuration process
ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'action_wizard_multi_chart')
if ref:
action_ids += [ref[1]]
ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'action_account_configuration_installer')
if ref:
action_ids += [ref[1]]
todo_ids = pool.get('ir.actions.todo').search(cr, uid, [('action_id', 'in', action_ids)], context=context)
pool.get('ir.actions.todo').write(cr, uid, todo_ids, {'state':'open'}, context=context)
action = pool.get('res.config').next(cr, uid, [], context)
</field>
<field name="name">New Company Financial Setting</field>
</record>
<record id="account_account_graph" model="ir.ui.view">
<field name="name">account.account.graph</field>
@ -2548,7 +2529,7 @@ action = pool.get('res.config').next(cr, uid, [], context)
<header>
<button name="button_confirm_cash" states="open" string="Close CashBox" type="object" class="oe_highlight"/>
<button name="button_open" states="draft" string="Open CashBox" type="object" class="oe_highlight"/>
<button name="button_cancel" states="confirm,open" string="Cancel" type="object" groups="base.group_extended"/>
<button name="button_cancel" states="confirm,open" string="Cancel" type="object"/>
<field name="state" widget="statusbar" nolabel="1" statusbar_visible="draft,confirm"/>
</header>
<sheet string="Statement">
@ -2627,12 +2608,12 @@ action = pool.get('res.config').next(cr, uid, [], context)
<group col="6" colspan="4">
<group col="2" colspan="2">
<separator string="Opening Balance" colspan="4"/>
<field name="balance_start" readonly="1" string="Opening Cash Control"/>
<field name="last_closing_balance" readonly="1" string="Last Closing Balance" />
<field name="total_entry_encoding" />
<field name="balance_start" readonly="1" string="Opening Cash Control" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="last_closing_balance" readonly="1" string="Last Closing Balance" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="total_entry_encoding" widget="monetary" options="{'currency_field': 'currency_id'}"/>
</group>
<group string="Closing Balance">
<field name="balance_end"/>
<field name="balance_end" widget="monetary" options="{'currency_field': 'currency_id'}"/>
</group>
</group>
</sheet>

View File

@ -12,16 +12,6 @@
<field name="domain">[('year','=',time.strftime('%Y'))]</field>
</record>
<record id="action_treasory_graph" model="ir.actions.act_window">
<field name="name">Treasury</field>
<field name="res_model">account.account</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
<field name="domain">[('type','=','liquidity')]</field>
<field name="context">{'default_type': 'liquidity'}</field>
<field name="view_id" ref="account.view_treasory_graph"/>
</record>
<record id="board_account_form" model="ir.ui.view">
<field name="name">board.account.form</field>
<field name="model">board.board</field>
@ -29,12 +19,8 @@
<form string="Account Board" version="7.0">
<board style="2-1">
<column>
<action name="%(account.action_invoice_tree1)d" creatable="true" string="Draft Customer Invoices" domain="[('state','in',('draft','proforma2')), ('type','=','out_invoice')]"/>
<action name="%(action_company_analysis_tree)d" string="Company Analysis"/>
</column>
<column>
<action name="%(action_treasory_graph)d" string="Treasury"/>
</column>
</board>
</form>
</field>

View File

@ -32,14 +32,6 @@ class res_company(osv.osv):
help="If you select 'Round per Line' : for each tax, the tax amount will first be computed and rounded for each PO/SO/invoice line and then these rounded amounts will be summed, leading to the total amount for that tax. If you select 'Round Globally': for each tax, the tax amount will be computed for each PO/SO/invoice line, then these amounts will be summed and eventually this total tax amount will be rounded. If you sell with tax included, you should choose 'Round per line' because you certainly want the sum of your tax-included line subtotals to be equal to the total amount with taxes."),
'paypal_account': fields.char("Paypal Account", size=128, help="Paypal username (usually email) for receiving online payments."),
'overdue_msg': fields.text('Overdue Payments Message', translate=True),
'property_reserve_and_surplus_account': fields.property(
'account.account',
type='many2one',
relation='account.account',
string="Reserve and Profit/Loss Account",
view_load=True,
domain="[('type', '=', 'other')]",
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"),
}
_defaults = {

View File

@ -15,18 +15,5 @@
</field>
</record>
<record model="ir.ui.view" id="view_company_inherit_1_form">
<field name="name">res.company.form.inherit</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="model">res.company</field>
<field name="arch" type="xml">
<xpath expr="//group[@name='account_grp']" position="inside">
<field name="property_reserve_and_surplus_account"/>
<field name="tax_calculation_rounding_method"/>
<field name="paypal_account" placeholder="e.g. sales@openerp.com"/>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -518,7 +518,6 @@
<!--
Account Statement Sequences
-->
<record id="sequence_reconcile" model="ir.sequence.type">
<field name="name">Account Reconcile</field>
<field name="code">account.reconcile</field>
@ -554,8 +553,6 @@
<field eval="1" name="number_next"/>
<field eval="1" name="number_increment"/>
</record>
<!--
Invoice requests (deprecated)
-->
@ -564,7 +561,14 @@
<field name="object">account.invoice</field>
</record>
<!-- mail: subtypes -->
<record id="mt_invoice_new" model="mail.message.subtype">
<field name="name">created</field>
<field name="res_model">account.invoice</field>
</record>
<record id="mt_invoice_paid" model="mail.message.subtype">
<field name="name">paid</field>
<field name="res_model">account.invoice</field>
</record>
</data>
</openerp>

View File

@ -45,7 +45,6 @@
<record id="conf_chart0" model="account.account.template">
<field name="code">0</field>
<field name="name">Configurable Account Chart</field>
<field eval="0" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="data_account_type_view"/>
</record>
@ -382,7 +381,6 @@
<field name="property_account_income_categ" ref="conf_a_sale"/>
<field name="property_account_income_opening" ref="conf_o_income"/>
<field name="property_account_expense_opening" ref="conf_o_expense"/>
<field name="property_reserve_and_surplus_account" ref="conf_a_reserve_and_surplus"/>
<field name="complete_tax_set" eval="False"/>
</record>

View File

@ -19,7 +19,6 @@
<record id="chart0" model="account.account">
<field name="code">X0</field>
<field name="name">Chart For Automated Tests</field>
<field eval="0" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="data_account_type_view"/>
</record>
@ -123,6 +122,14 @@
<field name="type">other</field>
<field name="user_type" ref="data_account_type_income"/>
</record>
<record id="usd_bnk" model="account.account">
<field name="code">X11007</field>
<field name="name">USD Bank Account - (test)</field>
<field ref="cas" name="parent_id"/>
<field name="type">liquidity</field>
<field name="user_type" ref="data_account_type_asset"/>
<field name="currency_id" ref="base.USD"/>
</record>
<record model="account.account" id="liabilities_view">
<field name="name">Liabilities - (test)</field>
@ -297,14 +304,6 @@
<field name="company_id" ref="base.main_company"/>
</record>
<record forcecreate="True" id="property_reserve_and_surplus_account" model="ir.property">
<field name="name">property_account_receivable</field>
<field name="fields_id" search="[('model','=','res.company'),('name','=','property_reserve_and_surplus_account')]"/>
<field eval="'account.account,'+str(rsa)" name="value"/>
<field name="company_id" ref="base.main_company"/>
</record>
<!--
Account Journal
-->
@ -361,8 +360,8 @@
<field name="type">bank</field>
<field name="view_id" ref="account_journal_bank_view"/>
<field name="sequence_id" ref="sequence_bank_journal"/>
<field model="account.account" name="default_debit_account_id" ref="cash"/>
<field model="account.account" name="default_credit_account_id" ref="cash"/>
<field model="account.account" name="default_debit_account_id" ref="bnk"/>
<field model="account.account" name="default_credit_account_id" ref="bnk"/>
<field name="analytic_journal_id" ref="sit"/>
<field name="user_id" ref="base.user_root"/>
</record>
@ -381,6 +380,16 @@
<field name="name">Cash Journal - (test)</field>
<field name="code">TCSH</field>
<field name="type">cash</field>
<field name="profit_account_id" model="account.account" ref="rsa" />
<field name="loss_account_id" model="account.account" ref="rsa" />
<field name="internal_account_id" model="account.account" ref="rsa" />
<field name="with_last_closing_balance" eval="True" />
<!--
Usually, cash payment methods requires a control at opening and closing.
Bot for demo data, it's better to avoid the control step so that people
that test OpenERP arrive directly in the touchscreen UI.
-->
<field name="cash_control" eval="False"/>
<field name="view_id" ref="account_journal_bank_view"/>
<field name="sequence_id" ref="sequence_cash_journal"/>
<field model="account.account" name="default_debit_account_id" ref="cash"/>
@ -408,6 +417,16 @@
<field eval="True" name="centralisation"/>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="bank_journal_usd" model="account.journal">
<field name="name">USD Bank Journal - (test)</field>
<field name="code">TUBK</field>
<field name="type">bank</field>
<field name="view_id" ref="account_journal_bank_view"/>
<field model="account.account" name="default_debit_account_id" ref="usd_bnk"/>
<field model="account.account" name="default_credit_account_id" ref="usd_bnk"/>
<field name="currency" ref="base.USD"/>
</record>
<!--
Product income and expense accounts, default parameters
-->

View File

@ -40,7 +40,7 @@
<field name="name">Automated Invoice Notification Mail</field>
<field name="email_from">${object.user_id.email or object.company_id.email or 'noreply@localhost'}</field>
<field name="subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a' })</field>
<field name="email_to">${object.partner_id.email or ''}</field>
<field name="email_recipients">${object.partner_id.id}</field>
<field name="model_id" ref="account.model_account_invoice"/>
<field name="auto_delete" eval="True"/>
<field name="body_html"><![CDATA[
@ -123,64 +123,6 @@
</div>
</div>
]]></field>
<field name="body_text"><![CDATA[
Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''},
A new invoice is available for ${object.partner_id.name}:
| Invoice number: *${object.number}*
| Invoice total: *${object.amount_total} ${object.currency_id.name}*
| Invoice date: ${object.date_invoice}
% if object.origin:
| Order reference: ${object.origin}
% endif
| Your contact: ${object.user_id.name} ${object.user_id.email and '<%s>'%(object.user_id.email) or ''}
You can view the invoice document, download it and pay online using the following link:
${ctx.get('edi_web_url_view') or 'n/a'}
% if object.company_id.paypal_account and object.type in ('out_invoice', 'in_refund'):
<%
comp_name = quote(object.company_id.name)
inv_number = quote(object.number)
paypal_account = quote(object.company_id.paypal_account)
inv_amount = quote(str(object.amount_total))
cur_name = quote(object.currency_id.name)
paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=%s&item_name=%s%%20Invoice%%20%s"\
"&invoice=%s&amount=%s&currency_code=%s&button_subtype=services&no_note=1&bn=OpenERP_Invoice_PayNow_%s" % \
(paypal_account,comp_name,inv_number,inv_number,inv_amount,cur_name,cur_name)
%>
It is also possible to directly pay with Paypal:
${paypal_url}
% endif
If you have any question, do not hesitate to contact us.
Thank you for choosing ${object.company_id.name}!
--
${object.user_id.name} ${object.user_id.email and '<%s>'%(object.user_id.email) or ''}
${object.company_id.name}
% if object.company_id.street:
${object.company_id.street or ''}
% endif
% if object.company_id.street2:
${object.company_id.street2}
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip or ''} ${object.company_id.city or ''}
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}
% endif
% if object.company_id.phone:
Phone: ${object.company_id.phone}
% endif
% if object.company_id.website:
${object.company_id.website or ''}
% endif
]]></field>
</record>
</data>
</openerp>

View File

@ -9538,7 +9538,7 @@ msgid "Refund"
msgstr ""
#. module: account
#: model:email.template,body_text:account.email_template_edi_invoice
#: model:email.template,body:account.email_template_edi_invoice
msgid "\n"
"Hello${object.address_invoice_id.name and ' ' or ''}${object.address_invoice_id.name or ''},\n"
"\n"

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

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

File diff suppressed because it is too large Load Diff

View File

@ -45,12 +45,12 @@ class account_installer(osv.osv_memory):
sorted(((m.name, m.shortdesc)
for m in modules.browse(cr, uid, ids, context=context)),
key=itemgetter(1)))
charts.insert(0, ('configurable', 'Generic Chart Of Accounts'))
charts.insert(0, ('configurable', _('Custom')))
return charts
_columns = {
# Accounting
'charts': fields.selection(_get_charts, 'Chart of Accounts',
'charts': fields.selection(_get_charts, 'Accounting Package',
required=True,
help="Installs localized accounting charts to match as closely as "
"possible the accounting needs of your company based on your "
@ -119,15 +119,6 @@ class account_installer(osv.osv_memory):
self.execute_simple(cr, uid, ids, context)
super(account_installer, self).execute(cr, uid, ids, context=context)
def action_next(self, cr, uid, ids, context=None):
next = self.execute(cr, uid, ids, context=context)
for installer in self.browse(cr, uid, ids, context=context):
if installer.charts == 'l10n_be':
return {'type': 'ir.actions.act_window_close'}
else :
if next : return next
return self.next(cr, uid, ids, context=context)
def execute_simple(self, cr, uid, ids, context=None):
if context is None:
context = {}

View File

@ -20,8 +20,8 @@
##############################################################################
from operator import itemgetter
from osv import fields, osv
import time
class account_fiscal_position(osv.osv):
_name = 'account.fiscal.position'
@ -44,17 +44,17 @@ class account_fiscal_position(osv.osv):
return []
if not fposition_id:
return map(lambda x: x.id, taxes)
result = []
result = set()
for t in taxes:
ok = False
for tax in fposition_id.tax_ids:
if tax.tax_src_id.id == t.id:
if tax.tax_dest_id:
result.append(tax.tax_dest_id.id)
result.add(tax.tax_dest_id.id)
ok=True
if not ok:
result.append(t.id)
return result
result.add(t.id)
return list(result)
def map_account(self, cr, uid, fposition_id, account_id, context=None):
if not fposition_id:
@ -77,6 +77,12 @@ class account_fiscal_position_tax(osv.osv):
'tax_dest_id': fields.many2one('account.tax', 'Replacement Tax')
}
_sql_constraints = [
('tax_src_dest_uniq',
'unique (position_id,tax_src_id,tax_dest_id)',
'A tax fiscal position could be defined only once time on same taxes.')
]
account_fiscal_position_tax()
class account_fiscal_position_account(osv.osv):
@ -89,6 +95,12 @@ class account_fiscal_position_account(osv.osv):
'account_dest_id': fields.many2one('account.account', 'Account Destination', domain=[('type','<>','view')], required=True)
}
_sql_constraints = [
('account_src_dest_uniq',
'unique (position_id,account_src_id,account_dest_id)',
'An account fiscal position could be defined only once time on same accounts.')
]
account_fiscal_position_account()
class res_partner(osv.osv):
@ -145,6 +157,29 @@ class res_partner(osv.osv):
def _debit_search(self, cr, uid, obj, name, args, context=None):
return self._asset_difference_search(cr, uid, obj, name, 'payable', args, context=context)
def has_something_to_reconcile(self, cr, uid, partner_id, context=None):
'''
at least a debit, a credit and a line older than the last reconciliation date of the partner
'''
cr.execute('''
SELECT l.partner_id, SUM(l.debit) AS debit, SUM(l.credit) AS credit
FROM account_move_line l
RIGHT JOIN account_account a ON (a.id = l.account_id)
RIGHT JOIN res_partner p ON (l.partner_id = p.id)
WHERE a.reconcile IS TRUE
AND p.id = %s
AND l.reconcile_id IS NULL
AND (p.last_reconciliation_date IS NULL OR l.date > p.last_reconciliation_date)
AND l.state <> 'draft'
GROUP BY l.partner_id''', (partner_id,))
res = cr.dictfetchone()
if res:
return bool(res['debit'] and res['credit'])
return False
def mark_as_reconciled(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'last_reconciliation_date': time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
_columns = {
'credit': fields.function(_credit_debit_get,
fnct_search=_credit_search, string='Total Receivable', multi='dc', help="Total amount this customer owes you."),
@ -174,7 +209,7 @@ class res_partner(osv.osv):
relation='account.fiscal.position',
string="Fiscal Position",
view_load=True,
help="The fiscal position will determine taxes and the accounts used for the partner.",
help="The fiscal position will determine taxes and accounts used for the partner.",
),
'property_payment_term': fields.property(
'account.payment.term',
@ -185,7 +220,7 @@ class res_partner(osv.osv):
help="This payment term will be used instead of the default one for the current partner"),
'ref_companies': fields.one2many('res.company', 'partner_id',
'Companies that refers to partner'),
'last_reconciliation_date': fields.datetime('Latest Reconciliation Date', help='Date on which the partner accounting entries were reconciled last time')
'last_reconciliation_date': fields.datetime('Latest Reconciliation Date', help='Date on which the partner accounting entries were fully reconciled last time. It differs from the date of the last reconciliation made for this partner, as here we depict the fact that nothing more was to be reconciled at this date. This can be achieved in 2 ways: either the last debit/credit entry was reconciled, either the user pressed the button "Fully Reconciled" in the manual reconciliation process')
}
res_partner()

View File

@ -6,13 +6,13 @@
<field name="name">account.fiscal.position.form</field>
<field name="model">account.fiscal.position</field>
<field name="arch" type="xml">
<form string="Fiscal Position">
<form string="Fiscal Position" version="7.0">
<group col="4">
<field name="name"/>
<field name="active"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</group>
<separator string="Mapping"/>
<separator string="Taxes Mapping"/>
<field name="tax_ids" widget="one2many_list">
<tree string="Tax Mapping" editable="bottom">
<field name="tax_src_id" domain="[('parent_id','=',False)]"/>
@ -23,6 +23,7 @@
<field name="tax_dest_id" domain="[('parent_id','=',False)]"/>
</form>
</field>
<separator string="Accounts Mapping"/>
<field name="account_ids" widget="one2many_list">
<tree string="Account Mapping" editable="bottom">
<field name="account_src_id"/>
@ -91,32 +92,7 @@
<field name="debit"/>
</group>
</group>
<field name="bank_ids">
<form string="Bank account" version="7.0">
<field name="state"/>
<field name="acc_number"/>
<group>
<group name="owner" string="Bank Account Owner">
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
<field name="owner_name"/>
<label for="street" string="Address"/>
<div>
<field name="street" placeholder="Street..."/>
<div>
<field name="zip" class="oe_inline" placeholder="ZIP"/>
<field name="city" class="oe_inline" placeholder="City"/>
</div>
<field name="state_id" placeholder="State" options='{"no_open": true}'/>
<field name="country_id" placeholder="Country" options='{"no_open": true}'/>
</div>
</group>
<group name="bank" string="Information About the Bank">
<field name="bank" on_change="onchange_bank_id(bank)"/>
<field name="bank_name"/>
<field name="bank_bic" placeholder="e.g. GEBABEBB"/>
</group>
</group>
</form>
<field name="bank_ids" context="{'default_partner_id': active_id, 'form_view_ref': 'base.view_partner_bank_form'}">
<tree string="Bank Details">
<field name="sequence" invisible="1"/>
<field name="acc_number"/>
@ -138,7 +114,7 @@
context="{'search_default_partner_id':[active_id], 'default_partner_id': active_id}"
src_model="res.partner"
view_type="form"
view_mode="tree,form,graph,calendar"/>
view_mode="tree,form"/>
</data>
</openerp>

View File

@ -30,14 +30,14 @@ class product_category(osv.osv):
relation='account.account',
string="Income Account",
view_load=True,
help="This account will be used for invoices to value sales for the current product category"),
help="This account will be used for invoices to value sales."),
'property_account_expense_categ': fields.property(
'account.account',
'account.account',
type='many2one',
relation='account.account',
string="Expense Account",
view_load=True,
help="This account will be used for invoices to value expenses for the current product category"),
help="This account will be used for invoices to value expenses."),
}
product_category()
@ -60,14 +60,14 @@ class product_template(osv.osv):
relation='account.account',
string="Income Account",
view_load=True,
help="This account will be used for invoices instead of the default one to value sales for the current product"),
help="This account will be used for invoices instead of the default one to value sales for the current product."),
'property_account_expense': fields.property(
'account.account',
type='many2one',
relation='account.account',
string="Expense Account",
view_load=True,
help="This account will be used for invoices instead of the default one to value expenses for the current product"),
help="This account will be used for invoices instead of the default one to value expenses for the current product."),
}
product_template()

View File

@ -7,15 +7,15 @@
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Accounting" groups="base.group_user">
<page string="Accounting" groups="account.group_account_user">
<group name="properties">
<group>
<field name="property_account_income" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" attrs="{'readonly':[('sale_ok','=',0)]}"/>
<field name="taxes_id" colspan="2" attrs="{'readonly':[('sale_ok','=',0)]}" widget="many2many_tags"/>
</group>
<group>
<field name="property_account_expense" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}"/>
<field name="supplier_taxes_id" colspan="2" attrs="{'readonly':[('purchase_ok','=',0)]}" widget="many2many_tags"/>
<field name="property_account_expense" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" />
<field name="supplier_taxes_id" colspan="2" widget="many2many_tags"/>
</group>
</group>
</page>
@ -49,9 +49,11 @@
<field name="inherit_id" ref="product.product_category_form_view"/>
<field name="arch" type="xml">
<data>
<xpath expr="/form/sheet//group[@name='account_property']" position="inside">
<field name="property_account_income_categ" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="property_account_expense_categ" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<xpath expr="//group[@name='parent']" position="inside">
<group name="account_property" string="Account Properties" colspan="2">
<field name="property_account_income_categ" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="property_account_expense_categ" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
</group>
</xpath>
</data>
</field>

Some files were not shown because too many files have changed in this diff Show More