l10n_us - with new template

bzr revid: dhara_openerp-20120103193453-nrour60kpc906i4h
This commit is contained in:
Dhara (OpenERP) 2012-01-04 01:04:53 +05:30
commit 0009962b33
7512 changed files with 1332346 additions and 874595 deletions

View File

@ -29,11 +29,12 @@ import account_bank
import account_cash_statement
import account_move_line
import account_analytic_line
import account_financial_report
import wizard
import report
import product
import ir_sequence
import company
import res_currency
import edi
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -19,11 +19,11 @@
#
##############################################################################
{
"name" : "Accounting and Financial Management",
"name" : "eInvoicing",
"version" : "1.1",
"author" : "OpenERP SA",
"category": 'Accounting & Finance',
'complexity': "normal",
'complexity': "easy",
"description": """
Accounting and Financial Management.
====================================
@ -53,7 +53,7 @@ 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"],
"depends" : ["base_setup", "product", "analytic", "process", "board", "edi"],
'update_xml': [
'security/account_security.xml',
'security/ir.model.access.csv',
@ -69,6 +69,7 @@ module named account_voucher.
'wizard/account_period_close_view.xml',
'account_view.xml',
'account_report.xml',
'account_financial_report_data.xml',
'wizard/account_report_common_view.xml',
'wizard/account_invoice_refund_view.xml',
'wizard/account_fiscalyear_close_state.xml',
@ -104,6 +105,7 @@ module named account_voucher.
'account_invoice_view.xml',
'partner_view.xml',
'data/account_data.xml',
'data/data_account_type.xml',
'account_invoice_workflow.xml',
'project/project_view.xml',
'project/project_report.xml',
@ -121,9 +123,9 @@ module named account_voucher.
'ir_sequence_view.xml',
'company_view.xml',
'board_account_view.xml',
"wizard/account_report_profit_loss_view.xml",
"wizard/account_report_balance_sheet_view.xml",
"account_bank_view.xml"
"edi/invoice_action_data.xml",
"account_bank_view.xml",
"account_pre_install.yml"
],
'demo_xml': [
'demo/account_demo.xml',
@ -139,16 +141,15 @@ module named account_voucher.
'test/account_change_currency.yml',
'test/chart_of_account.yml',
'test/account_period_close.yml',
'test/account_fiscalyear_close_state.yml',
'test/account_use_model.yml',
'test/account_validate_account_move.yml',
'test/account_fiscalyear_close.yml',
'test/account_bank_statement.yml',
'test/account_cash_statement.yml',
'test/test_edi_invoice.yml',
'test/account_report.yml',
],
'test/account_fiscalyear_close_state.yml', #last test, as it will definitively close the demo fiscalyear
],
'installable': True,
'active': False,
'certificate': '0080331923549',

File diff suppressed because it is too large Load Diff

View File

@ -37,15 +37,23 @@ class bank(osv.osv):
self.post_write(cr, uid, ids, context=context)
return result
def _prepare_name(self, bank):
"Return the name to use when creating a bank journal"
return (bank.bank_name or '') + ' ' + bank.acc_number
def post_write(self, cr, uid, ids, context={}):
if isinstance(ids, (int, long)):
ids = [ids]
obj_acc = self.pool.get('account.account')
obj_data = self.pool.get('ir.model.data')
for bank in self.browse(cr, uid, ids, context):
if bank.company_id and not bank.journal_id:
# Find the code and parent of the bank account to create
dig = 6
current_num = 1
ids = obj_acc.search(cr, uid, [('type','=','liquidity')], context=context)
ids = obj_acc.search(cr, uid, [('type','=','liquidity')], context=context)
# No liquidity account exists, no template available
if not ids: continue
@ -57,10 +65,9 @@ class bank(osv.osv):
if not ids:
break
current_num += 1
name = self._prepare_name(bank)
acc = {
'name': (bank.bank_name or '')+' '+bank.acc_number,
'currency_id': bank.company_id.currency_id.id,
'name': name,
'code': new_code,
'type': 'liquidity',
'user_type': ref_acc_bank_temp.user_type.id,
@ -74,7 +81,7 @@ class bank(osv.osv):
data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_bank_view')])
data = obj_data.browse(cr, uid, data_id[0], context=context)
view_id_cash = data.res_id
jour_obj = self.pool.get('account.journal')
new_code = 1
while True:
@ -86,12 +93,11 @@ class bank(osv.osv):
#create the bank journal
vals_journal = {
'name': (bank.bank_name or '')+' '+bank.acc_number,
'name': name,
'code': code,
'type': 'bank',
'company_id': bank.company_id.id,
'analytic_journal_id': False,
'currency_id': False,
'default_credit_account_id': acc_bank_id,
'default_debit_account_id': acc_bank_id,
'view_id': view_id_cash
@ -101,3 +107,4 @@ class bank(osv.osv):
self.write(cr, uid, [bank.id], {'journal_id': journal_id}, context=context)
return True
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -30,10 +30,10 @@ class account_bank_statement(osv.osv):
def create(self, cr, uid, vals, context=None):
seq = 0
if 'line_ids' in vals:
new_line_ids = []
for line in vals['line_ids']:
seq += 1
line[2]['sequence'] = seq
vals[seq - 1] = line
return super(account_bank_statement, self).create(cr, uid, vals, context=context)
def write(self, cr, uid, ids, vals, context=None):
@ -128,7 +128,7 @@ class account_bank_statement(osv.osv):
_description = "Bank Statement"
_columns = {
'name': fields.char('Name', size=64, required=True, states={'draft': [('readonly', False)]}, readonly=True, help='if you give the Name other then /, its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself'), # readonly for account_cash_statement
'date': fields.date('Date', required=True, states={'confirm': [('readonly', True)]}),
'date': fields.date('Date', required=True, states={'confirm': [('readonly', True)]}, select=True),
'journal_id': fields.many2one('account.journal', 'Journal', required=True,
readonly=True, states={'draft':[('readonly',False)]}),
'period_id': fields.many2one('account.period', 'Period', required=True,
@ -137,7 +137,7 @@ class account_bank_statement(osv.osv):
states={'confirm':[('readonly',True)]}),
'balance_end_real': fields.float('Ending Balance', digits_compute=dp.get_precision('Account'),
states={'confirm': [('readonly', True)]}),
'balance_end': fields.function(_end_balance,
'balance_end': fields.function(_end_balance,
store = {
'account.bank.statement': (lambda self, cr, uid, ids, c={}: ids, ['line_ids','move_line_ids'], 10),
'account.bank.statement.line': (_get_statement, ['amount'], 10),
@ -219,6 +219,7 @@ class account_bank_statement(osv.osv):
'period_id': st.period_id.id,
'date': st_line.date,
'name': st_line_number,
'ref': st_line.ref,
}, context=context)
account_bank_statement_line_obj.write(cr, uid, [st_line.id], {
'move_ids': [(4, move_id, False)]
@ -296,7 +297,7 @@ class account_bank_statement(osv.osv):
context=context):
if line.state <> 'valid':
raise osv.except_osv(_('Error !'),
_('Journal Item "%s" is not valid') % line.name)
_('Journal item "%s" is not valid.') % line.name)
# Bank statements will not consider boolean on journal entry_posted
account_move_obj.post(cr, uid, [move_id], context=context)
@ -307,7 +308,7 @@ class account_bank_statement(osv.osv):
def balance_check(self, cr, uid, st_id, journal_type='bank', context=None):
st = self.browse(cr, uid, st_id, context=context)
if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001):
if not ((abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001) or (abs((st.balance_end or 0.0) - st.balance_end_cash) < 0.0001)):
raise osv.except_osv(_('Error !'),
_('The statement balance is incorrect !\nThe expected balance (%.2f) is different than the computed one. (%.2f)') % (st.balance_end_real, st.balance_end))
return True
@ -351,13 +352,16 @@ class account_bank_statement(osv.osv):
for st_line in st.line_ids:
if st_line.analytic_account_id:
if not st.journal_id.analytic_journal_id:
raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (st.journal_id.name,))
raise osv.except_osv(_('No Analytic Journal !'),_("You have to assign an analytic journal on the '%s' journal!") % (st.journal_id.name,))
if not st_line.amount:
continue
st_line_number = self.get_next_st_line_number(cr, uid, st_number, st_line, context)
self.create_move_from_st_line(cr, uid, st_line.id, company_currency_id, st_line_number, context)
self.write(cr, uid, [st.id], {'name': st_number}, context=context)
self.write(cr, uid, [st.id], {
'name': st_number,
'balance_end_real': st.balance_end
}, context=context)
self.log(cr, uid, st.id, _('Statement %s is confirmed, journal items are created.') % (st_number,))
return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
@ -470,7 +474,7 @@ class account_bank_statement_line(osv.osv):
'Moves'),
'ref': fields.char('Reference', size=32),
'note': fields.text('Notes'),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of bank statement lines."),
'sequence': fields.integer('Sequence', select=True, help="Gives the sequence order when displaying a list of bank statement lines."),
'company_id': fields.related('statement_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
}
_defaults = {

View File

@ -311,7 +311,7 @@ class account_cash_statement(osv.osv):
if journal_type == 'bank':
return super(account_cash_statement, self).balance_check(cr, uid, cash_id, journal_type, context)
if not self._equal_balance(cr, uid, cash_id, context):
raise osv.except_osv(_('Error !'), _('The closing balance should be the same than the computed balance !'))
raise osv.except_osv(_('Error !'), _('The closing balance should be the same than the computed balance!'))
return True
def statement_close(self, cr, uid, ids, journal_type='bank', context=None):

View File

@ -0,0 +1,125 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
from datetime import datetime
from dateutil.relativedelta import relativedelta
from operator import itemgetter
import netsvc
import pooler
from osv import fields, osv
import decimal_precision as dp
from tools.translate import _
# ---------------------------------------------------------
# Account Financial Report
# ---------------------------------------------------------
class account_financial_report(osv.osv):
_name = "account.financial.report"
_description = "Account Report"
def _get_level(self, cr, uid, ids, field_name, arg, context=None):
res = {}
for report in self.browse(cr, uid, ids, context=context):
level = 0
if report.parent_id:
level = report.parent_id.level + 1
res[report.id] = level
return res
def _get_children_by_order(self, cr, uid, ids, context=None):
res = []
for id in ids:
res.append(id)
ids2 = self.search(cr, uid, [('parent_id', '=', id)], order='sequence ASC', context=context)
res += self._get_children_by_order(cr, uid, ids2, context=context)
return res
def _get_balance(self, cr, uid, ids, name, args, context=None):
account_obj = self.pool.get('account.account')
res = {}
res_all = {}
for report in self.browse(cr, uid, ids, context=context):
balance = 0.0
if report.id in res_all:
balance = res_all[report.id]
elif report.type == 'accounts':
# it's the sum of balance of the linked accounts
for a in report.account_ids:
balance += a.balance
elif report.type == 'account_type':
# it's the sum of balance of the leaf accounts with such an account type
report_types = [x.id for x in report.account_type_ids]
account_ids = account_obj.search(cr, uid, [('user_type','in', report_types), ('type','!=','view')], context=context)
for a in account_obj.browse(cr, uid, account_ids, context=context):
balance += a.balance
elif report.type == 'account_report' and report.account_report_id:
# it's the amount of the linked report
res2 = self._get_balance(cr, uid, [report.account_report_id.id], 'balance', False, context=context)
res_all.update(res2)
for key, value in res2.items():
balance += value
elif report.type == 'sum':
# it's the sum of balance of the children of this account.report
#for child in report.children_ids:
res2 = self._get_balance(cr, uid, [rec.id for rec in report.children_ids], 'balance', False, context=context)
res_all.update(res2)
for key, value in res2.items():
balance += value
res[report.id] = balance
res_all[report.id] = balance
return res
_columns = {
'name': fields.char('Report Name', size=128, required=True, translate=True),
'parent_id': fields.many2one('account.financial.report', 'Parent'),
'children_ids': fields.one2many('account.financial.report', 'parent_id', 'Account Report'),
'sequence': fields.integer('Sequence'),
'balance': fields.function(_get_balance, 'Balance'),
'level': fields.function(_get_level, string='Level', store=True, type='integer'),
'type': fields.selection([
('sum','View'),
('accounts','Accounts'),
('account_type','Account Type'),
('account_report','Report Value'),
],'Type'),
'account_ids': fields.many2many('account.account', 'account_account_financial_report', 'report_line_id', 'account_id', 'Accounts'),
'display_detail': fields.selection([
('no_detail','No detail'),
('detail_flat','Display children flat'),
('detail_with_hierarchy','Display children with hierarchy')
], 'Display details'),
'account_report_id': fields.many2one('account.financial.report', 'Report Value'),
'account_type_ids': fields.many2many('account.account.type', 'account_account_financial_report_type', 'report_id', 'account_type_id', 'Account Types'),
'sign': fields.selection([(-1, 'Reverse balance sign'), (1, 'Preserve balance sign')], 'Sign on Reports', required=True, help='For accounts that are typically more debited than credited and that you would like to print as negative amounts in your reports, you should reverse the sign of the balance; e.g.: Expense account. The same applies for accounts that are typically more credited than debited and that you would like to print as positive amounts in your reports; e.g.: Income account.'),
}
_defaults = {
'type': 'sum',
'display_detail': 'detail_flat',
'sign': 1,
}
account_financial_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<!--
Financial Reports
-->
<record id="account_financial_report_balancesheet0" model="account.financial.report">
<field name="name">Balance Sheet</field>
<field name="type">sum</field>
</record>
<record id="account_financial_report_assets0" model="account.financial.report">
<field name="name">Assets</field>
<field name="parent_id" ref="account_financial_report_balancesheet0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">account_type</field>
</record>
<record id="account_financial_report_liability0" model="account.financial.report">
<field name="name">Liability</field>
<field name="parent_id" ref="account_financial_report_balancesheet0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">account_type</field>
</record>
<record id="account_financial_report_profitandloss0" model="account.financial.report">
<field name="name">Profit and Loss</field>
<field name="type">sum</field>
</record>
<record id="account_financial_report_income0" model="account.financial.report">
<field name="name">Income</field>
<field name="parent_id" ref="account_financial_report_profitandloss0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">account_type</field>
</record>
<record id="account_financial_report_expense0" model="account.financial.report">
<field name="name">Expense</field>
<field name="parent_id" ref="account_financial_report_profitandloss0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">account_type</field>
</record>
</data>
</openerp>

View File

@ -25,18 +25,15 @@
</xpath>
<group colspan="8" position="inside">
<group colspan="4" width="600">
<field name="charts"/>
<field name="charts"/>
<group colspan="4" groups="account.group_account_user">
<separator col="4" colspan="4" string="Configure Fiscal Year"/>
<field name="company_id" colspan="4" widget="selection"/><!-- we assume that this wizard will be run only by administrators and as this field may cause problem if hidden (because of the default company of the user removed from the selection because already configured), we simply choosed to remove the group "multi company" of it -->
<field name="has_default_company" invisible="1" />
<field name="company_id" colspan="4" widget="selection" attrs="{'invisible' : [('has_default_company', '=', True)]}"/><!-- we assume that this wizard will be run only by administrators and as this field may cause problem if hidden (because of the default company of the user removed from the selection because already configured), we simply choosed to remove the group "multi company" of it -->
<field name="date_start" on_change="on_change_start_date(date_start)"/>
<field name="date_stop"/>
<field name="period" colspan="4"/>
</group>
<group colspan="4" attrs="{'invisible':[('charts','!=','configurable')]}">
<field name="sale_tax" on_change="on_change_tax(sale_tax)" attrs="{'required':[('charts','=','configurable')]}"/>
<field name="purchase_tax" groups="base.group_extended"/>
</group>
</group>
</group>
</data>
@ -56,7 +53,7 @@
<record id="category_accounting_configuration" model="ir.actions.todo.category">
<field name="name">Accounting</field>
<field name="sequence">5</field>
</record>
</record>
<record id="account_configuration_installer_todo" model="ir.actions.todo">
<field name="action_id" ref="action_account_configuration_installer"/>

View File

@ -68,7 +68,7 @@ class account_invoice(osv.osv):
tt = type2journal.get(type_inv, 'sale')
result = self.pool.get('account.analytic.journal').search(cr, uid, [('type','=',tt)], context=context)
if not result:
raise osv.except_osv(_('No Analytic Journal !'),_("You must define an analytic journal of type '%s' !") % (tt,))
raise osv.except_osv(_('No Analytic Journal !'),_("You must define an analytic journal of type '%s'!") % (tt,))
return result[0]
def _get_type(self, cr, uid, context=None):
@ -207,9 +207,9 @@ class account_invoice(osv.osv):
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 invoice is paid.\
\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.'),
'date_invoice': fields.date('Invoice Date', states={'paid':[('readonly',True)], 'open':[('readonly',True)], 'close':[('readonly',True)]}, select=True, help="Keep empty to use the current date"),
'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,
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."),
@ -251,17 +251,17 @@ 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('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'), states={'open':[('readonly',True)],'close':[('readonly',True)]}),
'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 ?
'account.move.line': (_get_invoice_from_line, None, 50),
'account.move.reconcile': (_get_invoice_from_reconcile, None, 50),
}, help="The Journal Entry of the invoice have been totally reconciled with one or several Journal Entries of payment."),
}, help="It indicates that the invoice has been paid and the journal entry of the invoice has been reconciled with one or several journal entries of payment."),
'partner_bank_id': fields.many2one('res.partner.bank', 'Bank Account',
help='Bank Account Number, Company bank account if Invoice is customer or supplier refund, otherwise Partner bank account number.', readonly=True, states={'draft':[('readonly',False)]}),
'move_lines':fields.function(_get_lines, type='many2many', relation='account.move.line', string='Entry Lines'),
'residual': fields.function(_amount_residual, digits_compute=dp.get_precision('Account'), string='Residual',
'residual': fields.function(_amount_residual, digits_compute=dp.get_precision('Account'), string='Balance',
store={
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, ['invoice_line','move_id'], 50),
'account.invoice.tax': (_get_invoice_tax, None, 50),
@ -286,6 +286,9 @@ class account_invoice(osv.osv):
'internal_number': False,
'user_id': lambda s, cr, u, c: u,
}
_sql_constraints = [
('number_uniq', 'unique(number, company_id)', 'Invoice Number must be unique per Company!'),
]
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
journal_obj = self.pool.get('account.journal')
@ -306,9 +309,9 @@ class account_invoice(osv.osv):
view_id = view_id[0]
res = super(account_invoice,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
type = context.get('journal_type', 'sale')
type = context.get('journal_type', False)
for field in res['fields']:
if field == 'journal_id':
if field == 'journal_id' and type:
journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', type)], context=context, limit=None, name_get_uid=1)
res['fields'][field]['selection'] = journal_select
@ -411,7 +414,7 @@ class account_invoice(osv.osv):
pay_res_id = pay_line_data and pay_line_data[0].get('value_reference',False) and int(pay_line_data[0]['value_reference'].split(',')[1]) or False
if not rec_res_id and not pay_res_id:
raise osv.except_osv(_('Configuration Error !'),
_('Can not find account chart for this company, Please Create account.'))
_('Can not find a chart of accounts for this company, you should create one.'))
account_obj = self.pool.get('account.account')
rec_obj_acc = account_obj.browse(cr, uid, [rec_res_id])
pay_obj_acc = account_obj.browse(cr, uid, [pay_res_id])
@ -478,7 +481,7 @@ class account_invoice(osv.osv):
pterm_list.sort()
res = {'value':{'date_due': pterm_list[-1]}}
else:
raise osv.except_osv(_('Data Insufficient !'), _('The Payment Term of Supplier does not have Payment Term Lines(Computation) defined !'))
raise osv.except_osv(_('Data Insufficient !'), _('The payment term of supplier does not have a payment term line!'))
return res
def onchange_invoice_line(self, cr, uid, ids, lines):
@ -511,7 +514,7 @@ class account_invoice(osv.osv):
pay_res_id = pay_line_data and pay_line_data[0].get('value_reference',False) and int(pay_line_data[0]['value_reference'].split(',')[1]) or False
if not rec_res_id and not pay_res_id:
raise osv.except_osv(_('Configuration Error !'),
_('Can not find account chart for this company, Please Create account.'))
_('Can not find a chart of account, you should create one from the configuration of the accounting menu.'))
if type in ('out_invoice', 'out_refund'):
acc_id = rec_res_id
else:
@ -526,7 +529,7 @@ class account_invoice(osv.osv):
result_id = account_obj.search(cr, uid, [('name','=',line.account_id.name),('company_id','=',company_id)])
if not result_id:
raise osv.except_osv(_('Configuration Error !'),
_('Can not find account chart for this company in invoice line account, Please Create account.'))
_('Can not find a chart of account, you should create one from the configuration of the accounting menu.'))
inv_line_obj.write(cr, uid, [line.id], {'account_id': result_id[-1]})
else:
if invoice_line:
@ -607,15 +610,15 @@ class account_invoice(osv.osv):
res[r[0]].append( r[1] )
return res
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 = default or {}
default.update({
'state':'draft',
'number':False,
'move_id':False,
'move_name':False,
'internal_number': False,
'period_id': False,
})
if 'date_invoice' not in default:
default.update({
@ -727,13 +730,13 @@ class account_invoice(osv.osv):
key = (tax.tax_code_id.id, tax.base_code_id.id, tax.account_id.id)
tax_key.append(key)
if not key in compute_taxes:
raise osv.except_osv(_('Warning !'), _('Global taxes defined, but are not in invoice lines !'))
raise osv.except_osv(_('Warning !'), _('Global taxes defined, but they are not in invoice lines !'))
base = compute_taxes[key]['base']
if abs(base - tax.base) > inv.company_id.currency_id.rounding:
raise osv.except_osv(_('Warning !'), _('Tax base different !\nClick on compute to update tax base'))
raise osv.except_osv(_('Warning !'), _('Tax base different!\nClick on compute to update the tax base.'))
for key in compute_taxes:
if not key in tax_key:
raise osv.except_osv(_('Warning !'), _('Taxes missing !'))
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):
total = 0
@ -791,28 +794,33 @@ class account_invoice(osv.osv):
line.append((0,0,val))
return line
def action_move_create(self, cr, uid, ids, *args):
def action_move_create(self, cr, uid, ids, context=None):
"""Creates invoice related analytics and financial move lines"""
ait_obj = self.pool.get('account.invoice.tax')
cur_obj = self.pool.get('res.currency')
context = {}
for inv in self.browse(cr, uid, ids):
period_obj = self.pool.get('account.period')
payment_term_obj = self.pool.get('account.payment.term')
journal_obj = self.pool.get('account.journal')
move_obj = self.pool.get('account.move')
if context is None:
context = {}
for inv in self.browse(cr, uid, ids, context=context):
if not inv.journal_id.sequence_id:
raise osv.except_osv(_('Error !'), _('Please define sequence on invoice journal'))
raise osv.except_osv(_('Error !'), _('Please define sequence on the journal related to this invoice.'))
if not inv.invoice_line:
raise osv.except_osv(_('No Invoice Lines !'), _('Please create some invoice lines.'))
if inv.move_id:
continue
ctx = context.copy()
ctx.update({'lang': inv.partner_id.lang})
if not inv.date_invoice:
self.write(cr, uid, [inv.id], {'date_invoice':time.strftime('%Y-%m-%d')})
self.write(cr, uid, [inv.id], {'date_invoice':time.strftime('%Y-%m-%d')}, context=ctx)
company_currency = inv.company_id.currency_id.id
# create the analytical lines
# one move line per invoice line
iml = self._get_analytic_lines(cr, uid, inv.id)
iml = self._get_analytic_lines(cr, uid, inv.id, context=ctx)
# check if taxes are all computed
ctx = context.copy()
ctx.update({'lang': inv.partner_id.lang})
compute_taxes = ait_obj.compute(cr, uid, inv.id, context=ctx)
self.check_tax_lines(cr, uid, inv, compute_taxes, ait_obj)
@ -828,7 +836,7 @@ class account_invoice(osv.osv):
total_percent += line.value_amount
total_fixed = (total_fixed * 100) / (inv.amount_total or 1.0)
if (total_fixed + total_percent) > 100:
raise osv.except_osv(_('Error !'), _("Can not create the invoice !\nThe related payment term is probably misconfigured as it gives a computed amount greater than the total invoiced amount."))
raise osv.except_osv(_('Error !'), _("Can not create the invoice !\nThe related payment term is probably misconfigured as it gives a computed amount greater than the total invoiced amount. The latest line of your payment term must be of type 'balance' to avoid rounding issues."))
# one move line per tax line
iml += ait_obj.move_line_get(cr, uid, inv.id)
@ -855,8 +863,8 @@ class account_invoice(osv.osv):
name = inv['name'] or '/'
totlines = False
if inv.payment_term:
totlines = self.pool.get('account.payment.term').compute(cr,
uid, inv.payment_term.id, total, inv.date_invoice or False)
totlines = payment_term_obj.compute(cr,
uid, inv.payment_term.id, total, inv.date_invoice or False, context=ctx)
if totlines:
res_amount_currency = total_currency
i = 0
@ -880,7 +888,7 @@ class account_invoice(osv.osv):
'account_id': acc_id,
'date_maturity': t[0],
'amount_currency': diff_currency_p \
and amount_currency or False,
and amount_currency or False,
'currency_id': diff_currency_p \
and inv.currency_id.id or False,
'ref': ref,
@ -902,12 +910,12 @@ class account_invoice(osv.osv):
date = inv.date_invoice or time.strftime('%Y-%m-%d')
part = inv.partner_id.id
line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x, part, date, context={})),iml)
line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x, part, date, context=ctx)),iml)
line = self.group_lines(cr, uid, iml, line, inv)
journal_id = inv.journal_id.id
journal = self.pool.get('account.journal').browse(cr, uid, journal_id)
journal = journal_obj.browse(cr, uid, journal_id, context=ctx)
if journal.centralisation:
raise osv.except_osv(_('UserError'),
_('You cannot create an invoice on a centralised journal. Uncheck the centralised counterpart box in the related journal from the configuration menu.'))
@ -919,26 +927,26 @@ class account_invoice(osv.osv):
'line_id': line,
'journal_id': journal_id,
'date': date,
'type': entry_type,
'narration':inv.comment
}
period_id = inv.period_id and inv.period_id.id or False
ctx.update({'company_id': inv.company_id.id})
if not period_id:
period_ids = self.pool.get('account.period').search(cr, uid, [('date_start','<=',inv.date_invoice or time.strftime('%Y-%m-%d')),('date_stop','>=',inv.date_invoice or time.strftime('%Y-%m-%d')), ('company_id', '=', inv.company_id.id)])
if period_ids:
period_id = period_ids[0]
period_ids = period_obj.find(cr, uid, inv.date_invoice, context=ctx)
period_id = period_ids and period_ids[0] or False
if period_id:
move['period_id'] = period_id
for i in line:
i[2]['period_id'] = period_id
move_id = self.pool.get('account.move').create(cr, uid, move, context=context)
new_move_name = self.pool.get('account.move').browse(cr, uid, move_id).name
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})
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:
self.pool.get('account.move').post(cr, uid, [move_id], context={'invoice':inv})
ctx.update({'invoice':inv})
move_obj.post(cr, uid, [move_id], context=ctx)
self._log_event(cr, uid, ids)
return True
@ -1077,7 +1085,8 @@ class account_invoice(osv.osv):
del line['invoice_id']
for field in ('company_id', 'partner_id', 'account_id', 'product_id',
'uos_id', 'account_analytic_id', 'tax_code_id', 'base_code_id'):
line[field] = line.get(field, False) and line[field][0]
if line.get(field):
line[field] = line[field][0]
if 'invoice_line_tax_id' in line:
line['invoice_line_tax_id'] = [(6,0, line.get('invoice_line_tax_id', [])) ]
return map(lambda x: (0,0,x), lines)
@ -1205,7 +1214,7 @@ class account_invoice(osv.osv):
l2['name'] = name
lines = [(0, 0, l1), (0, 0, l2)]
move = {'ref': ref, 'line_id': lines, 'journal_id': pay_journal_id, 'period_id': period_id, 'date': date, 'type': entry_type}
move = {'ref': ref, 'line_id': lines, 'journal_id': pay_journal_id, 'period_id': period_id, 'date': date}
move_id = self.pool.get('account.move').create(cr, uid, move, context=context)
line_ids = []
@ -1323,9 +1332,9 @@ class account_invoice_line(osv.osv):
raise osv.except_osv(_('No Partner Defined !'),_("You must first select a partner !") )
if not product:
if type in ('in_invoice', 'in_refund'):
return {'value': {'categ_id': False}, 'domain':{'product_uom':[]}}
return {'value': {}, 'domain':{'product_uom':[]}}
else:
return {'value': {'price_unit': 0.0, 'categ_id': False}, 'domain':{'product_uom':[]}}
return {'value': {'price_unit': 0.0}, 'domain':{'product_uom':[]}}
part = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
fpos_obj = self.pool.get('account.fiscal.position')
fpos = fposition_id and fpos_obj.browse(cr, uid, fposition_id, context=context) or False
@ -1353,6 +1362,17 @@ class account_invoice_line(osv.osv):
taxes = res.supplier_taxes_id and res.supplier_taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a, context=context).tax_ids or False)
tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes)
if type in ('in_invoice','in_refund') and tax_id and price_unit:
tax_pool = self.pool.get('account.tax')
tax_browse = tax_pool.browse(cr, uid, tax_id)
if not isinstance(tax_browse, list):
tax_browse = [tax_browse]
taxes = tax_pool.compute_inv(cr, uid, tax_browse, price_unit, 1)
tax_amount = reduce(lambda total, tax_dict: total + tax_dict.get('amount', 0.0), taxes, 0.0)
price_unit = price_unit - tax_amount
if qty != 0:
price_unit = price_unit / float(qty)
if type in ('in_invoice', 'in_refund'):
result.update( {'price_unit': price_unit or res.standard_price,'invoice_line_tax_id': tax_id} )
else:
@ -1367,7 +1387,6 @@ class account_invoice_line(osv.osv):
if res2:
domain = {'uos_id':[('category_id','=',res2 )]}
result['categ_id'] = res.categ_id.id
res_final = {'value':result, 'domain':domain}
if not company_id or not currency_id:
@ -1559,6 +1578,7 @@ 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, inv.address_invoice_id.id, 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']
@ -1627,12 +1647,7 @@ class res_partner(osv.osv):
}
def copy(self, cr, uid, id, default=None, context=None):
if default is None:
default = {}
if context is None:
context = {}
default = default or {}
default.update({'invoice_ids' : []})
return super(res_partner, self).copy(cr, uid, id, default, context)

View File

@ -120,7 +120,7 @@
<field name="number"/>
<field name="partner_id" groups="base.group_user"/>
<field name="reference" invisible="1"/>
<field name="name"/>
<field name="name" invisible="1"/>
<field name="journal_id" invisible="1"/>
<field name="period_id" invisible="1" groups="account.group_account_user"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
@ -152,8 +152,8 @@
<field name="currency_id" width="50"/>
<button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}" groups="account.group_account_user"/>
<newline/>
<field string="Supplier" name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}"/>
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
<field string="Supplier" name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}" options='{"quick_create": false}'/>
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id" context="{'default_partner_id': partner_id}" options='{"quick_create": false}'/>
<field name="fiscal_position" groups="base.group_extended" widget="selection"/>
<newline/>
<field name="date_invoice"/>
@ -208,10 +208,10 @@
<field name="state" widget="statusbar" statusbar_visible="draft,open,paid" statusbar_colors='{"proforma":"blue","proforma2":"blue"}'/>
<field name="residual"/>
<group col="6" colspan="4">
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel" groups="base.group_no_one"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="terp-stock_effects-object-colorize"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Refund' states='open,paid' icon="gtk-execute"/>
<button name="%(action_account_state_open)d" type='action' string='Re-Open' states='paid' icon="gtk-convert" groups="base.group_no_one"/>
<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)]}" icon="gtk-convert" 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="invoice_open" states="draft,proforma2" string="Approve" icon="terp-camera_test"/>
</group>
</group>
@ -234,6 +234,7 @@
<field name="payment_ids" colspan="4" nolabel="1" >
<tree string="Payments">
<field name="date" string="Payment Date"/>
<field name="move_id"/>
<field name="ref"/>
<field name="name" groups="base.group_extended"/>
<field name="journal_id"/>
@ -262,21 +263,19 @@
<field name="currency_id" width="50"/>
<button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}" groups="account.group_account_user"/>
<newline/>
<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}"/>
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
<field name="fiscal_position" groups="base.group_extended" widget="selection"/>
<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}" options='{"quick_create": false}'/>
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id" context="{'default_partner_id': partner_id}" options='{"quick_create": false}'/>
<field name="fiscal_position" groups="base.group_extended" widget="selection" options='{"quick_create": false}'/>
<newline/>
<field name="date_invoice"/>
<field name="period_id" domain="[('state', '=', 'draft')]" groups="account.group_account_user" widget="selection"/>
<group colspan="2" col="1" groups="account.group_account_user">
<label align="0.0" string="(keep empty to use the current period)"/>
</group>
<field name="payment_term" widget="selection"/>
<newline/>
<field domain="[('company_id', '=', company_id),('type','=', 'receivable')]" name="account_id" groups="account.group_account_user"/>
<field name="name" groups="base.group_extended"/>
</group>
<notebook colspan="4">
<page string="Invoice">
<field domain="[('company_id', '=', company_id),('type','=', 'receivable')]" name="account_id" groups="account.group_account_user"/>
<field name="name"/>
<field name="payment_term" widget="selection"/>
<field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list" context="{'type': type}"/>
<group col="1" colspan="2">
<field name="tax_line" nolabel="1">
@ -302,11 +301,11 @@
<field name="state" widget="statusbar" statusbar_visible="draft,open,paid" statusbar_colors='{"proforma":"blue","proforma2":"blue"}'/>
<field name="residual"/>
<group col="8" colspan="4" groups="base.group_user">
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel" groups="base.group_no_one"/>
<button name="action_cancel_draft" states="cancel" string="Reset to Draft" type="object" icon="terp-stock_effects-object-colorize"/>
<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)]}" icon="gtk-convert" 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="%(action_account_invoice_refund)d" type='action' string='Refund' states='open,paid' icon="gtk-execute"/>
<button name='%(action_account_state_open)d' type='action' string='Re-Open' states='paid' icon="gtk-convert" groups="base.group_no_one"/>
<button name="invoice_proforma2" states="draft" string="PRO-FORMA" icon="terp-gtk-media-pause" groups="account.group_account_user"/>
<button name="invoice_open" states="draft,proforma2" string="Validate" icon="gtk-go-forward"/>
<button name="%(account_invoices)d" string="Print Invoice" type="action" icon="gtk-print" states="open,paid,proforma,sale,proforma2"/>
@ -332,6 +331,7 @@
<field name="payment_ids" colspan="4" nolabel="1">
<tree string="Payments">
<field name="date"/>
<field name="move_id"/>
<field name="ref"/>
<field name="name"/>
<field name="journal_id" groups="base.group_user"/>
@ -360,13 +360,13 @@
<separator orientation="vertical"/>
<filter name="unpaid" icon="terp-dolar_ok!" string="Unpaid" domain="[('state','=','open')]" help="Unpaid Invoices"/>
<separator orientation="vertical"/>
<field name="number"/>
<field name="number"
string="Reference"
filter_domain="['|', ('number','ilike',self),('origin','ilike',self)]"/>
<field name="partner_id"/>
<field name="user_id" widget="selection" string="Salesman">
<filter domain="[('user_id','=',uid)]" help="My invoices" icon="terp-personal" />
<filter domain="[('user_id','=',uid)]" help="My invoices" icon="terp-personal" />
</field>
<field name="origin"/>
<field name="amount_total"/>
</group>
<newline/>
<group>
@ -430,7 +430,7 @@
<field name="view_mode">tree,form,calendar,graph</field>
<field eval="False" name="view_id"/>
<field name="domain">[('type','=','out_invoice')]</field>
<field name="context">{'type':'out_invoice', 'journal_type': 'sale'}</field>
<field name="context">{'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale'}</field>
<field name="search_view_id" ref="view_account_invoice_filter"/>
<field name="help">With Customer Invoices you can create and manage sales invoices issued to your customers. OpenERP can also generate draft invoices automatically from sales orders or deliveries. You should only confirm them before sending them to your customers.</field>
</record>
@ -458,7 +458,7 @@
<field name="view_mode">tree,form,calendar,graph</field>
<field eval="False" name="view_id"/>
<field name="domain">[('type','=','in_invoice')]</field>
<field name="context">{'type':'in_invoice', 'journal_type': 'purchase'}</field>
<field name="context">{'default_type': 'in_invoice', 'type': 'in_invoice', 'journal_type': 'purchase'}</field>
<field name="search_view_id" ref="view_account_invoice_filter"/>
<field name="help">With Supplier Invoices you can enter and manage invoices issued by your suppliers. OpenERP can also generate draft invoices automatically from purchase orders or receipts. This way, you can control the invoice from your supplier according to what you purchased or received.</field>
</record>
@ -471,7 +471,7 @@
<field name="view_mode">tree,form,calendar,graph</field>
<field eval="False" name="view_id"/>
<field name="domain">[('type','=','out_refund')]</field>
<field name="context">{'type':'out_refund', 'journal_type': 'sale_refund'}</field>
<field name="context">{'default_type':'out_refund', 'type':'out_refund', 'journal_type': 'sale_refund'}</field>
<field name="search_view_id" ref="view_account_invoice_filter"/>
<field name="help">With Customer Refunds you can manage the credit notes for your customers. A refund is a document that credits an invoice completely or partially. You can easily generate refunds and reconcile them directly from the invoice form.</field>
</record>
@ -497,7 +497,7 @@
<field name="view_mode">tree,form,calendar,graph</field>
<field eval="False" name="view_id"/>
<field name="domain">[('type','=','in_refund')]</field>
<field name="context">{'type':'in_refund', 'journal_type': 'purchase_refund'}</field>
<field name="context">{'default_type': 'in_refund', 'type': 'in_refund', 'journal_type': 'purchase_refund'}</field>
<field name="search_view_id" ref="view_account_invoice_filter"/>
<field name="help">With Supplier Refunds you can manage the credit notes you receive from your suppliers. A refund is a document that credits an invoice completely or partially. You can easily generate refunds and reconcile them directly from the invoice form.</field>
</record>

View File

@ -43,6 +43,7 @@
<menuitem id="menu_finance_statistic_report_statement" name="Statistic Reports" parent="menu_finance_reporting" sequence="300"/>
<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
parent="account.menu_finance_legal_statement"
id="final_accounting_reports"

View File

@ -94,7 +94,7 @@ class account_move_line(osv.osv):
if initial_bal and not context.get('periods', False) and not where_move_lines_by_date:
#we didn't pass any filter in the context, and the initial balance can't be computed using only the fiscalyear otherwise entries will be summed twice
#so we have to invalidate this query
raise osv.except_osv(_('Warning !'),_("You haven't supplied enough argument to compute the initial balance"))
raise osv.except_osv(_('Warning !'),_("You haven't supplied enough argument to compute the initial balance, please select a period and journal in the context."))
if context.get('journal_ids', False):
@ -559,6 +559,8 @@ class account_move_line(osv.osv):
'state': 'draft',
'currency_id': _get_currency,
'journal_id': lambda self, cr, uid, c: c.get('journal_id', False),
'credit': 0.0,
'debit': 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)
@ -579,14 +581,14 @@ class account_move_line(osv.osv):
lines = self.browse(cr, uid, ids, context=context)
for l in lines:
if l.account_id.type == 'view':
return False
raise osv.except_osv(_('Error :'), _('You can not create journal items on a "view" account %s %s') % (l.account_id.code, l.account_id.name))
return True
def _check_no_closed(self, cr, uid, ids, context=None):
lines = self.browse(cr, uid, ids, context=context)
for l in lines:
if l.account_id.type == 'closed':
return False
raise osv.except_osv(_('Error :'), _('You can not create journal items on a closed account %s %s') % (l.account_id.code, l.account_id.name))
return True
def _check_company_id(self, cr, uid, ids, context=None):
@ -603,11 +605,19 @@ class account_move_line(osv.osv):
return False
return True
def _check_currency(self, cr, uid, ids, context=None):
for l in self.browse(cr, uid, ids, context=context):
if l.account_id.currency_id:
if not l.currency_id or not l.currency_id.id == l.account_id.currency_id.id:
return False
return True
_constraints = [
(_check_no_view, 'You can not create move line on view account.', ['account_id']),
(_check_no_closed, 'You can not create move line on closed account.', ['account_id']),
(_check_company_id, 'Company must be same for its related account and period.',['company_id'] ),
(_check_date, 'The date of your Journal Entry is not in the defined period!',['date'] ),
(_check_no_view, 'You can not create journal items on an account of type view.', ['account_id']),
(_check_no_closed, 'You can not create journal items on closed account.', ['account_id']),
(_check_company_id, 'Company must be the same for its related account and period.', ['company_id']),
(_check_date, 'The date of your Journal Entry is not in the defined period! You should change the date or remove this constraint from the journal.', ['date']),
(_check_currency, 'The selected account of your Journal Entry forces to provide a secondary currency. You should remove the secondary currency on the account or select a multi-currency view on the journal.', ['currency_id']),
]
#TODO: ONCHANGE_ACCOUNT_ID: set account_tax_id
@ -741,7 +751,10 @@ class account_move_line(osv.osv):
company_list.append(line.company_id.id)
for line in self.browse(cr, uid, ids, context=context):
company_currency_id = line.company_id.currency_id
if line.account_id.currency_id:
currency_id = line.account_id.currency_id
else:
currency_id = line.company_id.currency_id
if line.reconcile_id:
raise osv.except_osv(_('Warning'), _('Already Reconciled!'))
if line.reconcile_partial_id:
@ -749,12 +762,18 @@ class account_move_line(osv.osv):
if not line2.reconcile_id:
if line2.id not in merges:
merges.append(line2.id)
total += (line2.debit or 0.0) - (line2.credit or 0.0)
if line2.account_id.currency_id:
total += line2.amount_currency
else:
total += (line2.debit or 0.0) - (line2.credit or 0.0)
merges_rec.append(line.reconcile_partial_id.id)
else:
unmerge.append(line.id)
total += (line.debit or 0.0) - (line.credit or 0.0)
if self.pool.get('res.currency').is_zero(cr, uid, company_currency_id, total):
if line.account_id.currency_id:
total += line.amount_currency
else:
total += (line.debit or 0.0) - (line.credit or 0.0)
if self.pool.get('res.currency').is_zero(cr, uid, currency_id, total):
res = self.reconcile(cr, uid, merges+unmerge, context=context, writeoff_acc_id=writeoff_acc_id, writeoff_period_id=writeoff_period_id, writeoff_journal_id=writeoff_journal_id)
return res
r_id = move_rec_obj.create(cr, uid, {
@ -813,7 +832,7 @@ class account_move_line(osv.osv):
raise osv.except_osv(_('Error'), _('Entry is already reconciled'))
account = account_obj.browse(cr, uid, account_id, context=context)
if not context.get('fy_closing', False) and not account.reconcile:
raise osv.except_osv(_('Error'), _('The account is not defined to be reconciled !'))
raise osv.except_osv(_('Error'), _('This account does not allow reconciliation! You should update the account definition to change this.'))
if r[0][1] != None:
raise osv.except_osv(_('Error'), _('Some entries are already reconciled !'))
@ -1065,8 +1084,6 @@ class account_move_line(osv.osv):
f.set("invisible", "context.get('journal_id', False)")
elif field in ('period_id',):
f.set("invisible", "context.get('period_id', False)")
else:
f.set('invisible', "context.get('visible_id') not in %s" % (fields.get(field)))
orm.setup_modifiers(f, fields_get[field], context=context,
in_tree_view=True)
@ -1195,9 +1212,9 @@ class account_move_line(osv.osv):
for line in self.browse(cr, uid, ids, context=context):
err_msg = _('Move name (id): %s (%s)') % (line.move_id.name, str(line.move_id.id))
if line.move_id.state <> 'draft' and (not line.journal_id.entry_posted):
raise osv.except_osv(_('Error !'), _('You can not do this modification on a confirmed entry ! Please note that you can just change some non important fields ! \n%s') % err_msg)
raise osv.except_osv(_('Error !'), _('You can not do this modification on a confirmed entry! You can just change some non legal fields or you must unconfirm the journal entry first! \n%s') % err_msg)
if line.reconcile_id:
raise osv.except_osv(_('Error !'), _('You can not do this modification on a reconciled entry ! Please note that you can just change some non important fields ! \n%s') % err_msg)
raise osv.except_osv(_('Error !'), _('You can not do this modification on a reconciled entry! You can just change some non legal fields or you must unreconcile first!\n%s') % err_msg)
t = (line.journal_id.id, line.period_id.id)
if t not in done:
self._update_journal_check(cr, uid, line.journal_id.id, line.period_id.id, context)
@ -1226,6 +1243,14 @@ class account_move_line(osv.osv):
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)):
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(_('Encoding error'), _('No period found or more than one period found for the given date.'))
context['period_id'] = period_candidate_ids[0][0]
if not context.get('journal_id', False) and context.get('search_default_journal_id', False):
context['journal_id'] = context.get('search_default_journal_id')
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)
@ -1307,7 +1332,7 @@ class account_move_line(osv.osv):
base_sign = 'base_sign'
tax_sign = 'tax_sign'
tmp_cnt = 0
for tax in tax_obj.compute_all(cr, uid, [tax_id], total, 1.00).get('taxes'):
for tax in tax_obj.compute_all(cr, uid, [tax_id], total, 1.00, force_excluded=True).get('taxes'):
#create the base movement
if tmp_cnt == 0:
if tax[base_code]:
@ -1319,8 +1344,6 @@ class account_move_line(osv.osv):
else:
data = {
'move_id': vals['move_id'],
'journal_id': vals['journal_id'],
'period_id': vals['period_id'],
'name': tools.ustr(vals['name'] or '') + ' ' + tools.ustr(tax['name'] or ''),
'date': vals['date'],
'partner_id': vals.get('partner_id',False),
@ -1337,8 +1360,6 @@ class account_move_line(osv.osv):
#create the VAT movement
data = {
'move_id': vals['move_id'],
'journal_id': vals['journal_id'],
'period_id': vals['period_id'],
'name': tools.ustr(vals['name'] or '') + ' ' + tools.ustr(tax['name'] or ''),
'date': vals['date'],
'partner_id': vals.get('partner_id',False),

View File

@ -0,0 +1,22 @@
-
I configure automatically if the country is set on the company, mainly for online offers.
-
!python {model: account.installer}: |
modules = self.pool.get('ir.module.module')
wizards = self.pool.get('ir.actions.todo')
wiz = wizards.browse(cr, uid, ref('account.account_configuration_installer_todo'))
part = self.pool.get('res.partner').browse(cr, uid, ref('base.main_partner'))
# if we know the country and the wizard has not yet been executed, we do it
if (part.country.id) and (wiz.state=='open'):
mod = 'l10n_'+part.country.code.lower()
ids = modules.search(cr, uid, [ ('name','=',mod) ], context=context)
if ids:
wizards.write(cr, uid, [ref('account.account_configuration_installer_todo')], {
'state': 'done'
})
wiz_id = self.create(cr, uid, {
'charts': mod
})
self.execute_simple(cr, uid, [wiz_id])
modules.state_update(cr, uid, ids,
'to install', ['uninstalled'], context=context)

View File

@ -18,7 +18,8 @@
name="account.invoice"
rml="account/report/account_print_invoice.rml"
string="Invoices"
attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/',''))"
attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
usage="default"
multi="True"/>
<report id="account_transfers" model="account.transfer" name="account.transfer" string="Transfers" xml="account/report/transfer.xml" xsl="account/report/transfer.xsl"/>
<report auto="False" id="account_intracom" menu="False" model="account.move.line" name="account.intracom" string="IntraCom"/>

View File

@ -171,8 +171,8 @@
<field name="user_type" select="1"/>
<field name="active" groups="base.group_extended" />
<newline/>
<field name="debit" invisible="context.get('config_invisible', True)"/>
<field name="credit" invisible="context.get('config_invisible', True)"/>
<field name="debit" invisible="context.get('config_invisible', True)" attrs="{'readonly':[('type','=','view')]}"/>
<field name="credit" invisible="context.get('config_invisible', True)" attrs="{'readonly':[('type','=','view')]}"/>
<field name="balance" invisible="context.get('config_invisible', True)"/>
</group>
<notebook colspan="4">
@ -295,6 +295,44 @@
<field name="domain">[('parent_id','=',False)]</field>
</record>
<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="type">tree</field>
<field name="arch" type="xml">
<tree string="Unrealized Gains and losses">
<field name="code"/>
<field name="name"/>
<field name="parent_id" invisible="1"/>
<field name="user_type" invisible="1"/>
<field name="type" invisible="1"/>
<field name="currency_id"/>
<field name="exchange_rate"/>
<field name="foreign_balance"/>
<field name="adjusted_balance"/>
<field name="balance"/>
<field name="unrealized_gain_loss"/>
</tree>
</field>
</record>
<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>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_account_gain_loss_tree"/>
<field name="domain">[('currency_id','!=',False)]</field>
<field name="help">When doing multi-currency transactions, you may loose or gain some amount due to changes of exchange rate. This menu gives you a forecast of the Gain or Loss you'd realized if those transactions were ended today. Only for accounts having a secondary currency set.</field>
</record>
<menuitem
name="Unrealized Gain or Loss"
action="action_account_gain_loss"
groups="account.group_account_user"
id="menu_unrealized_gains_losses"
parent="account.menu_multi_currency"/>
<!--
Journal
@ -439,7 +477,7 @@
<separator string="Company" colspan="4"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="user_id" groups="base.group_extended"/>
<field name="currency"/>
<field name="currency" groups="base.group_extended"/>
</group>
<group colspan="2" col="2" groups="base.group_extended">
<separator string="Validations" colspan="4"/>
@ -455,9 +493,9 @@
<!-- <field name="invoice_sequence_id"/>-->
<field name="group_invoice_lines"/>
</group>
<group colspan="2" col="2" groups="base.group_extended">
<group colspan="2" col="2"> <!-- can't set the field as hidden for certain groups as it's required in the object and not in the view, and GTK doesn't handle that correctly -->
<separator string="Sequence" colspan="4"/>
<field name="sequence_id"/>
<field name="sequence_id" required="0"/>
</group>
</page>
<page string="Entry Controls" groups="base.group_extended">
@ -752,7 +790,6 @@
<group col="2" colspan="2">
<separator string="Reporting Configuration" colspan="4"/>
<field name="report_type" select="2"/>
<field name="sign" />
</group>
<group col="2" colspan="2">
<separator string="Closing Method" colspan="4"/>
@ -1201,8 +1238,8 @@
</group>
<newline/>
<group>
<field name="journal_id" widget="selection" context="{'journal_id':self, 'visible_id':self, 'normal_view':False}"/>
<field name="period_id" context="{'period_id':self, 'search_default_period_id':self}"/>
<field name="journal_id" widget="selection" context="{'journal_id':self}"/>
<field name="period_id" context="{'period_id':self}"/>
</group>
<newline/>
<group expand="0" string="Group By...">
@ -1272,7 +1309,6 @@
<field name="model">account.account</field>
<field name="name">Open Journal Items</field>
<field eval="'ir.actions.act_window,%d'%action_move_line_select" name="value"/>
<field eval="True" name="object"/>
</record>
<!--
Account.Entry Edition
@ -1550,7 +1586,12 @@
context="{'search_default_account_id':[active_id], 'search_default_unreconciled':1, 'default_account_id': active_id}"
src_model="account.account"/>
<act_window domain="[('reconcile_id', '=', active_id)]" id="act_account_acount_move_line_reconcile_open" name="Reconciled entries" res_model="account.move.line" src_model="account.move.reconcile"/>
<act_window
domain="[('reconcile_id', '=', active_id)]"
id="act_account_acount_move_line_reconcile_open"
name="Reconciled entries"
res_model="account.move.line"
src_model="account.move.reconcile"/>
<!--
@ -1592,7 +1633,7 @@
<tree string="Journal Entry Model Line" editable="bottom">
<field name="sequence"/>
<field name="name"/>
<field name="account_id"/>
<field name="account_id" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation'), ('company_id', '=', parent.company_id)]"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
<field name="partner_id"/>
<field name="debit"/>
@ -1611,12 +1652,12 @@
<form string="Journal Entry Model Line">
<field colspan="4" name="name" select="1"/>
<field name="sequence"/>
<field name="account_id" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="account_id" domain="[('type','&lt;&gt;','view'), ('type','&lt;&gt;','consolidation'), ('company_id', '=', parent.company_id)]"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
<field name="partner_id"/>
<field name="debit" select="1"/>
<field name="credit" select="1"/>
<field name="quantity"/>
<field name="quantity"/>
<field name="date_maturity"/>
</form>
</field>
@ -1714,35 +1755,37 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Payment Term">
<field name="name" select="1"/>
<field name="sequence"/>
<group colspan="2" col="4">
<separator string="Amount Computation" colspan="4"/>
<field name="value" colspan="4"/>
<field name="value_amount" colspan="4" attrs="{'readonly':[('value','=','balance')]}"/>
<group>
<group colspan="2" col="4">
<field name="name" select="1"/>
<separator string="Amount Computation" colspan="4"/>
<field name="value" colspan="4"/>
<field name="value_amount" colspan="4" attrs="{'readonly':[('value','=','balance')]}"/>
</group>
<group colspan="2" col="4">
<field name="sequence"/>
<separator string="Due Date Computation" colspan="4"/>
<field name="days" colspan="4"/>
<field name="days2" colspan="4"/>
</group>
</group>
<group colspan="2" col="4">
<separator string="Due date Computation" colspan="4"/>
<field name="days" colspan="4"/>
<field name="days2" colspan="4"/>
</group>
<label string=""/>
<newline/>
<label string="Example: at 14 net days 2 percents, remaining amount at 30 days end of month." colspan="4"/>
<separator string="Example" colspan="4"/>
<label string="At 14 net days 2 percent, remaining amount at 30 days end of month." colspan="4"/>
<group colspan="2" col="2">
<label string="Line 1:" colspan="2"/>
<label string=" valuation: percent"/>
<label string=" number of days: 14"/>
<label string=" value amount: 0.02"/>
<label string=" day of the month: 0"/>
<label string=" Valuation: Percent"/>
<label string=" Number of Days: 14"/>
<label string=" Value amount: 0.02"/>
<label string=" Day of the Month: 0"/>
</group>
<newline/>
<group colspan="2" col="2">
<label string="Line 2:" colspan="2"/>
<label string=" valuation: balance"/>
<label string=" number of days: 30"/>
<label string=" value amount: n.a"/>
<label string=" day of the month= -1"/>
<label string=" Valuation: Balance"/>
<label string=" Number of Days: 30"/>
<label string=" Value amount: n.a"/>
<label string=" Day of the Month= -1"/>
</group>
</form>
</field>
@ -1769,7 +1812,7 @@
<separator colspan="4" string="Information"/>
<field name="name" select="1"/>
<field name="active" select="1"/>
<separator colspan="4" string="Description on invoices"/>
<separator colspan="4" string="Description On Invoices"/>
<field colspan="4" name="note" nolabel="1"/>
<separator colspan="4" string="Computation"/>
<field colspan="4" name="line_ids" nolabel="1"/>
@ -1981,7 +2024,6 @@
<field name="model">account.tax.code</field>
<field name="name">Tax Details</field>
<field eval="'ir.actions.act_window,%d'%action_tax_code_line_open" name="value"/>
<field eval="True" name="object"/>
</record>
@ -2003,7 +2045,14 @@
res_model="account.move.line"
src_model="account.journal"/>
<act_window context="{'search_default_reconcile_id':False, '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" res_model="account.move.line" src_model="res.partner" groups="base.group_extended"/>
<act_window
context="{'search_default_reconcile_id':False, '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"
res_model="account.move.line"
src_model="res.partner"
groups="base.group_extended"/>
<act_window context="{'search_default_partner_id':[active_id], 'default_partner_id': active_id}" id="act_account_partner_account_move" name="Journal Items" res_model="account.move.line" src_model="res.partner" groups="account.group_account_user"/>
@ -2068,6 +2117,7 @@
<field name="currency_id"/>
<field name="reconcile"/>
<field name="chart_template_id"/>
<separator string="Default taxes" colspan="4"/>
<field name="tax_ids" colspan="4" nolabel="1"/>
</page>
@ -2138,9 +2188,13 @@
<form string="Chart of Accounts Template">
<group>
<field name="name"/>
<field name="account_root_id"/>
<field name="bank_account_view_id"/>
<field name="tax_code_root_id"/>
<field name="account_root_id" attrs="{'required': [('parent_id', '=', False)]}"/>
<field name="bank_account_view_id" attrs="{'required': [('parent_id', '=', False)]}"/>
<field name="tax_code_root_id" attrs="{'required': [('parent_id', '=', False)]}"/>
<field name="parent_id" />
<!--<field name="code_digits" />-->
<field name="visible" />
<field name="complete_tax_set" />
</group>
<field name="tax_template_ids" colspan="4" readonly="1" nolabel="1"/>
<separator string="Properties" colspan="4"/>
@ -2224,7 +2278,9 @@
<field name="chart_template_id"/>
<field name="type"/>
<field name="type_tax_use"/>
<field name="price_include"/>
<group colspan="2" col="4">
<field name="price_include"/>
</group>
</group>
<notebook colspan="4">
<page string="Tax Definition">
@ -2391,10 +2447,14 @@
<group string="res_config_contents" position="replace">
<field name="company_id" widget="selection"/> <!-- we assume that this wizard will be run only by administrators and as this field may cause problem if hidden (because of the default company of the user removed from the selection because already configured), we simply choosed to remove the group "multi company" of it -->
<field name ="code_digits" groups="account.group_account_user"/>
<field name="chart_template_id" widget="selection" on_change="onchange_chart_template_id(chart_template_id)"/>
<field name ="seq_journal" groups="account.group_account_user"/>
<field name="sale_tax" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False),('type_tax_use','in',('sale','all'))]"/>
<field name="purchase_tax" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False),('type_tax_use','in',('purchase', 'all'))]"/>
<field name="chart_template_id" widget="selection" on_change="onchange_chart_template_id(chart_template_id)" domain="[('visible','=', True)]"/>
<field name ="seq_journal" groups="base.group_extended"/>
<field name="sale_tax" attrs="{'invisible': [('complete_tax_set', '!=', True)]}" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False),('type_tax_use','in',('sale','all'))]"/>
<field name="purchase_tax" attrs="{'invisible': [('complete_tax_set', '!=', True)]}" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False),('type_tax_use','in',('purchase', 'all'))]"/>
<newline/>
<field name ="sale_tax_rate" attrs="{'invisible': [('complete_tax_set', '=', True)]}" on_change="onchange_tax_rate(sale_tax_rate)"/>
<field name ="purchase_tax_rate" attrs="{'invisible': [('complete_tax_set', '=', True)]}"/>
<field name ="complete_tax_set" invisible="1"/>
<newline/> <!-- extended view because the web UI is not good for one2many -->
<field colspan="4" mode="tree" name="bank_accounts_id" nolabel="1" widget="one2many_list" groups="account.group_account_user">
<form string="Bank Information">
@ -2430,6 +2490,9 @@
<field eval="5" name="sequence"/>
<field name="code">
act_window_ids = pool.get('ir.actions.act_window').search(cr, uid,[('name', 'in', ('Accounting Chart Configuration', 'Generate Chart of Accounts from a Chart Template'))], context=context)
ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'action_account_configuration_installer')
if ref:
act_window_ids += [ref[1]]
todo_ids = pool.get('ir.actions.todo').search(cr, uid, [('action_id', 'in', act_window_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)
@ -2721,10 +2784,14 @@ action = pool.get('res.config').next(cr, uid, [], context)
<field name="parent_id"/>
<field name="sequence"/>
<field name="type"/>
<field name="sign"/>
</group>
<notebook colspan="4">
<page string="Report" attrs="{'invisible': [('state','!=','confirm')]}">
<field name="display_detail" attrs="{'invisible': [('type','!=','accounts')]}"/>
<notebook colspan="6">
<page string="Report">
<group colspan="4" col="4">
<field name="display_detail" attrs="{'invisible': [('type','not in',['accounts','account_type'])]}" colspan="2"/>
<label string="" colspan="2"/>
</group>
<newline/>
<field name="account_ids" nolabel="1" colspan="6" attrs="{'invisible': [('type', '!=', 'accounts')]}"/>
<newline/>
@ -2733,9 +2800,6 @@ action = pool.get('res.config').next(cr, uid, [], context)
<field name="account_type_ids" nolabel="1" attrs="{'invisible': [('type', '!=', 'account_type')]}"/>
<newline/>
</page>
<page string="Notes" attrs="{'invisible': [('state','!=','confirm')]}">
<field name="note" nolabel="1" colspan="4"/>
</page>
</notebook>
</form>
</field>

View File

@ -30,6 +30,7 @@
<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">
@ -38,17 +39,15 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Account Board">
<hpaned>
<child1>
<action colspan="4" height="160" width="400" name="%(account.action_invoice_tree1)d" string="Customer Invoices to Approve" domain="[('state','=','draft'),('type','=','out_invoice')]"/>
<action colspan="4" height="160" width="400" name="%(action_company_analysis_tree)d" string="Company Analysis" groups="account.group_account_manager"/>
</child1>
<child2>
<action colspan="4" height="220" name="%(action_treasory_graph)d" string="Treasury" groups="account.group_account_manager,account.group_account_user"/>
<action colspan="4" height="220" name="%(action_aged_receivable)d" string="Aged Receivables" groups="account.group_account_manager,account.group_account_user"/>
<!-- <action colspan="4" height="220" name="%(action_aged_income)d" string="Aged income"/> -->
</child2>
</hpaned>
<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"/> <!--groups="account.group_account_manager,account.group_account_user"-->
</column>
</board>
</form>
</field>
</record>

View File

@ -24,6 +24,7 @@ from osv import fields, osv
class res_company(osv.osv):
_inherit = "res.company"
_columns = {
'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',

View File

@ -24,6 +24,7 @@
<field name="arch" type="xml">
<field name="currency_id" position="after">
<field name="property_reserve_and_surplus_account" colspan="2"/>
<field name="paypal_account" />
</field>
</field>
</record>

View File

@ -1,26 +1,6 @@
<openerp>
<data>
<data noupdate="1">
<!-- Types -->
<record model="account.account.type" id="conf_account_type_receivable">
<field name="name">Receivable</field>
<field name="code">receivable</field>
<field name="report_type">income</field>
<field name="close_method">unreconciled</field>
</record>
<record model="account.account.type" id="conf_account_type_payable">
<field name="name">Payable</field>
<field name="code">payable</field>
<field name="report_type">expense</field>
<field name="close_method">unreconciled</field>
</record>
<record model="account.account.type" id="conf_account_type_view">
<field name="name">View</field>
<field name="code">view</field>
<field name="close_method">none</field>
</record>
<record model="account.account.type" id="account_type_income_view1">
<field name="name">Income View</field>
<field name="code">view</field>
@ -41,78 +21,32 @@
<field name="code">liability</field>
<field name="report_type">liability</field>
</record>
<record model="account.account.type" id="conf_account_type_income">
<field name="name">Income</field>
<field name="code">income</field>
<field name="report_type">income</field>
<field name="close_method">none</field>
</record>
<record model="account.account.type" id="conf_account_type_expense">
<field name="name">Expense</field>
<field name="code">expense</field>
<field name="report_type">expense</field>
<field name="close_method">none</field>
</record>
<record model="account.account.type" id="conf_account_type_tax">
<field name="name">Tax</field>
<field name="code">tax</field>
<field name="report_type">expense</field>
<field name="close_method">unreconciled</field>
<field name="report_type">expense</field>
</record>
<record model="account.account.type" id="conf_account_type_cash">
<field name="name">Cash</field>
<field name="code">cash</field>
<field name="report_type">asset</field>
<field name="close_method">balance</field>
</record>
<record model="account.account.type" id="conf_account_type_liability">
<field name="name">Liability</field>
<field name="code">liability</field>
<field name="report_type">liability</field>
<field name="close_method">balance</field>
</record>
<record model="account.account.type" id="conf_account_type_asset">
<field name="name">Asset</field>
<field name="code">asset</field>
<field name="report_type">asset</field>
<field name="close_method">balance</field>
</record>
<record model="account.account.type" id="conf_account_type_equity">
<field name="name">Equity</field>
<field name="code">equity</field>
<field name="close_method">balance</field>
<field name="report_type">liability</field>
<field name="close_method">balance</field>
</record>
<record model="account.account.type" id="conf_account_type_bnk">
<field name="name">Bank</field>
<field name="code">bank</field>
<field name="report_type">asset</field>
<field name="close_method">balance</field>
</record>
<record model="account.account.type" id="conf_account_type_chk">
<record model="account.account.type" id="conf_account_type_chk">
<field name="name">Check</field>
<field name="code">check</field>
<field name="report_type">asset</field>
<field name="close_method">balance</field>
<field name="report_type">asset</field>
</record>
<!-- Account Templates-->
<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="conf_account_type_view"/>
<field name="user_type" ref="data_account_type_view"/>
</record>
<!-- Balance Sheet -->
@ -122,7 +56,7 @@
<field name="name">Balance Sheet</field>
<field ref="conf_chart0" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="conf_account_type_view"/>
<field name="user_type" ref="data_account_type_view"/>
</record>
<record id="conf_fas" model="account.account.template">
@ -162,7 +96,7 @@
<field name="name">Purchased Stocks</field>
<field ref="conf_cas" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="conf_account_type_asset"/>
<field name="user_type" ref="data_account_type_asset"/>
</record>
<record id="conf_a_recv" model="account.account.template">
@ -171,7 +105,7 @@
<field ref="conf_cas" name="parent_id"/>
<field name="type">receivable</field>
<field eval="True" name="reconcile"/>
<field name="user_type" ref="conf_account_type_receivable"/>
<field name="user_type" ref="data_account_type_receivable"/>
</record>
<record id="conf_ova" model="account.account.template">
@ -179,7 +113,7 @@
<field name="name">Tax Paid</field>
<field ref="conf_cas" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="conf_account_type_asset"/>
<field name="user_type" ref="data_account_type_asset"/>
</record>
<record id="conf_bnk" model="account.account.template">
@ -195,49 +129,49 @@
<field name="name">Opening Income Account</field>
<field ref="conf_cas" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="conf_account_type_income"/>
<field name="user_type" ref="data_account_type_income"/>
</record>
<record id="conf_cli" model="account.account.template">
<field name="code">111</field>
<field name="code">12</field>
<field name="name">Current Liabilities</field>
<field ref="conf_nca" name="parent_id"/>
<field ref="conf_bal" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="account_type_liability_view1"/>
</record>
<record id="conf_a_pay" model="account.account.template">
<field name="code">1111</field>
<field name="code">120</field>
<field name="name">Creditors</field>
<field ref="conf_cli" name="parent_id"/>
<field name="type">payable</field>
<field eval="True" name="reconcile"/>
<field name="user_type" ref="conf_account_type_payable"/>
<field name="user_type" ref="data_account_type_payable"/>
</record>
<record id="conf_iva" model="account.account.template">
<field name="code">1112</field>
<field name="code">121</field>
<field name="name">Tax Received</field>
<field ref="conf_cli" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="conf_account_type_liability"/>
<field name="user_type" ref="data_account_type_liability"/>
</record>
<record id="conf_a_reserve_and_surplus" model="account.account.template">
<field name="code">1113</field>
<field name="code">122</field>
<field name="name">Reserve and Profit/Loss Account</field>
<field ref="conf_cli" name="parent_id"/>
<field name="type">other</field>
<field eval="True" name="reconcile"/>
<field name="user_type" ref="conf_account_type_liability"/>
<field name="user_type" ref="data_account_type_liability"/>
</record>
<record id="conf_o_expense" model="account.account.template">
<field name="code">1114</field>
<field name="code">123</field>
<field name="name">Opening Expense Account</field>
<field ref="conf_cli" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="conf_account_type_expense"/>
<field name="user_type" ref="data_account_type_expense"/>
</record>
<!-- Profit and Loss -->
@ -247,7 +181,7 @@
<field name="name">Profit and Loss</field>
<field ref="conf_chart0" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="conf_account_type_view"/>
<field name="user_type" ref="data_account_type_view"/>
</record>
<record id="conf_rev" model="account.account.template">
@ -263,7 +197,7 @@
<field name="name">Product Sales</field>
<field ref="conf_rev" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="conf_account_type_income"/>
<field name="user_type" ref="data_account_type_income"/>
</record>
<record id="conf_cos" model="account.account.template">
@ -279,7 +213,7 @@
<field name="name">Cost of Goods Sold</field>
<field ref="conf_cos" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="conf_account_type_expense"/>
<field name="user_type" ref="data_account_type_expense"/>
</record>
<record id="conf_ovr" model="account.account.template">
@ -295,7 +229,7 @@
<field name="name">Expenses</field>
<field ref="conf_ovr" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="conf_account_type_expense"/>
<field name="user_type" ref="data_account_type_expense"/>
</record>
<record id="conf_a_salary_expense" model="account.account.template">
@ -303,7 +237,7 @@
<field name="name">Salary Expenses</field>
<field ref="conf_ovr" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="conf_account_type_expense"/>
<field name="user_type" ref="data_account_type_expense"/>
</record>
<!-- Taxes -->
@ -448,6 +382,7 @@
<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>
<!-- VAT Codes -->

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record model="account.account.type" id="data_account_type_view">
<field name="name">View</field>
<field name="code">view</field>
<field name="close_method">none</field>
</record>
<record model="account.account.type" id="data_account_type_receivable">
<field name="name">Receivable</field>
<field name="code">receivable</field>
<field name="close_method">unreconciled</field>
</record>
<record model="account.account.type" id="data_account_type_payable">
<field name="name">Payable</field>
<field name="code">payable</field>
<field name="close_method">unreconciled</field>
</record>
<record model="account.account.type" id="data_account_type_bank">
<field name="name">Bank</field>
<field name="code">bank</field>
<field name="close_method">balance</field>
</record>
<record model="account.account.type" id="data_account_type_cash">
<field name="name">Cash</field>
<field name="code">cash</field>
<field name="close_method">balance</field>
</record>
<record model="account.account.type" id="data_account_type_asset">
<field name="name">Asset</field>
<field name="code">asset</field>
<field name="close_method">balance</field>
<field name="report_type">asset</field>
</record>
<record model="account.account.type" id="data_account_type_liability">
<field name="name">Liability</field>
<field name="code">liability</field>
<field name="close_method">balance</field>
<field name="report_type">liability</field>
</record>
<record model="account.account.type" id="data_account_type_income">
<field name="name">Income</field>
<field name="code">income</field>
<field name="close_method">none</field>
<field name="report_type">income</field>
</record>
<record model="account.account.type" id="data_account_type_expense">
<field name="name">Expense</field>
<field name="code">expense</field>
<field name="close_method">none</field>
<field name="report_type">expense</field>
</record>
</data>
</openerp>

View File

@ -7,7 +7,7 @@
-->
<record id="data_fiscalyear" model="account.fiscalyear">
<field eval="'Fiscal Year '+time.strftime('%Y')" name="name"/>
<field eval="'Fiscal Year X '+time.strftime('%Y')" name="name"/>
<field eval="'FY'+time.strftime('%Y')" name="code"/>
<field eval="time.strftime('%Y')+'-01-01'" name="date_start"/>
<field eval="time.strftime('%Y')+'-12-31'" name="date_stop"/>
@ -20,7 +20,7 @@
<record id="period_1" model="account.period">
<field eval="'01/'+time.strftime('%Y')" name="code"/>
<field eval="'01/'+time.strftime('%Y')" name="name"/>
<field eval="'X 01/'+time.strftime('%Y')" name="name"/>
<field eval="True" name="special"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field eval="time.strftime('%Y')+'-01-01'" name="date_start"/>
@ -29,7 +29,7 @@
</record>
<record id="period_2" model="account.period">
<field eval="'02/'+time.strftime('%Y')" name="code"/>
<field eval="'02/'+time.strftime('%Y')" name="name"/>
<field eval="'X 02/'+time.strftime('%Y')" name="name"/>
<field eval="True" name="special"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field eval="time.strftime('%Y')+'-02-01'" name="date_start"/>
@ -38,7 +38,7 @@
</record>
<record id="period_3" model="account.period">
<field eval="'03/'+time.strftime('%Y')" name="code"/>
<field eval="'03/'+time.strftime('%Y')" name="name"/>
<field eval="'X 03/'+time.strftime('%Y')" name="name"/>
<field eval="True" name="special"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field eval="time.strftime('%Y')+'-03-01'" name="date_start"/>
@ -47,7 +47,7 @@
</record>
<record id="period_4" model="account.period">
<field eval="'04/'+time.strftime('%Y')" name="code"/>
<field eval="'04/'+time.strftime('%Y')" name="name"/>
<field eval="'X 04/'+time.strftime('%Y')" name="name"/>
<field eval="True" name="special"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field eval="time.strftime('%Y')+'-04-01'" name="date_start"/>
@ -56,7 +56,7 @@
</record>
<record id="period_5" model="account.period">
<field eval="'05/'+time.strftime('%Y')" name="code"/>
<field eval="'05/'+time.strftime('%Y')" name="name"/>
<field eval="'X 05/'+time.strftime('%Y')" name="name"/>
<field eval="True" name="special"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field eval="time.strftime('%Y')+'-05-01'" name="date_start"/>
@ -65,7 +65,7 @@
</record>
<record id="period_6" model="account.period">
<field eval="'06/'+time.strftime('%Y')" name="code"/>
<field eval="'06/'+time.strftime('%Y')" name="name"/>
<field eval="'X 06/'+time.strftime('%Y')" name="name"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field eval="True" name="special"/>
<field eval="time.strftime('%Y')+'-06-01'" name="date_start"/>
@ -74,7 +74,7 @@
</record>
<record id="period_7" model="account.period">
<field eval="'07/'+time.strftime('%Y')" name="code"/>
<field eval="'07/'+time.strftime('%Y')" name="name"/>
<field eval="'X 07/'+time.strftime('%Y')" name="name"/>
<field eval="True" name="special"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field eval="time.strftime('%Y')+'-07-01'" name="date_start"/>
@ -83,7 +83,7 @@
</record>
<record id="period_8" model="account.period">
<field eval="'08/'+time.strftime('%Y')" name="code"/>
<field eval="'08/'+time.strftime('%Y')" name="name"/>
<field eval="'X 08/'+time.strftime('%Y')" name="name"/>
<field eval="True" name="special"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field eval="time.strftime('%Y')+'-08-01'" name="date_start"/>
@ -92,7 +92,7 @@
</record>
<record id="period_9" model="account.period">
<field eval="'09/'+time.strftime('%Y')" name="code"/>
<field eval="'09/'+time.strftime('%Y')" name="name"/>
<field eval="'X 09/'+time.strftime('%Y')" name="name"/>
<field eval="True" name="special"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field eval="time.strftime('%Y')+'-09-01'" name="date_start"/>
@ -101,7 +101,7 @@
</record>
<record id="period_10" model="account.period">
<field eval="'10/'+time.strftime('%Y')" name="code"/>
<field eval="'10/'+time.strftime('%Y')" name="name"/>
<field eval="'X 10/'+time.strftime('%Y')" name="name"/>
<field eval="True" name="special"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field eval="time.strftime('%Y')+'-10-01'" name="date_start"/>
@ -110,7 +110,7 @@
</record>
<record id="period_11" model="account.period">
<field eval="'11/'+time.strftime('%Y')" name="code"/>
<field eval="'11/'+time.strftime('%Y')" name="name"/>
<field eval="'X 11/'+time.strftime('%Y')" name="name"/>
<field eval="True" name="special"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field eval="time.strftime('%Y')+'-11-01'" name="date_start"/>
@ -119,7 +119,7 @@
</record>
<record id="period_12" model="account.period">
<field eval="'12/'+time.strftime('%Y')" name="code"/>
<field eval="'12/'+time.strftime('%Y')" name="name"/>
<field eval="'X 12/'+time.strftime('%Y')" name="name"/>
<field eval="True" name="special"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field eval="time.strftime('%Y')+'-12-01'" name="date_start"/>
@ -129,6 +129,6 @@
<record id="base.user_demo" model="res.users">
<field name="groups_id" eval="[(4,ref('account.group_account_user'))]"/>
</record>
</record>
</data>
</openerp>

View File

@ -2,9 +2,9 @@
<openerp>
<data noupdate="1">
<record id="demo_invoice_0" model="account.invoice">
<field name="date_due">2011-07-21</field>
<field name="date_due" eval="time.strftime('%Y')+'-01-30'"/>
<field name="payment_term" ref="account.account_payment_term"/>
<field name="journal_id" ref="account.refund_expenses_journal"/>
<field name="journal_id" ref="account.expenses_journal"/>
<field name="currency_id" ref="base.EUR"/>
<field name="address_invoice_id" ref="base.res_partner_address_wong"/>
<field name="user_id" ref="base.user_demo"/>
@ -15,7 +15,7 @@
<field name="type">in_invoice</field>
<field name="account_id" ref="account.a_pay"/>
<field eval="0" name="reconciled"/>
<field name="date_invoice">2011-06-01</field>
<field name="date_invoice" eval="time.strftime('%Y')+'-01-01'"/>
<field eval="14.0" name="amount_untaxed"/>
<field eval="14.0" name="amount_total"/>
<field name="partner_id" ref="base.res_partner_maxtor"/>

View File

@ -5,62 +5,15 @@
Account Type
-->
<record id="account_type_root" model="account.account.type">
<field name="name">View</field>
<field name="code">view</field>
<field name="close_method">none</field>
</record>
<record id="account_type_asset" model="account.account.type">
<field name="name">Asset</field>
<field name="code">asset</field>
<field name="report_type">asset</field>
<field name="close_method">balance</field>
</record>
<record id="account_type_receivable" model="account.account.type">
<field name="name">Receivable</field>
<field name="code">receivable</field>
<field name="report_type">asset</field>
<field name="close_method">unreconciled</field>
</record>
<record id="account_type_liability" model="account.account.type">
<field name="name">Liability</field>
<field name="code">liability</field>
<field name="report_type">liability</field>
<field name="close_method">balance</field>
</record>
<record id="account_type_payable" model="account.account.type">
<field name="name">Payable</field>
<field name="code">payable</field>
<field name="report_type">liability</field>
<field name="close_method">unreconciled</field>
</record>
<record id="account_type_income" model="account.account.type">
<field name="name">Income</field>
<field name="code">income</field>
<field name="report_type">income</field>
<field name="close_method">none</field>
</record>
<record id="account_type_expense" model="account.account.type">
<field name="name">Expense</field>
<field name="code">expense</field>
<field name="report_type">expense</field>
<field name="close_method">none</field>
</record>
<record id="account_type_cash_equity" model="account.account.type">
<field name="name">Equity</field>
<field name="code">equity</field>
<field name="close_method">balance</field>
<field name="report_type">liability</field>
<field name="close_method">balance</field>
</record>
<record id="account_type_cash_moves" model="account.account.type">
<field name="name">Cash</field>
<field name="code">cash</field>
<field name="report_type">asset</field>
<field name="close_method">balance</field>
</record>
<!--
Chart of Account
Chart of Accounts
-->
<record id="chart0" model="account.account">
@ -68,7 +21,7 @@
<field name="name">Chart For Automated Tests</field>
<field eval="0" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="account_type_root"/>
<field name="user_type" ref="data_account_type_view"/>
</record>
<!-- Balance Sheet -->
@ -78,14 +31,14 @@
<field name="name">Balance Sheet - (test)</field>
<field ref="chart0" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="account_type_root"/>
<field name="user_type" ref="data_account_type_view"/>
</record>
<record model="account.account" id="assets_view">
<field name="name">Assets - (test)</field>
<field name="code">X10</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_asset"/>
<field name="user_type" ref="data_account_type_asset"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="bal"/>
</record>
@ -95,7 +48,7 @@
<field name="name">Fixed Assets - (test)</field>
<field ref="assets_view" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="account_type_asset"/>
<field name="user_type" ref="data_account_type_asset"/>
</record>
<record id="xfa" model="account.account">
@ -103,7 +56,7 @@
<field name="name">Fixed Asset Account - (test)</field>
<field ref="fas" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_asset"/>
<field name="user_type" ref="data_account_type_asset"/>
</record>
<record id="nca" model="account.account">
@ -111,7 +64,7 @@
<field name="name">Net Current Assets - (test)</field>
<field ref="assets_view" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="account_type_asset"/>
<field name="user_type" ref="data_account_type_asset"/>
</record>
<record id="cas" model="account.account">
@ -119,7 +72,7 @@
<field name="name">Current Assets - (test)</field>
<field ref="nca" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="account_type_asset"/>
<field name="user_type" ref="data_account_type_asset"/>
</record>
<record id="stk" model="account.account">
@ -127,7 +80,7 @@
<field name="name">Purchased Stocks - (test)</field>
<field ref="cas" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_asset"/>
<field name="user_type" ref="data_account_type_asset"/>
</record>
<record id="a_recv" model="account.account">
@ -136,7 +89,7 @@
<field ref="cas" name="parent_id"/>
<field name="type">receivable</field>
<field eval="True" name="reconcile"/>
<field name="user_type" ref="account_type_receivable"/>
<field name="user_type" ref="data_account_type_receivable"/>
</record>
<record id="ova" model="account.account">
@ -144,7 +97,7 @@
<field name="name">Output VAT - (test)</field>
<field ref="cas" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_asset"/>
<field name="user_type" ref="data_account_type_asset"/>
</record>
<record id="bnk" model="account.account">
@ -152,7 +105,7 @@
<field name="name">Bank Current Account - (test)</field>
<field ref="cas" name="parent_id"/>
<field name="type">liquidity</field>
<field name="user_type" ref="account_type_asset"/>
<field name="user_type" ref="data_account_type_asset"/>
</record>
<record id="cash" model="account.account">
@ -160,7 +113,7 @@
<field name="name">Cash - (test)</field>
<field ref="cas" name="parent_id"/>
<field name="type">liquidity</field>
<field name="user_type" ref="account_type_asset"/>
<field name="user_type" ref="data_account_type_asset"/>
</record>
<record id="o_income" model="account.account">
@ -168,14 +121,14 @@
<field name="name">Opening Income - (test)</field>
<field ref="cas" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_income"/>
<field name="user_type" ref="data_account_type_income"/>
</record>
<record model="account.account" id="liabilities_view">
<field name="name">Liabilities - (test)</field>
<field name="code">X11</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_liability"/>
<field name="user_type" ref="data_account_type_liability"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="bal"/>
</record>
@ -185,7 +138,7 @@
<field name="name">Current Liabilities - (test)</field>
<field ref="liabilities_view" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="account_type_liability"/>
<field name="user_type" ref="data_account_type_liability"/>
</record>
<record id="a_pay" model="account.account">
@ -194,7 +147,7 @@
<field ref="cli" name="parent_id"/>
<field name="type">payable</field>
<field eval="True" name="reconcile"/>
<field name="user_type" ref="account_type_payable"/>
<field name="user_type" ref="data_account_type_payable"/>
</record>
<record id="iva" model="account.account">
@ -202,7 +155,7 @@
<field name="name">Input VAT - (test)</field>
<field ref="cli" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_liability"/>
<field name="user_type" ref="data_account_type_liability"/>
</record>
<record id="rsa" model="account.account">
@ -210,7 +163,7 @@
<field name="name">Reserve and Profit/Loss - (test)</field>
<field ref="cli" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_liability"/>
<field name="user_type" ref="data_account_type_liability"/>
</record>
<record id="o_expense" model="account.account">
@ -218,7 +171,7 @@
<field name="name">Opening Expense - (test)</field>
<field ref="cli" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_expense"/>
<field name="user_type" ref="data_account_type_expense"/>
</record>
<!-- Profit and Loss -->
@ -228,14 +181,14 @@
<field name="name">Profit and Loss - (test)</field>
<field ref="chart0" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="account_type_root"/>
<field name="user_type" ref="data_account_type_view"/>
</record>
<record model="account.account" id="income_view">
<field name="name">Income - (test)</field>
<field name="code">X20</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_income"/>
<field name="user_type" ref="data_account_type_income"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="gpf"/>
</record>
@ -244,7 +197,7 @@
<field name="name">Foreign Exchange Gain - (test)</field>
<field name="code">X201</field>
<field name="type">other</field>
<field name="user_type" ref="account_type_income"/>
<field name="user_type" ref="data_account_type_income"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="income_view"/>
</record>
@ -254,7 +207,7 @@
<field name="name">Revenue - (test)</field>
<field ref="income_view" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="account_type_income"/>
<field name="user_type" ref="data_account_type_income"/>
</record>
<record id="a_sale" model="account.account">
@ -262,14 +215,14 @@
<field name="name">Product Sales - (test)</field>
<field ref="rev" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_income"/>
<field name="user_type" ref="data_account_type_income"/>
</record>
<record model="account.account" id="expense_view">
<field name="name">Expense - (test)</field>
<field name="code">X21</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_expense"/>
<field name="user_type" ref="data_account_type_expense"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="gpf"/>
</record>
@ -280,7 +233,7 @@
<field name="name">Cost of Sales - (test)</field>
<field ref="expense_view" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="account_type_expense"/>
<field name="user_type" ref="data_account_type_expense"/>
</record>
<record id="cog" model="account.account">
@ -288,7 +241,7 @@
<field name="name">Cost of Goods Sold - (test)</field>
<field ref="cos" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_expense"/>
<field name="user_type" ref="data_account_type_expense"/>
</record>
<record id="ovr" model="account.account">
@ -296,7 +249,7 @@
<field name="name">Overheads - (test)</field>
<field ref="expense_view" name="parent_id"/>
<field name="type">view</field>
<field name="user_type" ref="account_type_expense"/>
<field name="user_type" ref="data_account_type_expense"/>
</record>
<record id="a_expense" model="account.account">
@ -304,14 +257,14 @@
<field name="name">Expenses - (test)</field>
<field ref="ovr" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_expense"/>
<field name="user_type" ref="data_account_type_expense"/>
</record>
<record model="account.account" id="income_fx_expense">
<field name="name">Foreign Exchange Loss - (test)</field>
<field name="code">X2111</field>
<field name="type">other</field>
<field name="user_type" ref="account_type_expense"/>
<field name="user_type" ref="data_account_type_expense"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="ovr"/>
</record>
@ -321,7 +274,7 @@
<field name="name">Salary Expenses - (test)</field>
<field ref="ovr" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_expense"/>
<field name="user_type" ref="data_account_type_expense"/>
</record>
<!-- Properties -->

View File

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2011 OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import invoice
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,275 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2011 OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv, orm
from edi import EDIMixin
INVOICE_LINE_EDI_STRUCT = {
'name': True,
'origin': True,
'uos_id': True,
'product_id': True,
'price_unit': True,
'quantity': True,
'discount': True,
'note': True,
# fields used for web preview only - discarded on import
'price_subtotal': True,
}
INVOICE_TAX_LINE_EDI_STRUCT = {
'name': True,
'base': True,
'amount': True,
'manual': True,
'sequence': True,
'base_amount': True,
'tax_amount': True,
}
INVOICE_EDI_STRUCT = {
'name': True,
'origin': True,
'company_id': True, # -> to be changed into partner
'type': True, # -> reversed at import
'internal_number': True, # -> reference at import
'comment': True,
'date_invoice': True,
'date_due': True,
'partner_id': True,
'payment_term': True,
#custom: currency_id
'invoice_line': INVOICE_LINE_EDI_STRUCT,
'tax_line': INVOICE_TAX_LINE_EDI_STRUCT,
# fields used for web preview only - discarded on import
#custom: 'partner_ref'
'amount_total': True,
'amount_untaxed': True,
'amount_tax': True,
}
class account_invoice(osv.osv, EDIMixin):
_inherit = 'account.invoice'
def edi_export(self, cr, uid, records, edi_struct=None, context=None):
"""Exports a supplier or customer invoice"""
edi_struct = dict(edi_struct or INVOICE_EDI_STRUCT)
res_company = self.pool.get('res.company')
res_partner_address = self.pool.get('res.partner.address')
edi_doc_list = []
for invoice in records:
# generate the main report
self._edi_generate_report_attachment(cr, uid, invoice, context=context)
edi_doc = super(account_invoice,self).edi_export(cr, uid, [invoice], edi_struct, context)[0]
edi_doc.update({
'company_address': res_company.edi_export_address(cr, uid, invoice.company_id, context=context),
'company_paypal_account': invoice.company_id.paypal_account,
'partner_address': res_partner_address.edi_export(cr, uid, [invoice.address_invoice_id], context=context)[0],
'currency': self.pool.get('res.currency').edi_export(cr, uid, [invoice.currency_id], context=context)[0],
'partner_ref': invoice.reference or False,
})
edi_doc_list.append(edi_doc)
return edi_doc_list
def _edi_tax_account(self, cr, uid, invoice_type='out_invoice', context=None):
#TODO/FIXME: should select proper Tax Account
account_pool = self.pool.get('account.account')
account_ids = account_pool.search(cr, uid, [('type','<>','view'),('type','<>','income'), ('type', '<>', 'closed')])
tax_account = False
if account_ids:
tax_account = account_pool.browse(cr, uid, account_ids[0])
return tax_account
def _edi_invoice_account(self, cr, uid, partner_id, invoice_type, context=None):
partner_pool = self.pool.get('res.partner')
partner = partner_pool.browse(cr, uid, partner_id, context=context)
if invoice_type in ('out_invoice', 'out_refund'):
invoice_account = partner.property_account_receivable
else:
invoice_account = partner.property_account_payable
return invoice_account
def _edi_product_account(self, cr, uid, product_id, invoice_type, context=None):
product_pool = self.pool.get('product.product')
product = product_pool.browse(cr, uid, product_id, context=context)
if invoice_type in ('out_invoice','out_refund'):
account = product.property_account_income or product.categ_id.property_account_income_categ
else:
account = product.property_account_expense or product.categ_id.property_account_expense_categ
return account
def _edi_import_company(self, cr, uid, edi_document, context=None):
# TODO: for multi-company setups, we currently import the document in the
# user's current company, but we should perhaps foresee a way to select
# the desired company among the user's allowed companies
self._edi_requires_attributes(('company_id','company_address','type'), edi_document)
res_partner_address = self.pool.get('res.partner.address')
res_partner = self.pool.get('res.partner')
# imported company = new partner
src_company_id, src_company_name = edi_document.pop('company_id')
partner_id = self.edi_import_relation(cr, uid, 'res.partner', src_company_name,
src_company_id, context=context)
invoice_type = edi_document['type']
partner_value = {}
if invoice_type in ('out_invoice', 'out_refund'):
partner_value.update({'customer': True})
if invoice_type in ('in_invoice', 'in_refund'):
partner_value.update({'supplier': True})
res_partner.write(cr, uid, [partner_id], partner_value, context=context)
# imported company_address = new partner address
address_info = edi_document.pop('company_address')
address_info['partner_id'] = (src_company_id, src_company_name)
address_info['type'] = 'invoice'
address_id = res_partner_address.edi_import(cr, uid, address_info, context=context)
# modify edi_document to refer to new partner
partner_address = res_partner_address.browse(cr, uid, address_id, context=context)
edi_document['partner_id'] = (src_company_id, src_company_name)
edi_document.pop('partner_address', False) # ignored
edi_document['address_invoice_id'] = self.edi_m2o(cr, uid, partner_address, context=context)
return partner_id
def edi_import(self, cr, uid, edi_document, context=None):
""" During import, invoices will import the company that is provided in the invoice as
a new partner (e.g. supplier company for a customer invoice will be come a supplier
record for the new invoice.
Summary of tasks that need to be done:
- import company as a new partner, if type==in then supplier=1, else customer=1
- partner_id field is modified to point to the new partner
- company_address data used to add address to new partner
- change type: out_invoice'<->'in_invoice','out_refund'<->'in_refund'
- reference: should contain the value of the 'internal_number'
- reference_type: 'none'
- internal number: reset to False, auto-generated
- journal_id: should be selected based on type: simply put the 'type'
in the context when calling create(), will be selected correctly
- payment_term: if set, create a default one based on name...
- for invoice lines, the account_id value should be taken from the
product's default, i.e. from the default category, as it will not
be provided.
- for tax lines, we disconnect from the invoice.line, so all tax lines
will be of type 'manual', and default accounts should be picked based
on the tax config of the DB where it is imported.
"""
if context is None:
context = {}
self._edi_requires_attributes(('company_id','company_address','type','invoice_line','currency'), edi_document)
# extract currency info
res_currency = self.pool.get('res.currency')
currency_info = edi_document.pop('currency')
currency_id = res_currency.edi_import(cr, uid, currency_info, context=context)
currency = res_currency.browse(cr, uid, currency_id)
edi_document['currency_id'] = self.edi_m2o(cr, uid, currency, context=context)
# change type: out_invoice'<->'in_invoice','out_refund'<->'in_refund'
invoice_type = edi_document['type']
invoice_type = invoice_type.startswith('in_') and invoice_type.replace('in_','out_') or invoice_type.replace('out_','in_')
edi_document['type'] = invoice_type
#import company as a new partner
partner_id = self._edi_import_company(cr, uid, edi_document, context=context)
# Set Account
invoice_account = self._edi_invoice_account(cr, uid, partner_id, invoice_type, context=context)
edi_document['account_id'] = invoice_account and self.edi_m2o(cr, uid, invoice_account, context=context) or False
# reference: should contain the value of the 'internal_number'
edi_document['reference'] = edi_document.get('internal_number', False)
# reference_type: 'none'
edi_document['reference_type'] = 'none'
# internal number: reset to False, auto-generated
edi_document['internal_number'] = False
# discard web preview fields, if present
edi_document.pop('partner_ref', None)
# journal_id: should be selected based on type: simply put the 'type' in the context when calling create(), will be selected correctly
context.update(type=invoice_type)
# for invoice lines, the account_id value should be taken from the product's default, i.e. from the default category, as it will not be provided.
for edi_invoice_line in edi_document['invoice_line']:
product_info = edi_invoice_line['product_id']
product_id = self.edi_import_relation(cr, uid, 'product.product', product_info[1],
product_info[0], context=context)
account = self._edi_product_account(cr, uid, product_id, invoice_type, context=context)
# TODO: could be improved with fiscal positions perhaps
# account = fpos_obj.map_account(cr, uid, fiscal_position_id, account.id)
edi_invoice_line['account_id'] = self.edi_m2o(cr, uid, account, context=context) if account else False
# discard web preview fields, if present
edi_invoice_line.pop('price_subtotal', None)
# for tax lines, we disconnect from the invoice.line, so all tax lines will be of type 'manual', and default accounts should be picked based
# on the tax config of the DB where it is imported.
tax_account = self._edi_tax_account(cr, uid, context=context)
tax_account_info = self.edi_m2o(cr, uid, tax_account, context=context)
for edi_tax_line in edi_document.get('tax_line', []):
edi_tax_line['account_id'] = tax_account_info
edi_tax_line['manual'] = True
return super(account_invoice,self).edi_import(cr, uid, edi_document, context=context)
def _edi_record_display_action(self, cr, uid, id, context=None):
"""Returns an appropriate action definition dict for displaying
the record with ID ``rec_id``.
:param int id: database ID of record to display
:return: action definition dict
"""
action = super(account_invoice,self)._edi_record_display_action(cr, uid, id, context=context)
try:
invoice = self.browse(cr, uid, id, context=context)
if 'out_' in invoice.type:
view_ext_id = 'invoice_form'
journal_type = 'sale'
else:
view_ext_id = 'invoice_supplier_form'
journal_type = 'purchase'
ctx = "{'type': '%s', 'journal_type': '%s'}" % (invoice.type, journal_type)
action.update(context=ctx)
view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', view_ext_id)[1]
action.update(views=[(view_id,'form'), (False, 'tree')])
except ValueError:
# ignore if views are missing
pass
return action
class account_invoice_line(osv.osv, EDIMixin):
_inherit='account.invoice.line'
class account_invoice_tax(osv.osv, EDIMixin):
_inherit = "account.invoice.tax"
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,186 @@
<?xml version="1.0" ?>
<openerp>
<data>
<!-- EDI Export + Send email Action -->
<record id="ir_actions_server_edi_invoice" model="ir.actions.server">
<field name="code">if (object.type in ('out_invoice', 'out_refund')) and not object.partner_id.opt_out: object.edi_export_and_email(template_ext_id='account.email_template_edi_invoice', context=context)</field>
<field eval="6" name="sequence"/>
<field name="state">code</field>
<field name="type">ir.actions.server</field>
<field name="model_id" ref="account.model_account_invoice"/>
<field name="condition">True</field>
<field name="name">Auto-email confirmed invoices</field>
</record>
<!-- EDI related Email Templates menu -->
<record model="ir.actions.act_window" id="action_email_templates">
<field name="name">Email Templates</field>
<field name="res_model">email.template</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" ref="email_template.email_template_tree" />
<field name="search_view_id" ref="email_template.view_email_template_search"/>
<field name="context">{'search_default_model_id':'account.invoice'}</field>
<field name="context" eval="{'search_default_model_id': ref('account.model_account_invoice')}"/>
</record>
<menuitem id="menu_email_templates" parent="menu_configuration_misc" action="action_email_templates" sequence="30"/>
</data>
<!-- Mail template and workflow bindings are done in a NOUPDATE block
so users can freely customize/delete them -->
<data noupdate="1">
<!-- bind the mailing server action to invoice open activity -->
<record id="account.act_open" model="workflow.activity">
<field name="action_id" ref="ir_actions_server_edi_invoice"/>
</record>
<!--Email template -->
<record id="email_template_edi_invoice" model="email.template">
<field name="name">Automated Invoice Notification Mail</field>
<field name="email_from">${object.user_id.user_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.address_invoice_id.email or ''}</field>
<field name="model_id" ref="account.model_account_invoice"/>
<field name="auto_delete" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: rgb(255, 255, 255); ">
<p>Hello${object.address_invoice_id.name and ' ' or ''}${object.address_invoice_id.name or ''},</p>
<p>A new invoice is available for ${object.partner_id.name}: </p>
<p style="border-left: 1px solid #8e0000; margin-left: 30px;">
&nbsp;&nbsp;<strong>REFERENCES</strong><br />
&nbsp;&nbsp;Invoice number: <strong>${object.number}</strong><br />
&nbsp;&nbsp;Invoice total: <strong>${object.amount_total} ${object.currency_id.name}</strong><br />
&nbsp;&nbsp;Invoice date: ${object.date_invoice}<br />
% if object.origin:
&nbsp;&nbsp;Order reference: ${object.origin}<br />
% endif
&nbsp;&nbsp;Your contact: <a href="mailto:${object.user_id.user_email or ''}?subject=Invoice%20${object.number}">${object.user_id.name}</a>
</p>
<p>
You can view the invoice document, download it and pay online using the following link:
</p>
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #FFF; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
href="${ctx.get('edi_web_url_view') or ''}">View Invoice</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&amp;business=%s&amp;item_name=%s%%20Invoice%%20%s&amp;" \
"invoice=%s&amp;amount=%s&amp;currency_code=%s&amp;button_subtype=services&amp;no_note=1&amp;bn=OpenERP_Invoice_PayNow_%s" % \
(paypal_account,comp_name,inv_number,inv_number,inv_amount,cur_name,cur_name)
%>
<br/>
<p>It is also possible to directly pay with Paypal:</p>
<a style="margin-left: 120px;" href="${paypal_url}">
<img class="oe_edi_paypal_button" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif"/>
</a>
% endif
<br/>
<p>If you have any question, do not hesitate to contact us.</p>
<p>Thank you for choosing ${object.company_id.name or 'us'}!</p>
<br/>
<br/>
<div style="width: 375px; margin: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;">
<h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #FFF;">
<strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3>
</div>
<div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;">
<span style="color: #222; margin-bottom: 5px; display: block; ">
% if object.company_id.street:
${object.company_id.street}<br/>
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% 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 ''}<br/>
% endif
</span>
% if object.company_id.phone:
<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">
Phone:&nbsp; ${object.company_id.phone}
</div>
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<p></p>
</div>
</div>
]]></field>
<field name="body_text"><![CDATA[
Hello${object.address_invoice_id.name and ' ' or ''}${object.address_invoice_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.user_email and '<%s>'%(object.user_id.user_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.user_email and '<%s>'%(object.user_id.user_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>

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

11777
addons/account/i18n/es_MX.po Normal file

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

11777
addons/account/i18n/es_VE.po Normal file

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

@ -23,8 +23,8 @@ import logging
import time
import datetime
from dateutil.relativedelta import relativedelta
from os.path import join as opj
from operator import itemgetter
from os.path import join as opj
from tools.translate import _
from osv import fields, osv
@ -38,12 +38,14 @@ class account_installer(osv.osv_memory):
def _get_charts(self, cr, uid, context=None):
modules = self.pool.get('ir.module.module')
ids = modules.search(cr, uid, [('name', 'like', 'l10n_')], context=context)
# Looking for the module with the 'Account Charts' category
category_name, category_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base', 'module_category_localization_account_charts')
ids = modules.search(cr, uid, [('category_id', '=', category_id)], context=context)
charts = list(
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 Account'))
charts.insert(0, ('configurable', 'Generic Chart Of Accounts'))
return charts
_columns = {
@ -56,22 +58,24 @@ class account_installer(osv.osv_memory):
'date_start': fields.date('Start Date', required=True),
'date_stop': fields.date('End Date', required=True),
'period': fields.selection([('month', 'Monthly'), ('3months','3 Monthly')], 'Periods', required=True),
'sale_tax': fields.float('Sale Tax(%)'),
'purchase_tax': fields.float('Purchase Tax(%)'),
'company_id': fields.many2one('res.company', 'Company', required=True),
'has_default_company' : fields.boolean('Has Default Company', readonly=True),
}
def _default_company(self, cr, uid, context=None):
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
return user.company_id and user.company_id.id or False
def _default_has_default_company(self, cr, uid, context=None):
count = self.pool.get('res.company').search_count(cr, uid, [], context=context)
return bool(count == 1)
_defaults = {
'date_start': lambda *a: time.strftime('%Y-01-01'),
'date_stop': lambda *a: time.strftime('%Y-12-31'),
'period': 'month',
'sale_tax': 0.0,
'purchase_tax': 0.0,
'company_id': _default_company,
'has_default_company': _default_has_default_company,
'charts': 'configurable'
}
@ -92,9 +96,6 @@ class account_installer(osv.osv_memory):
res['fields'][field]['selection'] = cmp_select
return res
def on_change_tax(self, cr, uid, id, tax):
return {'value': {'purchase_tax': tax}}
def on_change_start_date(self, cr, uid, id, start_date=False):
if start_date:
start_date = datetime.datetime.strptime(start_date, "%Y-%m-%d")
@ -103,96 +104,19 @@ class account_installer(osv.osv_memory):
return {}
def execute(self, cr, uid, ids, context=None):
self.execute_simple(cr, uid, ids, context)
super(account_installer, self).execute(cr, uid, ids, context=context)
def execute_simple(self, cr, uid, ids, context=None):
if context is None:
context = {}
fy_obj = self.pool.get('account.fiscalyear')
mod_obj = self.pool.get('ir.model.data')
obj_acc_temp = self.pool.get('account.account.template')
obj_tax_code_temp = self.pool.get('account.tax.code.template')
obj_tax_temp = self.pool.get('account.tax.template')
obj_acc_chart_temp = self.pool.get('account.chart.template')
record = self.browse(cr, uid, ids, context=context)[0]
for res in self.read(cr, uid, ids, context=context):
if record.charts == 'configurable':
if 'charts' in res and res['charts'] == 'configurable':
#load generic chart of account
fp = tools.file_open(opj('account', 'configurable_account_chart.xml'))
tools.convert_xml_import(cr, 'account', fp, {}, 'init', True, None)
fp.close()
s_tax = (res.get('sale_tax', 0.0))/100
p_tax = (res.get('purchase_tax', 0.0))/100
pur_temp_tax = mod_obj.get_object_reference(cr, uid, 'account', 'tax_code_base_purchases')
pur_temp_tax_id = pur_temp_tax and pur_temp_tax[1] or False
pur_temp_tax_paid = mod_obj.get_object_reference(cr, uid, 'account', 'tax_code_output')
pur_temp_tax_paid_id = pur_temp_tax_paid and pur_temp_tax_paid[1] or False
sale_temp_tax = mod_obj.get_object_reference(cr, uid, 'account', 'tax_code_base_sales')
sale_temp_tax_id = sale_temp_tax and sale_temp_tax[1] or False
sale_temp_tax_paid = mod_obj.get_object_reference(cr, uid, 'account', 'tax_code_input')
sale_temp_tax_paid_id = sale_temp_tax_paid and sale_temp_tax_paid[1] or False
chart_temp_ids = obj_acc_chart_temp.search(cr, uid, [('name','=','Configurable Account Chart Template')], context=context)
chart_temp_id = chart_temp_ids and chart_temp_ids[0] or False
if s_tax * 100 > 0.0:
tax_account_ids = obj_acc_temp.search(cr, uid, [('name', '=', 'Tax Received')], context=context)
sales_tax_account_id = tax_account_ids and tax_account_ids[0] or False
vals_tax_code_temp = {
'name': _('TAX %s%%') % (s_tax*100),
'code': _('TAX %s%%') % (s_tax*100),
'parent_id': sale_temp_tax_id
}
new_tax_code_temp = obj_tax_code_temp.create(cr, uid, vals_tax_code_temp, context=context)
vals_paid_tax_code_temp = {
'name': _('TAX Received %s%%') % (s_tax*100),
'code': _('TAX Received %s%%') % (s_tax*100),
'parent_id': sale_temp_tax_paid_id
}
new_paid_tax_code_temp = obj_tax_code_temp.create(cr, uid, vals_paid_tax_code_temp, context=context)
sales_tax_temp = obj_tax_temp.create(cr, uid, {
'name': _('TAX %s%%') % (s_tax*100),
'amount': s_tax,
'base_code_id': new_tax_code_temp,
'tax_code_id': new_paid_tax_code_temp,
'ref_base_code_id': new_tax_code_temp,
'ref_tax_code_id': new_paid_tax_code_temp,
'type_tax_use': 'sale',
'type': 'percent',
'sequence': 0,
'account_collected_id': sales_tax_account_id,
'account_paid_id': sales_tax_account_id,
'chart_template_id': chart_temp_id,
}, context=context)
if p_tax * 100 > 0.0:
tax_account_ids = obj_acc_temp.search(cr, uid, [('name', '=', 'Tax Paid')], context=context)
purchase_tax_account_id = tax_account_ids and tax_account_ids[0] or False
vals_tax_code_temp = {
'name': _('TAX %s%%') % (p_tax*100),
'code': _('TAX %s%%') % (p_tax*100),
'parent_id': pur_temp_tax_id
}
new_tax_code_temp = obj_tax_code_temp.create(cr, uid, vals_tax_code_temp, context=context)
vals_paid_tax_code_temp = {
'name': _('TAX Paid %s%%') % (p_tax*100),
'code': _('TAX Paid %s%%') % (p_tax*100),
'parent_id': pur_temp_tax_paid_id
}
new_paid_tax_code_temp = obj_tax_code_temp.create(cr, uid, vals_paid_tax_code_temp, context=context)
purchase_tax_temp = obj_tax_temp.create(cr, uid, {
'name': _('TAX %s%%') % (p_tax*100),
'description': _('TAX %s%%') % (p_tax*100),
'amount': p_tax,
'base_code_id': new_tax_code_temp,
'tax_code_id': new_paid_tax_code_temp,
'ref_base_code_id': new_tax_code_temp,
'ref_tax_code_id': new_paid_tax_code_temp,
'type_tax_use': 'purchase',
'type': 'percent',
'sequence': 0,
'account_collected_id': purchase_tax_account_id,
'account_paid_id': purchase_tax_account_id,
'chart_template_id': chart_temp_id,
}, context=context)
if 'date_start' in res and 'date_stop' in res:
f_ids = fy_obj.search(cr, uid, [('date_start', '<=', res['date_start']), ('date_stop', '>=', res['date_stop']), ('company_id', '=', res['company_id'][0])], context=context)
if not f_ids:
@ -212,7 +136,6 @@ class account_installer(osv.osv_memory):
fy_obj.create_period(cr, uid, [fiscal_id])
elif res['period'] == '3months':
fy_obj.create_period3(cr, uid, [fiscal_id])
super(account_installer, self).execute(cr, uid, ids, context=context)
def modules_to_install(self, cr, uid, ids, context=None):
modules = super(account_installer, self).modules_to_install(

View File

@ -103,6 +103,7 @@
<field name="type">normal</field>
<field name="state">open</field>
<field name="partner_id" ref="base.res_partner_seagate"/>
<field name="contact_id" ref="base.res_partner_address_seagate"/>
</record>
<record id="analytic_seagate_p2" model="account.analytic.account">
<field name="name">Seagate P2</field>
@ -111,6 +112,7 @@
<field name="parent_id" ref="analytic_integration"/>
<field name="state">open</field>
<field name="partner_id" ref="base.res_partner_seagate"/>
<field name="contact_id" ref="base.res_partner_address_seagate"/>
</record>
<record id="analytic_magasin_bml_1" model="account.analytic.account">
<field name="name">Magasin BML 1</field>
@ -118,6 +120,7 @@
<field name="parent_id" ref="analytic_integration"/>
<field name="type">normal</field>
<field name="partner_id" ref="base.res_partner_15"/>
<field name="contact_id" ref="base.res_partner_address_14"/>
</record>
<record id="analytic_integration_c2c" model="account.analytic.account">
<field name="name">CampToCamp</field>
@ -127,6 +130,7 @@
<field eval="time.strftime('%Y-12-31')" name="date"/>
<field name="parent_id" ref="analytic_integration"/>
<field name="partner_id" ref="base.res_partner_c2c"/>
<field name="contact_id" ref="base.res_partner_address_Camptocamp"/>
<field name="state">open</field>
</record>
<record id="analytic_agrolait" model="account.analytic.account">
@ -135,13 +139,15 @@
<field name="parent_id" ref="analytic_customers"/>
<field name="type">normal</field>
<field name="partner_id" ref="base.res_partner_agrolait"/>
<field name="contact_id" ref="base.res_partner_address_8"/>
</record>
<record id="analytic_asustek" model="account.analytic.account">
<field name="name">Asustek</field>
<field name="code">4</field>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_customers"/>
<field name="parent_id" ref="analytic_customers"/>
<field name="partner_id" ref="base.res_partner_asus"/>
<field name="contact_id" ref="base.res_partner_address_tang"/>
</record>
<record id="analytic_distripc" model="account.analytic.account">
<field name="name">DistriPC</field>
@ -149,6 +155,7 @@
<field name="parent_id" ref="analytic_customers"/>
<field name="type">normal</field>
<field name="partner_id" ref="base.res_partner_4"/>
<field name="contact_id" ref="base.res_partner_address_7"/>
</record>
<record id="analytic_sednacom" model="account.analytic.account">
<field name="name">Sednacom</field>
@ -158,6 +165,7 @@
<field name="parent_id" ref="analytic_partners"/>
<field name="type">normal</field>
<field name="partner_id" ref="base.res_partner_sednacom"/>
<field name="contact_id" ref="base.res_partner_address_11"/>
<field name="state">open</field>
</record>
<record id="analytic_thymbra" model="account.analytic.account">
@ -168,6 +176,7 @@
<field name="type">normal</field>
<field name="parent_id" ref="analytic_partners"/>
<field name="partner_id" ref="base.res_partner_thymbra"/>
<field name="contact_id" ref="base.res_partner_address_thymbra"/>
<field name="state">open</field>
</record>
<record id="analytic_leclerc" model="account.analytic.account">
@ -178,6 +187,7 @@
<field name="type">normal</field>
<field name="parent_id" ref="analytic_partners"/>
<field name="partner_id" ref="base.res_partner_11"/>
<field name="contact_id" ref="base.res_partner_address_15"/>
</record>
<record id="analytic_desertic_hispafuentes" model="account.analytic.account">
<field name="name">Desertic - Hispafuentes</field>
@ -187,6 +197,7 @@
<field name="type">normal</field>
<field name="parent_id" ref="analytic_partners"/>
<field name="partner_id" ref="base.res_partner_desertic_hispafuentes"/>
<field name="contact_id" ref="base.res_partner_address_3000"/>
</record>
<record id="analytic_tiny_at_work" model="account.analytic.account">
<field name="name">OpenERP SA AT Work</field>
@ -194,6 +205,7 @@
<field name="type">normal</field>
<field name="parent_id" ref="analytic_partners"/>
<field name="partner_id" ref="base.res_partner_tinyatwork"/>
<field name="contact_id" ref="base.res_partner_address_tinyatwork"/>
</record>
<record id="analytic_partners_camp_to_camp" model="account.analytic.account">
<field name="name">Camp to Camp</field>
@ -203,6 +215,7 @@
<field name="type">normal</field>
<field name="parent_id" ref="analytic_partners"/>
<field name="partner_id" ref="base.res_partner_c2c"/>
<field name="contact_id" ref="base.res_partner_address_Camptocamp"/>
<field name="state">open</field>
</record>
<record id="analytic_project_2_support" model="account.analytic.account">

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