[MERGE] from trunk

bzr revid: xmo@openerp.com-20121003080711-d8g4kcdpeet3ovne
This commit is contained in:
Xavier Morel 2012-10-03 10:07:11 +02:00
commit 536741bcd3
1839 changed files with 191284 additions and 265786 deletions

View File

@ -63,6 +63,8 @@ for a particular financial year and for preparation of vouchers there is a modul
'wizard/account_use_model_view.xml',
'account_installer.xml',
'wizard/account_period_close_view.xml',
'wizard/account_reconcile_view.xml',
'wizard/account_unreconcile_view.xml',
'account_view.xml',
'account_report.xml',
'account_financial_report_data.xml',
@ -85,14 +87,12 @@ for a particular financial year and for preparation of vouchers there is a modul
'wizard/account_journal_select_view.xml',
'wizard/account_change_currency_view.xml',
'wizard/account_validate_move_view.xml',
'wizard/account_unreconcile_view.xml',
'wizard/account_report_general_ledger_view.xml',
'wizard/account_invoice_state_view.xml',
'wizard/account_report_partner_balance_view.xml',
'wizard/account_report_account_balance_view.xml',
'wizard/account_report_aged_partner_balance_view.xml',
'wizard/account_report_partner_ledger_view.xml',
'wizard/account_reconcile_view.xml',
'wizard/account_reconcile_partner_process_view.xml',
'wizard/account_automatic_reconcile_view.xml',
'wizard/account_financial_report_view.xml',
@ -126,6 +126,14 @@ for a particular financial year and for preparation of vouchers there is a modul
'res_config_view.xml',
'account_pre_install.yml'
],
'js': [
'static/src/js/account_move_reconciliation.js',
],
'qweb' : [
"static/src/xml/account_move_reconciliation.xml",
],
'css':['static/src/css/account_move_reconciliation.css'
],
'demo': [
'demo/account_demo.xml',
'project/project_demo.xml',
@ -151,6 +159,5 @@ for a particular financial year and for preparation of vouchers there is a modul
],
'installable': True,
'auto_install': False,
'certificate': '0080331923549',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -31,7 +31,7 @@ import decimal_precision as dp
from tools.translate import _
from tools.float_utils import float_round
from openerp import SUPERUSER_ID
import tools
_logger = logging.getLogger(__name__)
@ -182,7 +182,7 @@ class account_account_type(osv.osv):
'Balance' will generally be used for cash accounts.
'Detail' will copy each existing journal item of the previous year, even the reconciled ones.
'Unreconciled' will copy only the journal items that were unreconciled on the first day of the new fiscal year."""),
'report_type': fields.function(_get_current_report_type, fnct_inv=_save_report_type, type='selection', string='P&L / BS Category',
'report_type': fields.function(_get_current_report_type, fnct_inv=_save_report_type, type='selection', string='P&L / BS Category', store=True,
selection= [('none','/'),
('income', _('Profit & Loss (Income account)')),
('expense', _('Profit & Loss (Expense account)')),
@ -228,7 +228,7 @@ class account_account(osv.osv):
while pos < len(args):
if args[pos][0] == 'code' and args[pos][1] in ('like', 'ilike') and args[pos][2]:
args[pos] = ('code', '=like', str(args[pos][2].replace('%', ''))+'%')
args[pos] = ('code', '=like', tools.ustr(args[pos][2].replace('%', ''))+'%')
if args[pos][0] == 'journal_id':
if not args[pos][2]:
del args[pos]
@ -596,13 +596,13 @@ class account_account(osv.osv):
res.append((record['id'], name))
return res
def copy(self, cr, uid, id, default={}, context=None, done_list=[], local=False):
def copy(self, cr, uid, id, default=None, context=None, done_list=None, local=False):
default = {} if default is None else default.copy()
if done_list is None:
done_list = []
account = self.browse(cr, uid, id, context=context)
new_child_ids = []
if not default:
default = {}
default = default.copy()
default['code'] = (account['code'] or '') + '(copy)'
default.update(code=_("%s (copy)") % (account['code'] or ''))
if not local:
done_list = []
if account.id in done_list:
@ -683,7 +683,7 @@ class account_journal_view(osv.osv):
_name = "account.journal.view"
_description = "Journal View"
_columns = {
'name': fields.char('Journal View', size=64, required=True),
'name': fields.char('Journal View', size=64, required=True, translate=True),
'columns_id': fields.one2many('account.journal.column', 'view_id', 'Columns')
}
_order = "name"
@ -778,14 +778,15 @@ class account_journal(osv.osv):
(_check_currency, 'Configuration error!\nThe currency chosen should be shared by the default accounts too.', ['currency','default_debit_account_id','default_credit_account_id']),
]
def copy(self, cr, uid, id, default={}, context=None, done_list=[], local=False):
def copy(self, cr, uid, id, default=None, context=None, done_list=None, local=False):
default = {} if default is None else default.copy()
if done_list is None:
done_list = []
journal = self.browse(cr, uid, id, context=context)
if not default:
default = {}
default = default.copy()
default['code'] = (journal['code'] or '') + '(copy)'
default['name'] = (journal['name'] or '') + '(copy)'
default['sequence_id'] = False
default.update(
code=_("%s (copy)") % (journal['code'] or ''),
name=_("%s (copy)") % (journal['name'] or ''),
sequence_id=False)
return super(account_journal, self).copy(cr, uid, id, default, context=context)
def write(self, cr, uid, ids, vals, context=None):
@ -837,6 +838,10 @@ class account_journal(osv.osv):
@return: Returns a list of tupples containing id, name
"""
if not ids:
return []
if isinstance(ids, (int, long)):
ids = [ids]
result = self.browse(cr, user, ids, context=context)
res = []
for rs in result:
@ -1174,7 +1179,8 @@ class account_fiscalyear(osv.osv):
'end_journal_period_id':fields.many2one('account.journal.period','End of Year Entries Journal', readonly=True),
}
def copy(self, cr, uid, id, default={}, context=None):
def copy(self, cr, uid, id, default=None, context=None):
default = {} if default is None else default.copy()
default.update({
'period_ids': [],
'end_journal_period_id': False
@ -1433,9 +1439,9 @@ class account_move(osv.osv):
result = super(account_move, self).create(cr, uid, vals, context)
return result
def copy(self, cr, uid, id, default={}, context=None):
if context is None:
context = {}
def copy(self, cr, uid, id, default=None, context=None):
default = {} if default is None else default.copy()
context = {} if context is None else context.copy()
default.update({
'state':'draft',
'name':'/',
@ -1904,7 +1910,7 @@ class account_tax(osv.osv):
'ref_tax_sign': fields.float('Tax Code Sign', help="Usually 1 or -1."),
'include_base_amount': fields.boolean('Included in base amount', help="Indicates if the amount of tax must be included in the base amount for the computation of the next taxes"),
'company_id': fields.many2one('res.company', 'Company', required=True),
'description': fields.char('Tax Code',size=32),
'description': fields.char('Tax Code'),
'price_include': fields.boolean('Tax Included in Price', help="Check this if the price you use on the product and invoices includes this tax."),
'type_tax_use': fields.selection([('sale','Sale'),('purchase','Purchase'),('all','All')], 'Tax Application', required=True)
@ -2265,7 +2271,10 @@ class account_model(osv.osv):
_defaults = {
'legend': lambda self, cr, uid, context:_('You can specify year, month and date in the name of the model using the following labels:\n\n%(year)s: To Specify Year \n%(month)s: To Specify Month \n%(date)s: Current Date\n\ne.g. My model on %(date)s'),
}
def generate(self, cr, uid, ids, datas={}, context=None):
def generate(self, cr, uid, ids, data=None, context=None):
if data is None:
data = {}
move_ids = []
entry = {}
account_move_obj = self.pool.get('account.move')
@ -2276,8 +2285,8 @@ class account_model(osv.osv):
if context is None:
context = {}
if datas.get('date', False):
context.update({'date': datas['date']})
if data.get('date', False):
context.update({'date': data['date']})
move_date = context.get('date', time.strftime('%Y-%m-%d'))
move_date = datetime.strptime(move_date,"%Y-%m-%d")
@ -2339,6 +2348,16 @@ class account_model(osv.osv):
return move_ids
def onchange_journal_id(self, cr, uid, ids, journal_id, context=None):
company_id = False
if journal_id:
journal = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context)
if journal.company_id.id:
company_id = journal.company_id.id
return {'value': {'company_id': company_id}}
account_model()
class account_model_line(osv.osv):
@ -2453,10 +2472,10 @@ class account_subscription_line(osv.osv):
all_moves = []
obj_model = self.pool.get('account.model')
for line in self.browse(cr, uid, ids, context=context):
datas = {
data = {
'date': line.date,
}
move_ids = obj_model.generate(cr, uid, [line.subscription_id.model_id.id], datas, context)
move_ids = obj_model.generate(cr, uid, [line.subscription_id.model_id.id], data, context)
tocheck[line.subscription_id.id] = True
self.write(cr, uid, [line.id], {'move_id':move_ids[0]})
all_moves.extend(move_ids)
@ -2504,7 +2523,7 @@ class account_account_template(osv.osv):
'reconcile': fields.boolean('Allow Reconciliation', help="Check this option if you want the user to reconcile entries in this account."),
'shortcut': fields.char('Shortcut', size=12),
'note': fields.text('Note'),
'parent_id': fields.many2one('account.account.template', 'Parent Account Template', ondelete='cascade'),
'parent_id': fields.many2one('account.account.template', 'Parent Account Template', ondelete='cascade', domain=[('type','=','view')]),
'child_parent_ids':fields.one2many('account.account.template', 'parent_id', 'Children'),
'tax_ids': fields.many2many('account.tax.template', 'account_account_template_tax_rel', 'account_id', 'tax_id', 'Default Taxes'),
'nocreate': fields.boolean('Optional create', help="If checked, the new chart of accounts will not contain this by default."),
@ -2522,20 +2541,6 @@ class account_account_template(osv.osv):
(_check_recursion, 'Error!\nYou cannot create recursive account templates.', ['parent_id']),
]
def create(self, cr, uid, vals, context=None):
if vals.get('parent_id'):
parent = self.read(cr, uid, [vals['parent_id']], ['type'])
if parent and parent[0]['type'] != 'view':
raise osv.except_osv(_('Warning!'), _("You may only select a parent account of type 'View'."))
return super(account_account_template, self).create(cr, uid, vals, context=context)
def write(self, cr, uid, ids, vals, context=None):
if vals.get('parent_id'):
parent = self.read(cr, uid, [vals['parent_id']], ['type'])
if parent and parent[0]['type'] != 'view':
raise osv.except_osv(_('Warning!'), _("You may only select a parent account of type 'View'."))
return super(account_account_template, self).write(cr, uid, ids, vals, context=context)
def name_get(self, cr, uid, ids, context=None):
if not ids:
return []
@ -2814,7 +2819,7 @@ class account_tax_template(osv.osv):
'ref_base_sign': fields.float('Base Code Sign', help="Usually 1 or -1."),
'ref_tax_sign': fields.float('Tax Code Sign', help="Usually 1 or -1."),
'include_base_amount': fields.boolean('Include in Base Amount', help="Set if the amount of tax must be included in the base amount before computing the next taxes."),
'description': fields.char('Internal Name', size=32),
'description': fields.char('Internal Name'),
'type_tax_use': fields.selection([('sale','Sale'),('purchase','Purchase'),('all','All')], 'Tax Use In', required=True,),
'price_include': fields.boolean('Tax Included in Price', help="Check this if the price you use on the product and invoices includes this tax."),
}
@ -3236,7 +3241,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
property_obj.create(cr, uid, vals, context=context)
return True
def _install_template(self, cr, uid, template_id, company_id, code_digits=None, obj_wizard=None, acc_ref={}, taxes_ref={}, tax_code_ref={}, context=None):
def _install_template(self, cr, uid, template_id, company_id, code_digits=None, obj_wizard=None, acc_ref=None, taxes_ref=None, tax_code_ref=None, context=None):
'''
This function recursively loads the template objects and create the real objects from them.
@ -3254,6 +3259,12 @@ class wizard_multi_charts_accounts(osv.osv_memory):
* a last identical containing the mapping of tax code templates and tax codes
:rtype: tuple(dict, dict, dict)
'''
if acc_ref is None:
acc_ref = {}
if taxes_ref is None:
taxes_ref = {}
if tax_code_ref is None:
tax_code_ref = {}
template = self.pool.get('account.chart.template').browse(cr, uid, template_id, context=context)
if template.parent_id:
tmp1, tmp2, tmp3 = self._install_template(cr, uid, template.parent_id.id, company_id, code_digits=code_digits, acc_ref=acc_ref, taxes_ref=taxes_ref, tax_code_ref=tax_code_ref, context=context)
@ -3266,7 +3277,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
tax_code_ref.update(tmp3)
return acc_ref, taxes_ref, tax_code_ref
def _load_template(self, cr, uid, template_id, company_id, code_digits=None, obj_wizard=None, account_ref={}, taxes_ref={}, tax_code_ref={}, context=None):
def _load_template(self, cr, uid, template_id, company_id, code_digits=None, obj_wizard=None, account_ref=None, taxes_ref=None, tax_code_ref=None, context=None):
'''
This function generates all the objects from the templates
@ -3284,6 +3295,12 @@ class wizard_multi_charts_accounts(osv.osv_memory):
* a last identical containing the mapping of tax code templates and tax codes
:rtype: tuple(dict, dict, dict)
'''
if account_ref is None:
account_ref = {}
if taxes_ref is None:
taxes_ref = {}
if tax_code_ref is None:
tax_code_ref = {}
template = self.pool.get('account.chart.template').browse(cr, uid, template_id, context=context)
obj_tax_code_template = self.pool.get('account.tax.code.template')
obj_acc_tax = self.pool.get('account.tax')

View File

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

View File

@ -304,7 +304,7 @@ class account_bank_statement(osv.osv):
'date': st_line.date,
'ref': st_line.ref,
'move_id': move_id,
'partner_id': partner_id,
'partner_id': par_id,
'account_id': acc_id,
'credit': credit,
'debit': debit,
@ -447,6 +447,8 @@ class account_bank_statement(osv.osv):
return self.write(cr, uid, done, {'state':'draft'}, context=context)
def _compute_balance_end_real(self, cr, uid, journal_id, context=None):
res = False
if journal_id:
cr.execute('SELECT balance_end_real \
FROM account_bank_statement \
WHERE journal_id = %s AND NOT state = %s \
@ -455,6 +457,8 @@ class account_bank_statement(osv.osv):
return res and res[0] or 0.0
def onchange_journal_id(self, cr, uid, statement_id, journal_id, context=None):
if not journal_id:
return {}
balance_start = self._compute_balance_end_real(cr, uid, journal_id, context=context)
journal_data = self.pool.get('account.journal').read(cr, uid, journal_id, ['default_debit_account_id', 'company_id'], context=context)

View File

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

View File

@ -395,8 +395,13 @@ class account_invoice(osv.osv):
template_id = template and template[1] or False
res = mod_obj.get_object_reference(cr, uid, 'mail', 'email_compose_message_wizard_form')
res_id = res and res[1] or False
ctx = dict(context, active_model='account.invoice', active_id=ids[0])
ctx.update({'mail.compose.template_id': template_id})
ctx = dict(context)
ctx.update({
'default_model': 'account.invoice',
'default_res_id': ids[0],
'default_use_template': True,
'default_template_id': template_id,
})
return {
'view_type': 'form',
'view_mode': 'form',
@ -503,8 +508,10 @@ class account_invoice(osv.osv):
if journal_id:
journal = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context)
currency_id = journal.currency and journal.currency.id or journal.company_id.currency_id.id
company_id = journal.company_id.id
result = {'value': {
'currency_id': currency_id,
'company_id': company_id,
}
}
return result
@ -1098,10 +1105,10 @@ class account_invoice(osv.osv):
if not ids:
return []
types = {
'out_invoice': 'CI: ',
'in_invoice': 'SI: ',
'out_refund': 'OR: ',
'in_refund': 'SR: ',
'out_invoice': 'Invoice ',
'in_invoice': 'Sup. Invoice ',
'out_refund': 'Refund ',
'in_refund': 'Supplier Refund ',
}
return [(r['id'], (r['number']) or types[r['type']] + (r['name'] or '')) for r in self.read(cr, uid, ids, ['type', 'number', 'name'], context, load='_classic_write')]
@ -1301,17 +1308,19 @@ class account_invoice(osv.osv):
def create_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_post(cr, uid, [obj.id], body=_("%s <b>created</b>.") % (_(self._get_document_type(obj.type))), context=context)
self.message_post(cr, uid, [obj.id], body=_("%s <b>created</b>.") % (self._get_document_type(obj.type)),
subtype="account.mt_invoice_new", context=context)
def confirm_paid_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_post(cr, uid, [obj.id], body=_("%s <b>paid</b>.") % (_(self._get_document_type(obj.type))), context=context)
self.message_post(cr, uid, [obj.id], body=_("%s <b>paid</b>.") % (self._get_document_type(obj.type)),
subtype="account.mt_invoice_paid", context=context)
def invoice_cancel_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_post(cr, uid, [obj.id], body=_("%s <b>cancelled</b>.") % (_(self._get_document_type(obj.type))), context=context)
self.message_post(cr, uid, [obj.id], body=_("%s <b>cancelled</b>.") % (self._get_document_type(obj.type)),
context=context)
account_invoice()
class account_invoice_line(osv.osv):
@ -1366,7 +1375,10 @@ class account_invoice_line(osv.osv):
'partner_id': fields.related('invoice_id','partner_id',type='many2one',relation='res.partner',string='Partner',store=True)
}
def _default_account_id(self, cr, uid, ids, context=None):
def _default_account_id(self, cr, uid, context=None):
# XXX this gets the default account for the user's company,
# it should get the default account for the invoice's company
# however, the invoice's company does not reach this point
prop = self.pool.get('ir.property').get(cr, uid, 'property_account_income_categ', 'product.category', context=context)
return prop and prop.id or False
@ -1396,7 +1408,7 @@ class account_invoice_line(osv.osv):
context = {}
company_id = company_id if company_id != None else context.get('company_id',False)
context = dict(context)
context.update({'company_id': company_id})
context.update({'company_id': company_id, 'force_company': company_id})
if not partner_id:
raise osv.except_osv(_('No Partner Defined !'),_("You must first select a partner !") )
if not product:
@ -1551,16 +1563,19 @@ class account_invoice_line(osv.osv):
def onchange_account_id(self, cr, uid, ids, product_id, partner_id, inv_type, fposition_id, account_id):
if not account_id:
return {}
taxes = self.pool.get('account.account').browse(cr, uid, account_id).tax_ids
unique_tax_ids = []
fpos = fposition_id and self.pool.get('account.fiscal.position').browse(cr, uid, fposition_id) or False
tax_ids = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
account = self.pool.get('account.account').browse(cr, uid, account_id)
if not product_id:
taxes = account.tax_ids
unique_tax_ids = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
else:
product_change_result = self.product_id_change(cr, uid, ids, product_id, False, type=inv_type,
partner_id=partner_id, fposition_id=fposition_id)
unique_tax_ids = set(tax_ids)
partner_id=partner_id, fposition_id=fposition_id,
company_id=account.company_id.id)
if product_change_result and 'value' in product_change_result and 'invoice_line_tax_id' in product_change_result['value']:
unique_tax_ids |= set(product_change_result['value']['invoice_line_tax_id'])
return {'value':{'invoice_line_tax_id': list(unique_tax_ids)}}
unique_tax_ids = product_change_result['value']['invoice_line_tax_id']
return {'value':{'invoice_line_tax_id': unique_tax_ids}}
account_invoice_line()
@ -1645,14 +1660,13 @@ class account_invoice_tax(osv.osv):
for line in inv.invoice_line:
for tax in tax_obj.compute_all(cr, uid, line.invoice_line_tax_id, (line.price_unit* (1-(line.discount or 0.0)/100.0)), line.quantity, line.product_id, inv.partner_id)['taxes']:
tax['price_unit'] = cur_obj.round(cr, uid, cur, tax['price_unit'])
val={}
val['invoice_id'] = inv.id
val['name'] = tax['name']
val['amount'] = tax['amount']
val['manual'] = False
val['sequence'] = tax['sequence']
val['base'] = tax['price_unit'] * line['quantity']
val['base'] = cur_obj.round(cr, uid, cur, tax['price_unit'] * line['quantity'])
if inv.type in ('out_invoice','in_invoice'):
val['base_code_id'] = tax['base_code_id']

View File

@ -299,8 +299,8 @@
<button name="invoice_open" states="draft" string="Validate" class="oe_highlight"/>
<button name="invoice_open" states="proforma2" string="Validate"/>
<button name="invoice_proforma2" states="draft" string="PRO-FORMA" groups="account.group_proforma_invoices"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Refund Invoice' states='paid'/>
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" groups="base.group_no_one"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Refund Invoice' states='open,proforma2,paid'/>
<button name="invoice_cancel" states="draft,proforma2,open" string="Cancel" groups="base.group_no_one"/>
<button name="action_cancel_draft" states="cancel" string="Reset to Draft" type="object"/>
<button name='%(action_account_state_open)d' type='action' string='Re-Open' groups="account.group_account_invoice" attrs="{'invisible':['|', ('state','&lt;&gt;','paid'), ('reconciled', '=', True)]}" help="This button only appears when the state of the invoice is 'paid' (showing that it has been fully reconciled) and auto-computed boolean 'reconciled' is False (depicting that it's not the case anymore). In other words, the invoice has been dereconciled and it does not fit anymore the 'paid' state. You should press this button to re-open it and let it continue its normal process after having resolved the eventual exceptions it may have created."/>
<!--button name="%(account_invoices)d" string="Print Invoice" type="action" states="open,paid,proforma,sale,proforma2"/-->

View File

@ -30,7 +30,7 @@
<menuitem id="menu_analytic" parent="menu_analytic_accounting" name="Accounts" groups="analytic.group_analytic_accounting"/>
<menuitem id="menu_journals" sequence="15" name="Journals" parent="menu_finance_configuration" groups="group_account_manager"/>
<menuitem id="menu_configuration_misc" name="Miscellaneous" parent="menu_finance_configuration" sequence="55"/>
<menuitem id="base.menu_action_currency_form" parent="menu_configuration_misc" sequence="20" groups="base.group_no_one"/>
<menuitem id="base.menu_action_currency_form" name="Currencies" parent="menu_configuration_misc" sequence="20" groups="base.group_no_one"/>
<menuitem id="menu_finance_generic_reporting" name="Generic Reporting" parent="menu_finance_reports" sequence="100"/>
<menuitem id="menu_finance_entries" name="Journal Entries" parent="menu_finance" sequence="5" groups="group_account_user,group_account_manager"/>
<menuitem id="menu_account_reports" name="Financial Reports" parent="menu_finance_configuration" sequence="30" />

View File

@ -215,8 +215,10 @@ class account_move_line(osv.osv):
def _default_get(self, cr, uid, fields, context=None):
if context is None:
context = {}
if not context.get('journal_id', False) and context.get('search_default_journal_id', False):
if not context.get('journal_id', False):
context['journal_id'] = context.get('search_default_journal_id')
if not context.get('period_id', False):
context['period_id'] = context.get('search_default_period_id')
account_obj = self.pool.get('account.account')
period_obj = self.pool.get('account.period')
journal_obj = self.pool.get('account.journal')
@ -226,6 +228,9 @@ class account_move_line(osv.osv):
partner_obj = self.pool.get('res.partner')
currency_obj = self.pool.get('res.currency')
context = self.convert_to_period(cr, uid, context)
#pass the right context when search_defaul_journal_id
if context.get('search_default_journal_id',False):
context['journal_id'] = context.get('search_default_journal_id')
# Compute simple values
data = super(account_move_line, self).default_get(cr, uid, fields, context=context)
# Starts: Manual entry from account.move form
@ -480,7 +485,7 @@ class account_move_line(osv.osv):
'debit': fields.float('Debit', digits_compute=dp.get_precision('Account')),
'credit': fields.float('Credit', digits_compute=dp.get_precision('Account')),
'account_id': fields.many2one('account.account', 'Account', required=True, ondelete="cascade", domain=[('type','<>','view'), ('type', '<>', 'closed')], select=2),
'move_id': fields.many2one('account.move', 'Move', ondelete="cascade", help="The move of this entry line.", select=2, required=True),
'move_id': fields.many2one('account.move', 'Journal Entry', ondelete="cascade", help="The move of this entry line.", select=2, required=True),
'narration': fields.related('move_id','narration', type='text', relation='account.move', string='Internal Note'),
'ref': fields.related('move_id', 'ref', string='Reference', type='char', size=64, store=True),
'statement_id': fields.many2one('account.bank.statement', 'Statement', help="The bank statement used for bank reconciliation", select=1),
@ -557,6 +562,7 @@ class account_move_line(osv.osv):
'journal_id': lambda self, cr, uid, c: c.get('journal_id', False),
'credit': 0.0,
'debit': 0.0,
'amount_currency': 0.0,
'account_id': lambda self, cr, uid, c: c.get('account_id', False),
'period_id': lambda self, cr, uid, c: c.get('period_id', False),
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.move.line', context=c)
@ -703,7 +709,9 @@ class account_move_line(osv.osv):
context = {}
if context and context.get('next_partner_only', False):
if not context.get('partner_id', False):
partner = self.get_next_partner_only(cr, uid, offset, context)
partner = self.list_partners_to_reconcile(cr, uid, context=context)
if partner:
partner = partner[0]
else:
partner = context.get('partner_id', False)
if not partner:
@ -711,26 +719,26 @@ class account_move_line(osv.osv):
args.append(('partner_id', '=', partner[0]))
return super(account_move_line, self).search(cr, uid, args, offset, limit, order, context, count)
def get_next_partner_only(self, cr, uid, offset=0, context=None):
def list_partners_to_reconcile(self, cr, uid, context=None):
cr.execute(
"""
SELECT p.id
FROM res_partner p
RIGHT JOIN (
SELECT l.partner_id AS partner_id, SUM(l.debit) AS debit, SUM(l.credit) AS credit
SELECT partner_id
FROM (
SELECT l.partner_id, p.last_reconciliation_date, SUM(l.debit) AS debit, SUM(l.credit) AS credit
FROM account_move_line l
LEFT JOIN account_account a ON (a.id = l.account_id)
LEFT JOIN res_partner p ON (l.partner_id = p.id)
RIGHT JOIN account_account a ON (a.id = l.account_id)
RIGHT JOIN res_partner p ON (l.partner_id = p.id)
WHERE a.reconcile IS TRUE
AND l.reconcile_id IS NULL
AND (p.last_reconciliation_date IS NULL OR l.date > p.last_reconciliation_date)
AND l.state <> 'draft'
GROUP BY l.partner_id
) AS s ON (p.id = s.partner_id)
GROUP BY l.partner_id, p.last_reconciliation_date
) AS s
WHERE debit > 0 AND credit > 0
ORDER BY p.last_reconciliation_date LIMIT 1 OFFSET %s""", (offset, )
)
return cr.fetchone()
ORDER BY last_reconciliation_date""")
ids = cr.fetchall()
ids = len(ids) and [x[0] for x in ids] or []
return self.pool.get('res.partner').name_get(cr, uid, ids, context=context)
def reconcile_partial(self, cr, uid, ids, type='auto', context=None, writeoff_acc_id=False, writeoff_period_id=False, writeoff_journal_id=False):
move_rec_obj = self.pool.get('account.move.reconcile')
@ -910,8 +918,8 @@ class account_move_line(osv.osv):
if lines and lines[0]:
partner_id = lines[0].partner_id and lines[0].partner_id.id or False
if partner_id and context and context.get('stop_reconcile', False):
partner_obj.write(cr, uid, [partner_id], {'last_reconciliation_date': time.strftime('%Y-%m-%d %H:%M:%S')})
if not partner_obj.has_something_to_reconcile(cr, uid, partner_id, context=context):
partner_obj.mark_as_reconciled(cr, uid, [partner_id], context=context)
return r_id
def view_header_get(self, cr, user, view_id, view_type, context=None):
@ -926,6 +934,8 @@ class account_move_line(osv.osv):
return res
if (not context.get('journal_id', False)) or (not context.get('period_id', False)):
return False
if context.get('search_default_journal_id', False):
context['journal_id'] = context.get('search_default_journal_id')
cr.execute('SELECT code FROM account_journal WHERE id = %s', (context['journal_id'], ))
j = cr.fetchone()[0] or ''
cr.execute('SELECT code FROM account_period WHERE id = %s', (context['period_id'], ))
@ -1095,7 +1105,7 @@ class account_move_line(osv.osv):
'has been confirmed.') % res[2])
return res
def _remove_move_reconcile(self, cr, uid, move_ids=[], context=None):
def _remove_move_reconcile(self, cr, uid, move_ids=None, context=None):
# Function remove move rencocile ids related with moves
obj_move_line = self.pool.get('account.move.line')
obj_move_rec = self.pool.get('account.move.reconcile')
@ -1184,12 +1194,12 @@ class account_move_line(osv.osv):
jour_period_obj = self.pool.get('account.journal.period')
cr.execute('SELECT state FROM account_journal_period WHERE journal_id = %s AND period_id = %s', (journal_id, period_id))
result = cr.fetchall()
for (state,) in result:
if state == 'done':
raise osv.except_osv(_('Error!'), _('You cannot add/modify entries in a closed journal.'))
if not result:
journal = journal_obj.browse(cr, uid, journal_id, context=context)
period = period_obj.browse(cr, uid, period_id, context=context)
for (state,) in result:
if state == 'done':
raise osv.except_osv(_('Error !'), _('You can not add/modify entries in a closed period %s of journal %s.' % (period.name,journal.name)))
if not result:
jour_period_obj.create(cr, uid, {
'name': (journal.code or journal.name)+':'+(period.name or ''),
'journal_id': journal.id,

View File

@ -102,6 +102,7 @@
<field name="arch" type="xml">
<form string="Account Period" version="7.0">
<header>
<button string="Close Period" name="%(account.action_account_period_close)d" type="action" class="oe_highlight" states="draft"/>
<button name="action_draft" states="done" string="Set to Draft" type="object" groups="account.group_account_manager"/>
<field name="state" widget="statusbar" nolabel="1"/>
</header>
@ -251,16 +252,6 @@
<field name="company_currency_id"/>
</tree>
</field>
</record>
<record id="view_treasory_graph" model="ir.ui.view">
<field name="name">account.treasury.graph</field>
<field name="model">account.account</field>
<field name="arch" type="xml">
<graph string="Treasury Analysis" type="bar">
<field name="name"/>
<field name="balance" operator="+"/>
</graph>
</field>
</record>
<record id="action_account_form" model="ir.actions.act_window">
<field name="name">Accounts</field>
@ -1048,6 +1039,25 @@
Entries lines
-->
<record id="view_move_line_tree_reconcile" model="ir.ui.view">
<field name="name">account.move.line.reconcile.tree</field>
<field name="model">account.move.line</field>
<field eval="24" name="priority"/>
<field name="arch" type="xml">
<tree colors="red:state == 'draft';black:state == 'valid'" string="Journal Items to Reconcile" create="false">
<field name="date"/>
<field name="move_id"/>
<field name="ref"/>
<field name="name"/>
<field name="partner_id"/>
<field name="account_id"/>
<field name="reconcile_partial_id"/>
<field name="debit" sum="Total debit"/>
<field name="credit" sum="Total credit"/>
</tree>
</field>
</record>
<record id="view_move_line_tree" model="ir.ui.view">
<field name="name">account.move.line.tree</field>
<field name="model">account.move.line</field>
@ -1295,16 +1305,6 @@
Account.Entry Edition
-->
<record id="account_move_graph" model="ir.ui.view">
<field name="name">account.move.graph</field>
<field name="model">account.move</field>
<field name="arch" type="xml">
<graph string="Account Statistics" type="bar">
<field name="period_id"/>
<field name="amount" operator="+"/>
</graph>
</field>
</record>
<record id="view_move_tree" model="ir.ui.view">
<field name="name">account.move.tree</field>
<field name="model">account.move</field>
@ -1328,8 +1328,8 @@
<field name="arch" type="xml">
<form string="Account Entry" version="7.0">
<header>
<button name="button_validate" states="draft" string="Post" type="object" class="oe_highlight"/>
<button name="button_cancel" states="posted" string="Cancel" type="object"/>
<button name="button_validate" states="draft" string="Post" type="object" class="oe_highlight" groups="account.group_account_invoice"/>
<button name="button_cancel" states="posted" string="Cancel" type="object" groups="account.group_account_invoice"/>
<field name="state" widget="statusbar"/>
</header>
<sheet string="Journal Entries" >
@ -1478,7 +1478,7 @@
<field name="name">Journal Entries</field>
<field name="res_model">account.move</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,graph</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_move_tree"/>
<field name="search_view_id" ref="view_account_move_filter"/>
<field name="help" type="html">
@ -1522,7 +1522,6 @@
<record id="action_move_line_search" model="ir.actions.act_window">
<field name="name">Journal Items</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.move.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
@ -1541,15 +1540,31 @@
<field name="act_window_id" ref="action_move_line_search"/>
</record>
<act_window
context="{'search_default_next_partner':1,'view_mode':True}"
id="action_account_manual_reconcile" name="Journal Items"
res_model="account.move.line"
view_id="view_move_line_tree"/>
<record id="action_account_manual_reconcile" model="ir.actions.act_window">
<field name="context">{'search_default_unreconciled': 1,'view_mode':True}</field>
<field name="name">Journal Items to Reconcile</field>
<field name="res_model">account.move.line</field>
<field name="view_id" ref="view_move_line_tree_reconcile"/>
<field name="view_type">form</field>
<field name="view_mode">account_reconciliation_list</field>
<field name="help" type="html">
<p>
Good job!
</p><p>
There is nothing to reconcile. All invoices and payments
have been reconciled, your partner balance is clean.
</p>
</field>
</record>
<menuitem
name="Journal Items to Reconcile"
action="action_account_manual_reconcile"
id="menu_manual_reconcile_bank"
sequence="20"
parent="account.menu_finance_bank_and_cash"/>
<menuitem
name="Manual Reconciliation" icon="STOCK_EXECUTE"
name="Manual Reconciliation"
action="action_account_manual_reconcile"
id="menu_manual_reconcile"
parent="account.periodical_processing_reconciliation"/>
@ -1651,8 +1666,8 @@
<form string="Journal Entry Model" version="7.0">
<group col="4">
<field name="name"/>
<field name="journal_id"/>
<field name="company_id" widget='selection' groups="base.group_multi_company"/>
<field name="journal_id" on_change="onchange_journal_id(journal_id)"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</group>
<field name="lines_id" widget="one2many_list"/>
@ -1728,8 +1743,10 @@
<field name="model">account.payment.term.line</field>
<field name="arch" type="xml">
<form string="Payment Term" version="7.0">
<group>
<field name="name"/>
<field name="sequence"/>
</group>
<group>
<group string="Amount Computation">
<field name="value"/>
@ -1777,12 +1794,11 @@
<field name="model">account.payment.term</field>
<field name="arch" type="xml">
<form string="Payment Term" version="7.0">
<group>
<group col="4">
<field name="name"/>
<field name="active"/>
</group>
<separator string="Description on Invoices"/>
<field name="note"/>
<field name="note" placeholder="Note fo the invoice..."/>
<separator string="Computation"/>
<field name="line_ids"/>
</form>
@ -2011,7 +2027,7 @@
src_model="account.journal"/>
<act_window
context="{'search_default_reconcile_id':False, 'search_default_partner_id':[active_id], 'default_partner_id': active_id}"
context="{'search_default_unreconciled':True, 'search_default_partner_id':[active_id], 'default_partner_id': active_id}"
domain="[('account_id.reconcile', '=', True),('account_id.type', 'in', ['receivable', 'payable'])]"
id="act_account_partner_account_move_all"
name="Receivables &amp; Payables"
@ -2047,7 +2063,7 @@
id="account_template_folder"
name="Templates"
parent="menu_finance_accounting"
groups="base.group_multi_company"/>
groups="account.group_account_manager"/>
<menuitem
id="account_template_taxes"
name="Taxes"
@ -2537,7 +2553,7 @@ action = pool.get('res.config').next(cr, uid, [], context)
<header>
<button name="button_confirm_cash" states="open" string="Close CashBox" type="object" class="oe_highlight"/>
<button name="button_open" states="draft" string="Open CashBox" type="object" class="oe_highlight"/>
<button name="button_cancel" states="confirm,open" string="Cancel" type="object" groups="base.group_extended"/>
<button name="button_cancel" states="confirm,open" string="Cancel" type="object"/>
<field name="state" widget="statusbar" nolabel="1" statusbar_visible="draft,confirm"/>
</header>
<sheet string="Statement">

View File

@ -12,16 +12,6 @@
<field name="domain">[('year','=',time.strftime('%Y'))]</field>
</record>
<record id="action_treasory_graph" model="ir.actions.act_window">
<field name="name">Treasury</field>
<field name="res_model">account.account</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
<field name="domain">[('type','=','liquidity')]</field>
<field name="context">{'default_type': 'liquidity'}</field>
<field name="view_id" ref="account.view_treasory_graph"/>
</record>
<record id="board_account_form" model="ir.ui.view">
<field name="name">board.account.form</field>
<field name="model">board.board</field>
@ -31,9 +21,6 @@
<column>
<action name="%(action_company_analysis_tree)d" string="Company Analysis"/>
</column>
<column>
<action name="%(action_treasory_graph)d" string="Treasury"/>
</column>
</board>
</form>
</field>

View File

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

View File

@ -122,6 +122,14 @@
<field name="type">other</field>
<field name="user_type" ref="data_account_type_income"/>
</record>
<record id="usd_bnk" model="account.account">
<field name="code">X11007</field>
<field name="name">USD Bank Account - (test)</field>
<field ref="cas" name="parent_id"/>
<field name="type">liquidity</field>
<field name="user_type" ref="data_account_type_asset"/>
<field name="currency_id" ref="base.USD"/>
</record>
<record model="account.account" id="liabilities_view">
<field name="name">Liabilities - (test)</field>
@ -360,8 +368,8 @@
<field name="type">bank</field>
<field name="view_id" ref="account_journal_bank_view"/>
<field name="sequence_id" ref="sequence_bank_journal"/>
<field model="account.account" name="default_debit_account_id" ref="cash"/>
<field model="account.account" name="default_credit_account_id" ref="cash"/>
<field model="account.account" name="default_debit_account_id" ref="bnk"/>
<field model="account.account" name="default_credit_account_id" ref="bnk"/>
<field name="analytic_journal_id" ref="sit"/>
<field name="user_id" ref="base.user_root"/>
</record>
@ -384,7 +392,12 @@
<field name="loss_account_id" model="account.account" ref="rsa" />
<field name="internal_account_id" model="account.account" ref="rsa" />
<field name="with_last_closing_balance" eval="True" />
<field name="cash_control" eval="True" />
<!--
Usually, cash payment methods requires a control at opening and closing.
Bot for demo data, it's better to avoid the control step so that people
that test OpenERP arrive directly in the touchscreen UI.
-->
<field name="cash_control" eval="False"/>
<field name="view_id" ref="account_journal_bank_view"/>
<field name="sequence_id" ref="sequence_cash_journal"/>
<field model="account.account" name="default_debit_account_id" ref="cash"/>
@ -412,6 +425,16 @@
<field eval="True" name="centralisation"/>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="bank_journal_usd" model="account.journal">
<field name="name">USD Bank Journal - (test)</field>
<field name="code">TUBK</field>
<field name="type">bank</field>
<field name="view_id" ref="account_journal_bank_view"/>
<field model="account.account" name="default_debit_account_id" ref="usd_bnk"/>
<field model="account.account" name="default_credit_account_id" ref="usd_bnk"/>
<field name="currency" ref="base.USD"/>
</record>
<!--
Product income and expense accounts, default parameters
-->

View File

@ -45,12 +45,12 @@ class account_installer(osv.osv_memory):
sorted(((m.name, m.shortdesc)
for m in modules.browse(cr, uid, ids, context=context)),
key=itemgetter(1)))
charts.insert(0, ('configurable', 'Generic Chart Of Accounts'))
charts.insert(0, ('configurable', _('Custom')))
return charts
_columns = {
# Accounting
'charts': fields.selection(_get_charts, 'Chart of Accounts',
'charts': fields.selection(_get_charts, 'Accounting Package',
required=True,
help="Installs localized accounting charts to match as closely as "
"possible the accounting needs of your company based on your "

View File

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

View File

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

View File

@ -73,7 +73,7 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.analytic.account</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph,form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_account_analytic_account_tree"/>
<field name="search_view_id" ref="account.view_account_analytic_account_search"/>
</record>
@ -114,9 +114,6 @@
</field>
</record>
<menuitem groups="analytic.group_analytic_accounting" id="next_id_40"
name="Analytic" parent="account.menu_finance_generic_reporting"
sequence="4"/>
<record id="view_account_analytic_line_form" model="ir.ui.view">
<field name="name">account.analytic.line.form</field>
@ -351,15 +348,6 @@
# Reporting
#
<record id="action_account_analytic_journal_tree" model="ir.actions.act_window">
<field name="name">Print Analytic Journals</field>
<field name="res_model">account.analytic.journal</field>
<field name="view_type">tree</field>
<field name="help">To print an analytics (or costs) journal for a given period. The report give code, move name, account number, general amount and analytic amount.</field>
</record>
<menuitem groups="analytic.group_analytic_accounting"
action="action_account_analytic_journal_tree"
id="account_analytic_journal_print" parent="account.next_id_40"/>
<record id="view_account_journal_1" model="ir.ui.view">
<field name="name">account.journal.form.1</field>
@ -372,16 +360,5 @@
</field>
</record>
<record id="analytic_accounts_graph" model="ir.ui.view">
<field name="name">analytic.accounts.graph</field>
<field name="model">account.analytic.account</field>
<field name="arch" type="xml">
<graph string="Analytic Account Statistics" type="bar">
<field name="complete_name"/>
<field name="balance" operator="+"/>
</graph>
</field>
</record>
</data>
</openerp>

View File

@ -29,6 +29,7 @@ class account_analytic_journal_report(osv.osv_memory):
_columns = {
'date1': fields.date('Start of period', required=True),
'date2': fields.date('End of period', required=True),
'analytic_account_journal_id': fields.many2many('account.analytic.journal', 'account_analytic_journal_name', 'journal_line_id', 'journal_print_id', 'Analytic Journals', required=True),
}
_defaults = {
@ -40,8 +41,15 @@ class account_analytic_journal_report(osv.osv_memory):
if context is None:
context = {}
data = self.read(cr, uid, ids)[0]
ids_list = []
if context.get('active_id',False):
ids_list.append(context.get('active_id',False))
else:
record = self.browse(cr,uid,ids[0],context=context)
for analytic_record in record.analytic_account_journal_id:
ids_list.append(analytic_record.id)
datas = {
'ids': context.get('active_ids',[]),
'ids': ids_list,
'model': 'account.analytic.journal',
'form': data
}
@ -51,5 +59,13 @@ class account_analytic_journal_report(osv.osv_memory):
'datas': datas,
}
def default_get(self, cr, uid, fields, context=None):
if context is None:
context = {}
res = super(account_analytic_journal_report, self).default_get(cr, uid, fields, context=context)
if 'analytic_account_journal_id' in fields:
res.update({'analytic_account_journal_id': context.get('active_ids',[])})
return res
account_analytic_journal_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -7,15 +7,16 @@
<field name="model">account.analytic.journal.report</field>
<field name="arch" type="xml">
<form string="Select Period" version="7.0">
<header>
<button name="check_report" string="Print" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</header>
<group col="4">
<field name="date1"/>
<field name="date2"/>
<field name="analytic_account_journal_id" widget="many2many_tags" class="oe_inline" required="1"/>
</group>
<footer>
<button name="check_report" string="Print" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
@ -39,5 +40,12 @@
<field name="model">account.analytic.journal</field>
</record>
<menuitem groups="analytic.group_analytic_accounting" id="next_id_40"
name="Analytic" parent="account.menu_finance_generic_reporting"
sequence="4"/>
<menuitem groups="analytic.group_analytic_accounting"
action="account.action_account_analytic_journal"
id="account_analytic_journal_print" parent="account.next_id_40"/>
</data>
</openerp>

View File

@ -68,7 +68,7 @@ class account_balance(report_sxw.rml_parse, common_report_header):
return self.pool.get('account.account').browse(self.cr, self.uid, data['form']['id']).company_id.name
return super(account_balance ,self)._get_account(data)
def lines(self, form, ids=[], done=None):#, level=1):
def lines(self, form, ids=None, done=None):
def _process_child(accounts, disp_acc, parent):
account_rec = [acct for acct in accounts if acct['id']==parent][0]
currency_obj = self.pool.get('res.currency')

View File

@ -160,7 +160,7 @@ class tax_report(report_sxw.rml_parse, common_report_header):
i+=1
return res
def _get_codes(self, based_on, company_id, parent=False, level=0, period_list=[], context=None):
def _get_codes(self, based_on, company_id, parent=False, level=0, period_list=None, context=None):
obj_tc = self.pool.get('account.tax.code')
ids = obj_tc.search(self.cr, self.uid, [('parent_id','=',parent),('company_id','=',company_id)], order='sequence', context=context)
@ -171,7 +171,11 @@ class tax_report(report_sxw.rml_parse, common_report_header):
res += self._get_codes(based_on, company_id, code.id, level+1, context=context)
return res
def _add_codes(self, based_on, account_list=[], period_list=[], context=None):
def _add_codes(self, based_on, account_list=None, period_list=None, context=None):
if account_list is None:
account_list = []
if period_list is None:
period_list = []
res = []
obj_tc = self.pool.get('account.tax.code')
for account in account_list:

View File

@ -51,10 +51,10 @@ class account_config_settings(osv.osv_memory):
'code_digits': fields.integer('# of Digits', help="No. of digits to use for account code"),
'tax_calculation_rounding_method': fields.related('company_id',
'tax_calculation_rounding_method', type='selection', selection=[
('round_per_line', 'Round per Line'),
('round_globally', 'Round Globally'),
('round_per_line', 'Round per line'),
('round_globally', 'Round globally'),
], string='Tax calculation rounding method',
help="If you select 'Round per Line' : for each tax, the tax amount will first be computed and rounded for each PO/SO/invoice line and then these rounded amounts will be summed, leading to the total amount for that tax. If you select 'Round Globally': for each tax, the tax amount will be computed for each PO/SO/invoice line, then these amounts will be summed and eventually this total tax amount will be rounded. If you sell with tax included, you should choose 'Round per line' because you certainly want the sum of your tax-included line subtotals to be equal to the total amount with taxes."),
help="If you select 'Round per line' : for each tax, the tax amount will first be computed and rounded for each PO/SO/invoice line and then these rounded amounts will be summed, leading to the total amount for that tax. If you select 'Round globally': for each tax, the tax amount will be computed for each PO/SO/invoice line, then these amounts will be summed and eventually this total tax amount will be rounded. If you sell with tax included, you should choose 'Round per line' because you certainly want the sum of your tax-included line subtotals to be equal to the total amount with taxes."),
'sale_tax': fields.many2one("account.tax.template", "Default sale tax"),
'purchase_tax': fields.many2one("account.tax.template", "Default purchase tax"),
'sale_tax_rate': fields.float('Sales tax (%)'),
@ -72,40 +72,40 @@ class account_config_settings(osv.osv_memory):
'sale_refund_journal_id': fields.many2one('account.journal', 'Sale refund journal'),
'sale_refund_sequence_prefix': fields.related('sale_refund_journal_id', 'sequence_id', 'prefix', type='char', string='Credit note sequence'),
'sale_refund_sequence_next': fields.related('sale_refund_journal_id', 'sequence_id', 'number_next', type='integer', string='Next credit note number'),
'purchase_journal_id': fields.many2one('account.journal', 'Purchase Journal'),
'purchase_journal_id': fields.many2one('account.journal', 'Purchase journal'),
'purchase_sequence_prefix': fields.related('purchase_journal_id', 'sequence_id', 'prefix', type='char', string='Supplier invoice sequence'),
'purchase_sequence_next': fields.related('purchase_journal_id', 'sequence_id', 'number_next', type='integer', string='Next supplier invoice number'),
'purchase_refund_journal_id': fields.many2one('account.journal', 'Purchase refund journal'),
'purchase_refund_sequence_prefix': fields.related('purchase_refund_journal_id', 'sequence_id', 'prefix', type='char', string='Supplier credit note sequence'),
'purchase_refund_sequence_next': fields.related('purchase_refund_journal_id', 'sequence_id', 'number_next', type='integer', string='Next supplier credit note number'),
'module_account_check_writing': fields.boolean('pay your suppliers by check',
'module_account_check_writing': fields.boolean('Pay your suppliers by check',
help="""This allows you to check writing and printing.
This installs the module account_check_writing."""),
'module_account_accountant': fields.boolean('full accounting features: journals, legal statements, chart of accounts, etc.',
'module_account_accountant': fields.boolean('Full accounting features: journals, legal statements, chart of accounts, etc.',
help="""If you do not check this box, you will be able to do invoicing & payments, but not accounting (Journal Items, Chart of Accounts, ...)"""),
'module_account_asset': fields.boolean('assets management',
'module_account_asset': fields.boolean('Assets management',
help="""This allows you to manage the assets owned by a company or a person.
It keeps track of the depreciation occurred on those assets, and creates account move for those depreciation lines.
This installs the module account_asset. If you do not check this box, you will be able to do invoicing & payments,
but not accounting (Journal Items, Chart of Accounts, ...)"""),
'module_account_budget': fields.boolean('budget management',
'module_account_budget': fields.boolean('Budget management',
help="""This allows accountants to manage analytic and crossovered budgets.
Once the master budgets and the budgets are defined,
the project managers can set the planned amount on each analytic account.
This installs the module account_budget."""),
'module_account_payment': fields.boolean('manage payment orders',
'module_account_payment': fields.boolean('Manage payment orders',
help="""This allows you to create and manage your payment orders, with purposes to
* serve as base for an easy plug-in of various automated payment mechanisms, and
* provide a more efficient way to manage invoice payments.
This installs the module account_payment."""),
'module_account_voucher': fields.boolean('manage customer payments',
'module_account_voucher': fields.boolean('Manage customer payments',
help="""This includes all the basic requirements of voucher entries for bank, cash, sales, purchase, expense, contra, etc.
This installs the module account_voucher."""),
'module_account_followup': fields.boolean('manage customer payment follow-ups',
'module_account_followup': fields.boolean('Manage customer payment follow-ups',
help="""This allows to automate letters for unpaid invoices, with multi-level recalls.
This installs the module account_followup."""),
'group_proforma_invoices': fields.boolean('allow pro-forma invoices',
'group_proforma_invoices': fields.boolean('Allow pro-forma invoices',
implied_group='account.group_proforma_invoices',
help="Allows you to put invoices in pro-forma state."),
'default_sale_tax': fields.many2one('account.tax', 'Default sale tax',
@ -114,9 +114,12 @@ class account_config_settings(osv.osv_memory):
help="This purchase tax will be assigned by default on new products."),
'decimal_precision': fields.integer('Decimal precision on journal entries',
help="""As an example, a decimal precision of 2 will allow journal entries like: 9.99 EUR, whereas a decimal precision of 4 will allow journal entries like: 0.0231 EUR."""),
'group_multi_currency': fields.boolean('allow multi currencies',
'group_multi_currency': fields.boolean('Allow multi currencies',
implied_group='base.group_multi_currency',
help="Allows you multi currency environment"),
'group_analytic_accounting': fields.boolean('Analytic accounting',
implied_group='analytic.group_analytic_accounting',
help="Allows you to use the analytic accounting."),
}
def _default_company(self, cr, uid, context=None):
@ -223,6 +226,16 @@ class account_config_settings(osv.osv_memory):
return {'value': {'date_stop': end_date.strftime('%Y-%m-%d')}}
return {}
def open_company_form(self, cr, uid, ids, context=None):
config = self.browse(cr, uid, ids[0], context)
return {
'type': 'ir.actions.act_window',
'name': 'Configure your Company',
'res_model': 'res.company',
'res_id': config.company_id.id,
'view_mode': 'form',
}
def set_default_taxes(self, cr, uid, ids, context=None):
""" set default sale and purchase taxes for products """
ir_values = self.pool.get('ir.values')

View File

@ -129,6 +129,10 @@
<field name="module_account_accountant" class="oe_inline"/>
<label for="module_account_accountant"/>
</div>
<div>
<field name="group_analytic_accounting" class="oe_inline"/>
<label for="group_analytic_accounting"/>
</div>
<div>
<field name="module_account_asset" class="oe_inline"/>
<label for="module_account_asset"/>
@ -224,10 +228,8 @@
<div>
<div>
<label for="company_footer"/>
<button name="%(action_bank_tree)d"
string="Configure your bank accounts"
icon="gtk-go-forward"
type="action"
<button name="open_company_form" type="object"
string="Configure your company bank accounts" icon="gtk-go-forward"
class="oe_inline oe_link"/>
<field name="company_footer"/>
</div>

View File

@ -45,4 +45,3 @@ class res_currency_account(osv.osv):
res_currency_account()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,18 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp><data>
<openerp>
<data>
<record id="group_account_invoice" model="res.groups">
<field name="name">Invoicing &amp; Payments</field>
<field name="category_id" ref="base.module_category_accounting_and_finance"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
</record>
<record id="group_account_user" model="res.groups">
<field name="name">Accountant</field>
<field name="category_id" ref="base.module_category_accounting_and_finance"/>
<field name="implied_ids" eval="[(4, ref('group_account_invoice'))]"/>
</record>
<record id="group_account_manager" model="res.groups">
<field name="name">Manager</field>
<field name="name">Financial Manager</field>
<field name="category_id" ref="base.module_category_accounting_and_finance"/>
<field name="implied_ids" eval="[(4, ref('group_account_user'))]"/>
</record>
@ -24,100 +28,107 @@
<record id="account_move_comp_rule" model="ir.rule">
<field name="name">Account Entry</field>
<field ref="model_account_move" name="model_id"/>
<field eval="True" name="global"/>
<field name="model_id" ref="model_account_move"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="account_move_line_comp_rule" model="ir.rule">
<field name="name">Entry lines</field>
<field model="ir.model" name="model_id" ref="model_account_move_line"/>
<field eval="True" name="global"/>
<field name="model_id" ref="model_account_move_line"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="journal_period_comp_rule" model="ir.rule">
<field name="name">Journal Period</field>
<field model="ir.model" name="model_id" ref="model_account_journal_period"/>
<field eval="True" name="global"/>
<field name="model_id" ref="model_account_journal_period"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="journal_comp_rule" model="ir.rule">
<field name="name">Journal multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_journal"/>
<field eval="True" name="global"/>
<field name="model_id" ref="model_account_journal"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="analytic_journal_comp_rule" model="ir.rule">
<field name="name">Analytic journal multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_analytic_journal"/>
<field eval="True" name="global"/>
<field name="model_id" ref="model_account_analytic_journal"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="period_comp_rule" model="ir.rule">
<field name="name">Period multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_period"/>
<field eval="True" name="global"/>
<field name="model_id" ref="model_account_period"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="fiscal_year_comp_rule" model="ir.rule">
<field name="name">Fiscal year multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_fiscalyear"/>
<field eval="True" name="global"/>
<field name="model_id" ref="model_account_fiscalyear"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="account_comp_rule" model="ir.rule">
<field name="name">Account multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_account"/>
<field eval="True" name="global"/>
<field name="model_id" ref="model_account_account"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="tax_comp_rule" model="ir.rule">
<field name="name">Tax multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_tax"/>
<field eval="True" name="global"/>
<field name="model_id" ref="model_account_tax"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="tax_code_comp_rule" model="ir.rule">
<field name="name">Tax code multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_tax_code"/>
<field eval="True" name="global"/>
<field name="model_id" ref="model_account_tax_code"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="invoice_comp_rule" model="ir.rule">
<field name="name">Invoice multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_invoice"/>
<field eval="True" name="global"/>
<field name="model_id" ref="model_account_invoice"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="invoice_analysis_comp_rule" model="ir.rule">
<field name="name">Invoice Analysis multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_invoice_report"/>
<field eval="True" name="global"/>
<field name="model_id" ref="model_account_invoice_report"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="entry_analysis_comp_rule" model="ir.rule">
<field name="name">Entries Analysis multi-company</field>
<field name="model_id" ref="model_account_entries_report"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="account_fiscal_position_comp_rule" model="ir.rule">
<field name="name">Account fiscal Mapping company rule</field>
<field model="ir.model" name="model_id" ref="model_account_fiscal_position"/>
<field eval="True" name="global"/>
<field name="model_id" ref="model_account_fiscal_position"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="account_model_comp_rule" model="ir.rule">
<field name="name">Account model company rule</field>
<field model="ir.model" name="model_id" ref="model_account_model"/>
<field eval="True" name="global"/>
<field name="model_id" ref="model_account_model"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
@ -142,4 +153,5 @@
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
</data></openerp>
</data>
</openerp>

View File

@ -82,6 +82,7 @@ access_account_entries_report_invoice,account.entries.report,model_account_entri
access_account_entries_report_employee,account.entries.report employee,model_account_entries_report,base.group_user,1,0,0,0
access_analytic_entries_report_manager,analytic.entries.report,model_analytic_entries_report,account.group_account_manager,1,0,0,0
access_account_cashbox_line,account.cashbox.line,model_account_cashbox_line,account.group_account_user,1,1,1,1
access_account_journal_cashbox_line,account.journal.cashbox.line,model_account_journal_cashbox_line,account.group_account_user,1,1,1,0
access_account_journal_view_invoice,account.journal.view invoice,model_account_journal_view,account.group_account_invoice,1,1,1,1
access_account_journal_column_invoice,account.journal.column invoice,model_account_journal_column,account.group_account_invoice,1,1,1,1
access_account_invoice_tax_accountant,account.invoice.tax accountant,model_account_invoice_tax,account.group_account_user,1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
82 access_account_entries_report_employee account.entries.report employee model_account_entries_report base.group_user 1 0 0 0
83 access_analytic_entries_report_manager analytic.entries.report model_analytic_entries_report account.group_account_manager 1 0 0 0
84 access_account_cashbox_line account.cashbox.line model_account_cashbox_line account.group_account_user 1 1 1 1
85 access_account_journal_cashbox_line account.journal.cashbox.line model_account_journal_cashbox_line account.group_account_user 1 1 1 0
86 access_account_journal_view_invoice account.journal.view invoice model_account_journal_view account.group_account_invoice 1 1 1 1
87 access_account_journal_column_invoice account.journal.column invoice model_account_journal_column account.group_account_invoice 1 1 1 1
88 access_account_invoice_tax_accountant account.invoice.tax accountant model_account_invoice_tax account.group_account_user 1 0 0 0

View File

@ -0,0 +1,19 @@
.openerp .oe_account_reconciliation {
border-bottom: 1px solid #CACACA;
padding: 5px;
}
.openerp .oe_account_reconciliation button {
margin: 3px;
}
.openerp .oe_account_reconciliation>div {
display: table;
width: 100%;
}
.openerp .oe_account_reconciliation>div>div {
display: table-cell;
width: 50%:
}

View File

@ -0,0 +1,124 @@
openerp.account = function (instance) {
var _t = instance.web._t,
_lt = instance.web._lt;
var QWeb = instance.web.qweb;
instance.web.account = {};
instance.web.views.add('account_reconciliation_list', 'instance.web.account.ReconciliationListView');
instance.web.account.ReconciliationListView = instance.web.ListView.extend({
init: function() {
this._super.apply(this, arguments);
var self = this;
this.current_partner = null;
this.do_select.add(function() {
if (self.get_selected_ids().length === 0) {
self.$(".oe_account_recon_reconcile").attr("disabled", "");
} else {
self.$(".oe_account_recon_reconcile").removeAttr("disabled");
}
});
},
on_loaded: function() {
var self = this;
var tmp = this._super.apply(this, arguments);
if (this.partners) {
this.$el.prepend(QWeb.render("AccountReconciliation", {widget: this}));
this.$(".oe_account_recon_previous").click(function() {
self.current_partner = (self.current_partner - 1) % self.partners.length;
self.search_by_partner();
});
this.$(".oe_account_recon_next").click(function() {
self.current_partner = (self.current_partner + 1) % self.partners.length;
self.search_by_partner();
});
this.$(".oe_account_recon_reconcile").click(function() {
self.reconcile();
});
this.$(".oe_account_recom_mark_as_reconciled").click(function() {
self.mark_as_reconciled();
});
}
return tmp;
},
do_search: function(domain, context, group_by) {
var self = this;
this.last_domain = domain;
this.last_context = context;
this.last_group_by = group_by;
this.old_search = _.bind(this._super, this);
var mod = new instance.web.Model("account.move.line", context, domain);
return mod.call("list_partners_to_reconcile", []).pipe(function(result) {
var current = self.current_partner !== null ? self.partners[self.current_partner][0] : null;
self.partners = result;
var index = _.find(_.range(self.partners.length), function(el) {
if (current === self.partners[el][0])
return true;
});
if (index !== undefined)
self.current_partner = index;
else
self.current_partner = self.partners.length == 0 ? null : 0;
self.search_by_partner();
});
},
search_by_partner: function() {
var self = this;
var fct = function() {
return self.old_search(new instance.web.CompoundDomain(self.last_domain,
[["partner_id", "in", self.current_partner === null ? [] :
[self.partners[self.current_partner][0]] ]]), self.last_context, self.last_group_by);
};
if (self.current_partner === null) {
self.last_reconciliation_date = _t("Never");
return fct();
} else {
return new instance.web.Model("res.partner").call("read",
[self.partners[self.current_partner][0], ["last_reconciliation_date"]]).pipe(function(res) {
self.last_reconciliation_date =
instance.web.format_value(res.last_reconciliation_date, {"type": "datetime"}, _t("Never"));
return fct();
});
}
},
reconcile: function() {
var self = this;
var ids = this.get_selected_ids();
if (ids.length === 0) {
instance.web.dialog($("<div />").text(_t("You must choose at least one record.")), {
title: _t("Warning"),
modal: true
});
return false;
}
new instance.web.Model("ir.model.data").call("get_object_reference", ["account", "action_view_account_move_line_reconcile"]).pipe(function(result) {
var additional_context = _.extend({
active_id: ids[0],
active_ids: ids,
active_model: self.model
});
return self.rpc("/web/action/load", {
action_id: result[1],
context: additional_context
}, function (result) {
result = result.result;
result.context = _.extend(result.context || {}, additional_context);
result.flags = result.flags || {};
result.flags.new_window = true;
return self.do_action(result, function () {
self.do_search(self.last_domain, self.last_context, self.last_group_by);
});
});
});
},
mark_as_reconciled: function() {
var self = this;
var id = self.partners[self.current_partner][0];
new instance.web.Model("res.partner").call("mark_as_reconciled", [[id]]).pipe(function() {
self.do_search(self.last_domain, self.last_context, self.last_group_by);
});
},
});
};

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="AccountReconciliation">
<div class="oe_account_reconciliation">
<t t-if="widget.current_partner === null">
There is no pending reconciliation.
</t>
<t t-if="widget.current_partner !== null">
<div>
<div>
<button class="oe_account_recon_previous oe_button" href="javascript:void(0)">&lt;</button>
<t t-esc="'' + widget.partners[widget.current_partner][1] + ' (' + (widget.current_partner + 1) + '/' + widget.partners.length + ')'"/>
<button class="oe_account_recon_next oe_button" href="javascript:void(0)">&gt;</button>
</div>
<div>
Last Reconciliation: <t t-esc="widget.last_reconciliation_date" />
</div>
</div>
<div>
<button class="oe_account_recon_reconcile oe_button oe_highlight" href="javascript:void(0)"
disabled="">Reconcile</button>
<button class="oe_account_recom_mark_as_reconciled oe_button" href="javascript:void(0)">Nothing to reconcile</button>
</div>
</t>
</div>
</t>
</templates>

View File

@ -32,11 +32,11 @@ class account_invoice_refund(osv.osv_memory):
_name = "account.invoice.refund"
_description = "Invoice Refund"
_columns = {
'date': fields.date('Operation Date', help='This date will be used as the invoice date for credit note and period will be chosen accordingly!'),
'date': fields.date('Date', help='This date will be used as the invoice date for credit note and period will be chosen accordingly!'),
'period': fields.many2one('account.period', 'Force period'),
'journal_id': fields.many2one('account.journal', 'Refund Journal', help='You can select here the journal to use for the credit note that will be created. If you leave that field empty, it will use the same journal as the current invoice.'),
'description': fields.char('Description', size=128, required=True),
'filter_refund': fields.selection([('refund', 'Create a draft refund'), ('cancel', 'Cancel: create credit note and reconcile'),('modify', 'Modify: create credit note, reconcile and create a new draft invoice')], "Refund Method", required=True, help='Credit note base on this type. You can not Modify and Cancel if the invoice is already reconciled'),
'description': fields.char('Reason', size=128, required=True),
'filter_refund': fields.selection([('refund', 'Create a draft credit note'), ('cancel', 'Cancel: create credit note and reconcile'),('modify', 'Modify: create credit note, reconcile and create a new draft invoice')], "Refund Method", required=True, help='Credit note base on this type. You can not Modify and Cancel if the invoice is already reconciled'),
}
def _get_journal(self, cr, uid, context=None):

View File

@ -7,19 +7,40 @@
<field name="model">account.invoice.refund</field>
<field name="arch" type="xml">
<form string="Credit Note" version="7.0">
<separator string="Credit Note Options"/>
<group col="4">
<group>
<group colspan="2">
<label for="filter_refund"/>
<div>
<field name="filter_refund" class="oe_inline"/>
<p attrs="{'invisible':[('filter_refund','&lt;&gt;','refund')]}" class="oe_grey">
You will be able to edit and validate this
credit note directly or keep it draft,
waiting for the document to be issued by
your supplier/customer.
</p>
<p attrs="{'invisible':[('filter_refund','&lt;&gt;','cancel')]}" class="oe_grey">
Use this option if you want to cancel an invoice you should not
have issued. The credit note will be created, validated and reconciled
with the invoice. You will not be able to modify the credit note.
</p>
<p attrs="{'invisible':[('filter_refund','&lt;&gt;','modify')]}" class="oe_grey">
Use this option if you want to cancel an invoice and create a new
one. The credit note will be created, validated and reconciled
with the current invoice. A new, draft, invoice will be created
so that you can edit it.
</p>
</div>
</group>
<group>
<field name="description"/>
<field name="journal_id" widget='selection'/>
</group><group>
<field name="date"/>
<field name="period"/>
<field name="filter_refund"/>
</group>
<label string="Modify Invoice: Cancels the current invoice and creates a new copy of it ready for editing."/>
<label string="Credit Note: Creates the credit note, ready for editing."/>
<label string="Cancel Invoice: Creates the credit note, validate and reconcile it to cancel the current invoice."/>
</group>
<footer>
<button string='Refund' name="invoice_refund" type="object" class="oe_highlight"/>
<button string='Create Credit Note' name="invoice_refund" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
@ -28,7 +49,7 @@
</record>
<record id="action_account_invoice_refund" model="ir.actions.act_window">
<field name="name">Refund</field>
<field name="name">Refund Invoice</field>
<field name="res_model">account.invoice.refund</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>

View File

@ -38,7 +38,7 @@ class account_move_journal(osv.osv_memory):
_defaults = {
'target_move': 'all'
}
def _get_period(self, cr, uid, context={}):
def _get_period(self, cr, uid, context=None):
"""
Return default account period value
"""
@ -92,14 +92,14 @@ class account_move_journal(osv.osv_memory):
journal = False
if journal_id:
journal = journal_pool.read(cr, uid, [journal_id], ['name'])[0]['name']
journal = journal_pool.read(cr, uid, journal_id, ['name'], context=context).get('name',False)
journal_string = _("Journal: %s") % tools.ustr(journal)
else:
journal_string = _("Journal: All")
period = False
if period_id:
period = period_pool.browse(cr, uid, [period_id], ['name'])[0]['name']
period = period_pool.browse(cr, uid, period_id, context=context).name
period_string = _("Period: %s") % tools.ustr(period)
open_string = _("Open")

View File

@ -23,6 +23,7 @@ import time
from osv import fields, osv
from tools.translate import _
import decimal_precision as dp
class account_move_line_reconcile(osv.osv_memory):
"""
@ -32,9 +33,9 @@ class account_move_line_reconcile(osv.osv_memory):
_description = 'Account move line reconcile'
_columns = {
'trans_nbr': fields.integer('# of Transaction', readonly=True),
'credit': fields.float('Credit amount', readonly=True),
'debit': fields.float('Debit amount', readonly=True),
'writeoff': fields.float('Write-Off amount', readonly=True),
'credit': fields.float('Credit amount', readonly=True, digits_compute=dp.get_precision('Account')),
'debit': fields.float('Debit amount', readonly=True, digits_compute=dp.get_precision('Account')),
'writeoff': fields.float('Write-Off amount', readonly=True, digits_compute=dp.get_precision('Account')),
}
def default_get(self, cr, uid, fields, context=None):
@ -86,19 +87,6 @@ class account_move_line_reconcile(osv.osv_memory):
ids = period_obj.find(cr, uid, dt=date, context=context)
if ids:
period_id = ids[0]
#stop the reconciliation process by partner (manual reconciliation) only if there is nothing more to reconcile for this partner
if 'active_ids' in context and context['active_ids']:
tmp_ml_id = account_move_line_obj.browse(cr, uid, context['active_ids'], context)[0]
partner_id = tmp_ml_id.partner_id and tmp_ml_id.partner_id.id or False
debit_ml_ids = account_move_line_obj.search(cr, uid, [('partner_id', '=', partner_id), ('account_id.reconcile', '=', True), ('reconcile_id', '=', False), ('debit', '>', 0)], context=context)
credit_ml_ids = account_move_line_obj.search(cr, uid, [('partner_id', '=', partner_id), ('account_id.reconcile', '=', True), ('reconcile_id', '=', False), ('credit', '>', 0)], context=context)
for ml_id in context['active_ids']:
if ml_id in debit_ml_ids:
debit_ml_ids.remove(ml_id)
if ml_id in credit_ml_ids:
credit_ml_ids.remove(ml_id)
if not debit_ml_ids and credit_ml_ids:
context.update({'stop_reconcile': True})
account_move_line_obj.reconcile(cr, uid, context['active_ids'], 'manual', account_id,
period_id, journal_id, context=context)
return {'type': 'ir.actions.act_window_close'}
@ -166,7 +154,6 @@ class account_move_line_reconcile_writeoff(osv.osv_memory):
if ids:
period_id = ids[0]
context.update({'stop_reconcile': True})
account_move_line_obj.reconcile(cr, uid, context['active_ids'], 'manual', account_id,
period_id, journal_id, context=context)
return {'type': 'ir.actions.act_window_close'}

View File

@ -57,10 +57,10 @@ class account_partner_reconcile_process(osv.osv_memory):
def _get_partner(self, cr, uid, context=None):
move_line_obj = self.pool.get('account.move.line')
partner = move_line_obj.get_next_partner_only(cr, uid, offset=1, context=context)
partner = move_line_obj.list_partners_to_reconcile(cr, uid, context=context)
if not partner:
return False
return partner[0]
return partner[0][0]
def data_get(self, cr, uid, to_reconcile, today_reconciled, context=None):
return {'progress': (100 / (float(to_reconcile + today_reconciled) or 1.0)) * today_reconciled}

View File

@ -26,14 +26,11 @@
'sequence': 10,
'summary': 'Financial and Analytic Accounting',
'description': """
Accounting Access Rights.
=========================
Accounting Access Rights
========================
It gives the Administrator user access to all accounting features such as journal items and the chart of accounts.
This module gives the Admin user the access to all the accounting features
like the journal items and the chart of accounts.
It assigns manager and user access rights to the Administrator and only
user rights to Demo user.
It assigns manager and user access rights to the Administrator and only user rights to the Demo user.
""",
'website': 'http://www.openerp.com',
'depends' : ['account_voucher'],
@ -46,6 +43,5 @@ user rights to Demo user.
'installable': True,
'auto_install': False,
'application': True,
'certificate': '00395091383933390541',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -5,6 +5,7 @@
<!-- Top menu item -->
<menuitem name="Accounting"
id="account.menu_finance"/>
</data>
<data noupdate="1">
@ -14,10 +15,9 @@
<field name="tag">reload</field>
<field name="params" eval="{'menu_id': ref('account.menu_finance')}"/>
</record>
<record id="todo_open_account_menu" model="ir.actions.todo">
<record id="base.open_menu" model="ir.actions.todo">
<field name="action_id" ref="action_client_account_menu"/>
<field name="type">automatic</field>
<field name="sequence">100</field>
<field name="state">open</field>
</record>
<!-- Notify all employees of module installation -->
@ -26,9 +26,11 @@
<field name="res_id" ref="mail.group_all_employees"/>
<field name="type">notification</field>
<field name="subject">Accounting and Finance application installed!</field>
<field name="body">With OpenERP's accounting, you get instant access to your financial data, and can setup analytic accounting, forecast taxes, control budgets, easily create and send invoices, record bank statements, etc.
<field name="body"><![CDATA[
With OpenERP's accounting, you get instant access to your financial data, and can setup analytic accounting, forecast taxes, control budgets, easily create and send invoices, record bank statements, etc.
The accounting features are fully integrated with other OpenERP applications to automate all your processes: creation of customer invoices, control of supplier invoices, point-of-sale integration, automated follow-ups, etc.</field>
<p>The accounting features are fully integrated with other OpenERP applications to automate all your processes: creation of customer invoices, control of supplier invoices, point-of-sale integration, automated follow-ups, etc.</p>
]]></field>
</record>
</data>
</openerp>

View File

@ -36,6 +36,7 @@ Adds menu to show relevant information to each manager.You can also view the rep
'depends': ['hr_timesheet_invoice', 'sale'], #although sale is technically not required to install this module, all menuitems are located under 'Sales' application
'data': [
'security/ir.model.access.csv',
'security/account_analytic_analysis_security.xml',
'account_analytic_analysis_view.xml',
'account_analytic_analysis_menu.xml',
'account_analytic_analysis_cron.xml',
@ -46,7 +47,6 @@ Adds menu to show relevant information to each manager.You can also view the rep
'demo': [],
'installable': True,
'auto_install': False,
'certificate': '0042927202589',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -465,7 +465,7 @@ class account_analytic_account(osv.osv):
def open_sale_order_lines(self,cr,uid,ids,context=None):
if context is None:
context = {}
sale_ids = self.pool.get('sale.order').search(cr,uid,[('project_id','=',context.get('search_default_project_id',False)),('partner_id','=',context.get('search_default_partner_id',False))])
sale_ids = self.pool.get('sale.order').search(cr,uid,[('project_id','=',context.get('search_default_project_id',False)),('partner_id','in',context.get('search_default_partner_id',False))])
names = [record.name for record in self.browse(cr, uid, ids, context=context)]
name = _('Sale Order Lines of %s') % ','.join(names)
return {

View File

@ -48,7 +48,7 @@
<field name="name">Contracts to Renew</field>
<field name="res_model">account.analytic.account</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,graph</field>
<field name="view_mode">tree,form</field>
<field name="context">{'search_default_user_id':uid, 'search_default_draft':1, 'search_default_pending':1, 'search_default_open':1, 'search_default_renew':1}</field>
<field name="domain">[('type','=','contract')]</field>
<field name="search_view_id" ref="view_account_analytic_account_overdue_search"/>
@ -72,10 +72,19 @@
<field name="name">Contracts</field>
<field name="res_model">account.analytic.account</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,graph</field>
<field name="context">{'default_type':'contract'}</field>
<field name="view_mode">tree,form</field>
<field name="context">{'default_type':'contract', 'search_default_open':1, 'search_default_pending':1}</field>
<field name="domain">[('type','=','contract')]</field>
<field name="search_view_id" ref="view_account_analytic_account_overdue_search"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a new contract.
</p><p>
Use contracts to follow tasks, issues, timesheets or invoicing based on
work done, expenses and/or sales orders. OpenERP will automatically manage
the alerts for the renewal of the contracts to the right salesperson.
</p>
</field>
</record>
<menuitem id="base.menu_sales" name="Sales"
parent="base.menu_base_partner"

View File

@ -140,6 +140,16 @@
<field name="view_mode">tree,form</field>
<field name="domain">[('type','=','template')]</field>
<field name="context">{'search_default_type':'template','default_type' : 'template'}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click here to create a template of contract.
</p><p>
Templates are used to prefigure contract/project that
can be selected by the salespeople to quickly configure the
terms and conditions of the contract.
</p>
</field>
</record>
<menuitem action="template_of_contract_action" id="menu_template_of_contract_action" parent="base.menu_base_config"/>
</data>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="res.users" id="base.user_root">
<field eval="[(4,ref('sale.group_analytic_accounting'))]" name="groups_id"/>
</record>
</data>
</openerp>

View File

@ -47,7 +47,6 @@ Allows to automatically select analytic accounts based on criterions:
'demo': [],
'installable': True,
'auto_install': False,
'certificate': '0074229833581',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -79,7 +79,6 @@ The analytic plan validates the minimum and maximum percentage at the time of cr
'test': ['test/acount_analytic_plans_report.yml'],
'installable': True,
'auto_install': False,
'certificate': '0036417675373',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -262,6 +262,7 @@ account_analytic_plan_instance()
class account_analytic_plan_instance_line(osv.osv):
_name = "account.analytic.plan.instance.line"
_description = "Analytic Instance Line"
_rec_name = "analytic_account_id"
_columns = {
'plan_id': fields.many2one('account.analytic.plan.instance', 'Plan Id'),
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True, domain=[('type','<>','view')]),

View File

@ -112,7 +112,9 @@ class crossovered_analytic(report_sxw.rml_parse):
result.append(res)
return result
def _lines(self, form, ids={}):
def _lines(self, form, ids=None):
if ids is None:
ids = {}
if not ids:
ids = self.ids

View File

@ -46,7 +46,6 @@ account.""",
'data': ['product_view.xml',],
'auto_install': False,
'installable': True,
'certificate':'00557423080410733581',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,43 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 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/>.
#
##############################################################################
from osv import fields, osv
#class sale_order_line(osv.osv):
# _name = 'sale.order.line'
# _description = 'Sale Order line'
# _inherit = 'sale.order.line'
#
# def invoice_line_create(self, cr, uid, ids, context={}):
# line_ids = super('sale_order_line',self).invoice_line_create(cr, uid, ids, context)
# invoice_line_obj = self.pool.get('account.invoice.line')
# for line in invoice_line_obj.browse(cr, uid, line_ids):
# if line.product_id:
# a = line.product_id.product_tmpl_id.property_stock_account_output and line.product_id.product_tmpl_id.property_stock_account_output.id
# if not a:
# a = line.product_id.categ_id.property_stock_account_output_categ and line.product_id.categ_id.property_stock_account_output_categ.id
# if a:
# a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, a)
# invoice_line_obj.write(cr, uid, line.id, {'account_id':a})
#
#sale_order_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -75,7 +75,7 @@ class account_asset_asset(osv.osv):
_name = 'account.asset.asset'
_description = 'Asset'
def _get_period(self, cr, uid, context={}):
def _get_period(self, cr, uid, context=None):
periods = self.pool.get('account.period').find(cr, uid)
if periods:
return periods[0]
@ -176,7 +176,9 @@ class account_asset_asset(osv.osv):
year = depreciation_date.year
return True
def validate(self, cr, uid, ids, context={}):
def validate(self, cr, uid, ids, context=None):
if context is None:
context = {}
return self.write(cr, uid, ids, {
'state':'open'
}, context)
@ -304,7 +306,7 @@ class account_asset_asset(osv.osv):
default.update({'depreciation_line_ids': [], 'state': 'draft'})
return super(account_asset_asset, self).copy(cr, uid, id, default, context=context)
def _compute_entries(self, cr, uid, ids, period_id, context={}):
def _compute_entries(self, cr, uid, ids, period_id, context=None):
result = []
period_obj = self.pool.get('account.period')
depreciation_obj = self.pool.get('account.asset.depreciation.line')
@ -350,7 +352,7 @@ class account_asset_depreciation_line(osv.osv):
'amount': fields.float('Depreciation Amount', required=True),
'remaining_value': fields.float('Amount to Depreciate', required=True),
'depreciated_value': fields.float('Amount Already Depreciated', required=True),
'depreciation_date': fields.char('Depreciation Date', size=64, select=1),
'depreciation_date': fields.date('Depreciation Date', select=1),
'move_id': fields.many2one('account.move', 'Depreciation Entry'),
'move_check': fields.function(_get_move_check, method=True, type='boolean', string='Posted', store=True)
}
@ -368,7 +370,7 @@ class account_asset_depreciation_line(osv.osv):
for line in self.browse(cr, uid, ids, context=context):
if currency_obj.is_zero(cr, uid, line.asset_id.currency_id, line.remaining_value):
can_close = True
depreciation_date = line.asset_id.prorata and line.asset_id.purchase_date or time.strftime('%Y-%m-%d')
depreciation_date = time.strftime('%Y-%m-%d')
period_ids = period_obj.find(cr, uid, depreciation_date, context=context)
company_currency = line.asset_id.company_id.currency_id.id
current_currency = line.asset_id.currency_id.id

View File

@ -57,6 +57,7 @@ class account_invoice_line(osv.osv):
'partner_id': line.invoice_id.partner_id.id,
'company_id': line.invoice_id.company_id.id,
'currency_id': line.invoice_id.currency_id.id,
'purchase_date' : line.invoice_id.date_invoice,
}
changed_vals = asset_obj.onchange_category_id(cr, uid, [], vals['category_id'], context=context)
vals.update(changed_vals['value'])

View File

@ -129,7 +129,7 @@
</group>
</page>
<page string="Depreciation Board">
<field name="depreciation_line_ids" mode="tree,graph">
<field name="depreciation_line_ids" mode="tree">
<tree string="Depreciation Lines" colors="blue:(move_check == False);black:(move_check == True)">
<field name="depreciation_date"/>
<field name="sequence" invisible="1"/>
@ -159,11 +159,6 @@
</group>
</group>
</form>
<graph type="bar">
<field name="name"/>
<field name="amount"/>
<field name="depreciated_value"/>
</graph>
</field>
<button type="object" name="compute_depreciation_board" string="Compute" icon="terp-stock_format-scientific" colspan="2" attrs="{'invisible':[('state','=','close')]}"/>
</page>

View File

@ -50,7 +50,7 @@ class asset_asset_report(osv.osv):
select
min(dl.id) as id,
dl.name as name,
to_date(dl.depreciation_date, 'YYYY-MM-DD') as depreciation_date,
dl.depreciation_date as depreciation_date,
a.purchase_date as purchase_date,
(CASE WHEN (select min(d.id) from account_asset_depreciation_line as d
left join account_asset_asset as ac ON (ac.id=d.asset_id)
@ -77,7 +77,7 @@ class asset_asset_report(osv.osv):
from account_asset_depreciation_line dl
left join account_asset_asset a on (dl.asset_id=a.id)
group by
dl.amount,dl.asset_id,to_date(dl.depreciation_date, 'YYYY-MM-DD'),dl.name,
dl.amount,dl.asset_id,dl.depreciation_date,dl.name,
a.purchase_date, dl.move_check, a.state, a.category_id, a.partner_id, a.company_id,
a.purchase_value, a.id, a.salvage_value
)""")

View File

@ -76,7 +76,7 @@
<field name="ref" readonly="1"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
<field name="type" on_change="onchange_type(partner_id, type)"/>
<field name="account_id" domain="[('journal_id','=',parent.journal_id)]"/>
<field name="account_id" domain="[('journal_id','=',journal_id)]"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/>
<field name="amount" readonly="1" sum="Total Amount"/>
<field name="globalisation_id" string="Glob. Id"/>
@ -100,7 +100,7 @@
<field name="ref" readonly="0"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
<field name="type" on_change="onchange_type(partner_id, type)"/>
<field domain="[('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id"/>
<field domain="[('journal_id', '=', journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/>
<field name="amount"/>
<field name="globalisation_id"/>

View File

@ -69,6 +69,5 @@ Three reports are available:
],
'installable': True,
'auto_install': False,
'certificate': '0043819694157',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -62,12 +62,7 @@
<field name="account_ids"/>
</page>
<page string="Budget Lines">
<field name="crossovered_budget_line" widget="one2many_list" mode="graph,tree">
<graph type="bar" string="Lines">
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
<field name="planned_amount" operator="+"/>
<field group="True" name="general_budget_id"/>
</graph>
<field name="crossovered_budget_line" widget="one2many_list" mode="tree">
<tree string="Budget Lines" editable="top">
<field name="crossovered_budget_id"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('parent_id','!=',False)]"/>
@ -299,7 +294,7 @@
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Budget Lines">
<page string="Budget Lines" groups="account.group_account_user">
<field name="crossovered_budget_line" widget="one2many_list" colspan="4" nolabel="1" mode="tree,graph">
<tree string="Budget Lines" editable="top">
<field name="crossovered_budget_id"/>

View File

@ -35,7 +35,9 @@ class analytic_account_budget_report(report_sxw.rml_parse):
})
self.context = context
def funct(self, object, form, ids={}, done=None, level=1):
def funct(self, object, form, ids=None, done=None, level=1):
if ids is None:
ids = {}
if not ids:
ids = self.ids
if not done:

View File

@ -34,7 +34,9 @@ class budget_report(report_sxw.rml_parse):
})
self.context = context
def funct(self, object, form, ids={}, done=None, level=1):
def funct(self, object, form, ids=None, done=None, level=1):
if ids is None:
ids = {}
if not ids:
ids = self.ids
if not done:

View File

@ -37,7 +37,9 @@ class budget_report(report_sxw.rml_parse):
})
self.context = context
def funct(self, object, form, ids={}, done=None, level=1):
def funct(self, object, form, ids=None, done=None, level=1):
if ids is None:
ids = {}
if not ids:
ids = self.ids
if not done:

View File

@ -23,5 +23,9 @@
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record model="res.users" id="base.user_root">
<field eval="[(4,ref('analytic.group_analytic_accounting'))]" name="groups_id"/>
</record>
</data>
</openerp>

View File

@ -4,4 +4,4 @@ access_account_budget_post,account.budget.post,model_account_budget_post,account
access_account_budget_post_accountant,account.budget.post accountant,model_account_budget_post,account.group_account_user,1,1,1,1
access_crossovered_budget_accountant,crossovered.budget accountant,model_crossovered_budget,account.group_account_user,1,1,1,1
access_crossovered_budget_lines_accountant,crossovered.budget.lines accountant,model_crossovered_budget_lines,account.group_account_user,1,1,1,1
access_budget,crossovered.budget.lines manager,model_crossovered_budget_lines,base.group_user,1,0,0,0
access_budget,crossovered.budget.lines manager,model_crossovered_budget_lines,base.group_user,1,1,1,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
4 access_account_budget_post_accountant account.budget.post accountant model_account_budget_post account.group_account_user 1 1 1 1
5 access_crossovered_budget_accountant crossovered.budget accountant model_crossovered_budget account.group_account_user 1 1 1 1
6 access_crossovered_budget_lines_accountant crossovered.budget.lines accountant model_crossovered_budget_lines account.group_account_user 1 1 1 1
7 access_budget crossovered.budget.lines manager model_crossovered_budget_lines base.group_user 1 0 1 0 1 0

View File

@ -38,9 +38,6 @@ If set to true it allows user to cancel entries & invoices.
'demo': [],
'installable': True,
'auto_install': False,
'certificate': '001101250473177981989',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -36,6 +36,5 @@ Deactivates minimal chart of accounts.
'data': [],
'demo': [],
'installable': True,
'certificate': '0073332443901',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-09-12 04:36+0000\n"
"X-Generator: Launchpad (build 15930)\n"
"X-Launchpad-Export-Date: 2012-09-13 04:39+0000\n"
"X-Generator: Launchpad (build 15944)\n"
#. module: account_check_writing
#: selection:res.company,check_layout:0

File diff suppressed because it is too large Load Diff

View File

@ -64,7 +64,6 @@ Note that if you want to check the follow-up level for a given partner/account e
],
'installable': True,
'auto_install': False,
'certificate': '0072481076453',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -65,6 +65,5 @@ have a new option to import payment orders as bank statement lines.
],
'installable': True,
'auto_install': False,
'certificate': '0061703998541',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -26,7 +26,7 @@ from tools.translate import _
class account_move_line(osv.osv):
_inherit = "account.move.line"
def amount_to_pay(self, cr, uid, ids, name, arg={}, context=None):
def amount_to_pay(self, cr, uid, ids, name, arg=None, context=None):
""" Return the amount still to pay regarding all the payemnt orders
(excepting cancelled orders)"""
if not ids:

View File

@ -139,7 +139,9 @@ class payment_order(osv.osv):
wf_service.trg_validate(uid, 'payment.order', ids[0], 'done', cr)
return True
def copy(self, cr, uid, id, default={}, context=None):
def copy(self, cr, uid, id, default=None, context=None):
if default is None:
default = {}
default.update({
'state': 'draft',
'line_ids': [],

View File

@ -88,7 +88,7 @@ class payment_order_create(osv.osv_memory):
'partner_id': line.partner_id and line.partner_id.id or False,
'communication': line.ref or '/',
'date': date_to_pay,
'currency': line.invoice and line.invoice.currency_id.id or False,
'currency': (line.invoice and line.invoice.currency_id.id) or line.journal_id.currency.id or line.journal_id.company_id.currency_id.id,
}, context=context)
return {'type': 'ir.actions.act_window_close'}

View File

@ -49,7 +49,6 @@ You can customize the following attributes of the sequence:
'demo': [],
'installable': True,
'auto_install': False,
'certificate': '00475376442024623469',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,214 @@
# Greek translation for openobject-addons
# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012
# This file is distributed under the same license as the openobject-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2012-02-08 00:35+0000\n"
"PO-Revision-Date: 2012-09-15 17:55+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Greek <el@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-09-16 04:39+0000\n"
"X-Generator: Launchpad (build 15944)\n"
#. module: account_sequence
#: view:account.sequence.installer:0
#: model:ir.actions.act_window,name:account_sequence.action_account_seq_installer
msgid "Account Sequence Application Configuration"
msgstr ""
#. module: account_sequence
#: constraint:account.move:0
msgid ""
"You can not create more than one move per period on centralized journal"
msgstr ""
#. module: account_sequence
#: constraint:account.move.line:0
msgid "Company must be the same for its related account and period."
msgstr ""
"Η εταιρία πρέπει να είναι ίδια για τους σχετικούς λογαριασμούς και περίοδο"
#. module: account_sequence
#: help:account.move,internal_sequence_number:0
#: help:account.move.line,internal_sequence_number:0
msgid "Internal Sequence Number"
msgstr ""
#. module: account_sequence
#: help:account.sequence.installer,number_next:0
msgid "Next number of this sequence"
msgstr "Επόμενος αριθμός αυτής της ακολουθίας"
#. module: account_sequence
#: field:account.sequence.installer,number_next:0
msgid "Next Number"
msgstr "Επόμενος Αριθμός"
#. module: account_sequence
#: field:account.sequence.installer,number_increment:0
msgid "Increment Number"
msgstr "Αριθμός Προσαύξησης"
#. module: account_sequence
#: help:account.sequence.installer,number_increment:0
msgid "The next number of the sequence will be incremented by this number"
msgstr ""
#. module: account_sequence
#: view:account.sequence.installer:0
msgid "Configure Your Account Sequence Application"
msgstr ""
#. module: account_sequence
#: view:account.sequence.installer:0
msgid "Configure"
msgstr ""
#. module: account_sequence
#: help:account.sequence.installer,suffix:0
msgid "Suffix value of the record for the sequence"
msgstr ""
#. module: account_sequence
#: field:account.sequence.installer,company_id:0
msgid "Company"
msgstr ""
#. module: account_sequence
#: help:account.journal,internal_sequence_id:0
msgid ""
"This sequence will be used to maintain the internal number for the journal "
"entries related to this journal."
msgstr ""
#. module: account_sequence
#: field:account.sequence.installer,padding:0
msgid "Number padding"
msgstr ""
#. module: account_sequence
#: model:ir.model,name:account_sequence.model_account_move_line
msgid "Journal Items"
msgstr ""
#. module: account_sequence
#: field:account.move,internal_sequence_number:0
#: field:account.move.line,internal_sequence_number:0
msgid "Internal Number"
msgstr ""
#. module: account_sequence
#: constraint:account.move.line:0
msgid "You can not create journal items on an account of type view."
msgstr ""
#. module: account_sequence
#: help:account.sequence.installer,padding:0
msgid ""
"OpenERP will automatically adds some '0' on the left of the 'Next Number' to "
"get the required padding size."
msgstr ""
#. module: account_sequence
#: field:account.sequence.installer,name:0
msgid "Name"
msgstr ""
#. module: account_sequence
#: constraint:account.move.line:0
msgid "You can not create journal items on closed account."
msgstr ""
#. module: account_sequence
#: constraint:account.journal:0
msgid ""
"Configuration error! The currency chosen should be shared by the default "
"accounts too."
msgstr ""
#. module: account_sequence
#: sql_constraint:account.move.line:0
msgid "Wrong credit or debit value in accounting entry !"
msgstr ""
#. module: account_sequence
#: field:account.journal,internal_sequence_id:0
msgid "Internal Sequence"
msgstr ""
#. module: account_sequence
#: help:account.sequence.installer,prefix:0
msgid "Prefix value of the record for the sequence"
msgstr ""
#. module: account_sequence
#: model:ir.model,name:account_sequence.model_account_move
msgid "Account Entry"
msgstr ""
#. module: account_sequence
#: field:account.sequence.installer,suffix:0
msgid "Suffix"
msgstr ""
#. module: account_sequence
#: field:account.sequence.installer,config_logo:0
msgid "Image"
msgstr ""
#. module: account_sequence
#: view:account.sequence.installer:0
msgid "title"
msgstr ""
#. module: account_sequence
#: sql_constraint:account.journal:0
msgid "The name of the journal must be unique per company !"
msgstr ""
#. module: account_sequence
#: constraint:account.move.line:0
msgid ""
"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."
msgstr ""
#. module: account_sequence
#: constraint:account.move.line:0
msgid ""
"The date of your Journal Entry is not in the defined period! You should "
"change the date or remove this constraint from the journal."
msgstr ""
#. module: account_sequence
#: field:account.sequence.installer,prefix:0
msgid "Prefix"
msgstr ""
#. module: account_sequence
#: sql_constraint:account.journal:0
msgid "The code of the journal must be unique per company !"
msgstr ""
#. module: account_sequence
#: model:ir.model,name:account_sequence.model_account_sequence_installer
msgid "account.sequence.installer"
msgstr ""
#. module: account_sequence
#: model:ir.model,name:account_sequence.model_account_journal
msgid "Journal"
msgstr ""
#. module: account_sequence
#: view:account.sequence.installer:0
msgid "You can enhance the Account Sequence Application by installing ."
msgstr ""

View File

@ -25,13 +25,19 @@
'author' : 'OpenERP SA',
'summary': 'Send Invoices and Track Payments',
'description': """
eInvoicing & Payments module manage all Voucher Entries such as 'Reconciliation Entries', 'Adjustment Entries', 'Closing or Opening Entries' for Sales, Purchase, Bank, Cash, Expense, Contra.
==============================================================================================================================================================================================
Invoicing & Payments by Accounting Voucher & Receipts
======================================================
The specific and easy-to-use Invoicing system in OpenERP allows you to keep track of your accounting, even when you are not an accountant. It provides an easy way to follow up on your suppliers and customers.
You could use this simplified accounting in case you work with an (external) account to keep your books, and you still want to keep track of payments.
The Invoicing system includes receipts and vouchers (an easy way to keep track of sales and purchases). It also offers you an easy method of registering payments, without having to encode complete abstracts of account.
This module manages:
* Voucher Entry
* Voucher Receipt [Sales & Purchase]
* Voucher Payment [Customer & Supplier]
* Cheque Register
""",
'category': 'Accounting & Finance',
'sequence': 4,
@ -66,7 +72,6 @@ eInvoicing & Payments module manage all Voucher Entries such as 'Reconciliation
'test/case4_cad_chf.yml',
'test/case_eur_usd.yml',
],
'certificate': '0037580727101',
'auto_install': False,
'application': True,
'installable': True,

View File

@ -32,11 +32,11 @@ class res_company(osv.osv):
_columns = {
'income_currency_exchange_account_id': fields.many2one(
'account.account',
string="Income Currency Rate",
string="Gain Exchange Rate Account",
domain="[('type', '=', 'other')]",),
'expense_currency_exchange_account_id': fields.many2one(
'account.account',
string="Expense Currency Rate",
string="Loss Exchange Rate Account",
domain="[('type', '=', 'other')]",),
}
@ -782,9 +782,16 @@ class account_voucher(osv.osv):
vals[key].update(res[key])
return vals
def button_proforma_voucher(self, cr, uid, ids, context=None):
context = context or {}
wf_service = netsvc.LocalService("workflow")
for vid in ids:
wf_service.trg_validate(uid, 'account.voucher', vid, 'proforma_voucher', cr)
return {'type': 'ir.actions.act_window_close'}
def proforma_voucher(self, cr, uid, ids, context=None):
self.action_move_line_create(cr, uid, ids, context=context)
return {'type': 'ir.actions.act_window_close'}
return True
def action_cancel_draft(self, cr, uid, ids, context=None):
wf_service = netsvc.LocalService("workflow")
@ -950,11 +957,11 @@ class account_voucher(osv.osv):
if amount_residual > 0:
account_id = line.voucher_id.company_id.expense_currency_exchange_account_id
if not account_id:
raise osv.except_osv(_('Warning!'),_("First you have to configure the 'Income Currency Rate' on the company, then create accounting entry for currency rate difference."))
raise osv.except_osv(_('Warning!'),_("First you have to configure the 'Expense Currency Rate' on the company, then create accounting entry for currency rate difference."))
else:
account_id = line.voucher_id.company_id.income_currency_exchange_account_id
if not account_id:
raise osv.except_osv(_('Warning!'),_("First you have to configure the 'Expense Currency Rate' on the company, then create accounting entry for currency rate difference."))
raise osv.except_osv(_('Warning!'),_("First you have to configure the 'Income Currency Rate' on the company, then create accounting entry for currency rate difference."))
# Even if the amount_currency is never filled, we need to pass the foreign currency because otherwise
# the receivable/payable account may have a secondary currency, which render this field mandatory
account_currency_id = company_currency <> current_currency and current_currency or False
@ -1045,6 +1052,8 @@ class account_voucher(osv.osv):
# if the amount encoded in voucher is equal to the amount unreconciled, we need to compute the
# currency rate difference
if line.amount == line.amount_unreconciled:
if not line.move_line_id.amount_residual:
raise osv.except_osv(_('Wrong bank statement line'),_("You have to delete the bank statement line which the payment was reconciled to manually. Please check the payment of the partner %s by the amount of %s.")%(line.voucher_id.partner_id.name, line.voucher_id.amount))
currency_rate_difference = line.move_line_id.amount_residual - amount
else:
currency_rate_difference = 0.0
@ -1266,7 +1275,9 @@ class account_voucher(osv.osv):
self.reconcile_send_note(cr, uid, [voucher.id], context=context)
return True
def copy(self, cr, uid, id, default={}, context=None):
def copy(self, cr, uid, id, default=None, context=None):
if default is None:
default = {}
default.update({
'state': 'draft',
'number': False,
@ -1293,17 +1304,17 @@ class account_voucher(osv.osv):
def create_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
message = "%s <b>created</b>." % self._document_type[obj.type or False]
self.message_post(cr, uid, [obj.id], body=message, context=context)
self.message_post(cr, uid, [obj.id], body=message, subtype="account_voucher.mt_voucher", context=context)
def post_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
message = "%s '%s' is <b>posted</b>." % (self._document_type[obj.type or False], obj.move_id.name)
self.message_post(cr, uid, [obj.id], body=message, context=context)
self.message_post(cr, uid, [obj.id], body=message, subtype="account_voucher.mt_voucher", context=context)
def reconcile_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
message = "%s <b>reconciled</b>." % self._document_type[obj.type or False]
self.message_post(cr, uid, [obj.id], body=message, context=context)
self.message_post(cr, uid, [obj.id], body=message, subtype="account_voucher.mt_voucher", context=context)
account_voucher()

View File

@ -1,17 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data noupdate="1">
<!-- notify all employees of module installation -->
<record model="mail.message" id="module_install_notification">
<field name="model">mail.group</field>
<field name="res_id" ref="mail.group_all_employees"/>
<field name="type">notification</field>
<field name="subject">eInvoicing &amp; Payments application installed!</field>
<field name="body">OpenERP's electronic invoicing accelerates the creation of invoices and collection of customer payments. Invoices are created in a few clicks and your customers receive them by email. They can pay online and/or import them in their own system.
<field name="body"><![CDATA[
OpenERP's electronic invoicing accelerates the creation of invoices and collection of customer payments. Invoices are created in a few clicks and your customers receive them by email. They can pay online and/or import them in their own system.
You can track customer payments easily and automate follow-ups. You get an overview of the discussion with your customers on each invoice for easier traceability.
For advanced accounting features, you should install the "Accounting and Finance" module.</field>
<p>You can track customer payments easily and automate follow-ups. You get an overview of the discussion with your customers on each invoice for easier traceability. For advanced accounting features, you should install the "Accounting and Finance" module.</p>
]]></field>
</record>
<!-- mail: subtypes -->
<record id="mt_voucher" model="mail.message.subtype">
<field name="name">Status Change</field>
<field name="res_model">account.voucher</field>
</record>
</data>
</openerp>

View File

@ -47,16 +47,18 @@
<field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/>
</header>
<sheet string="Accounting Voucher">
<group col="6" colspan="4">
<group col="4" colspan="4">
<field name="partner_id" required="1" on_change="onchange_journal_voucher(line_ids, tax_id, amount, partner_id, journal_id, type)"/>
<field name="payment_rate_currency_id" invisible="1"/>
<field name="date" on_change="onchange_date(date, currency_id, payment_rate_currency_id, amount, company_id)"/>
<field name="journal_id" widget="selection" on_change="onchange_journal_voucher(line_ids, tax_id, amount, partner_id, journal_id, type)"/>
<field name="type" required="1"/>
<field name="name" colspan="2"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="reference"/>
<field name="number"/>
<field name="currency_id" groups="base.group_multi_currency"/>
<field name="account_id" widget="selection" invisible="True"/>
<field name="payment_rate_currency_id" invisible="1"/>
</group>
<notebook colspan="4">
<page string="Voucher Entry">
@ -69,20 +71,16 @@
<field name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
</tree>
</field>
<group col="3">
<group string="Internal Notes">
<field name="narration" colspan="2" nolabel="1"/>
</group>
<group string="Other Information">
<field name="number"/>
<field name="currency_id" groups="base.group_multi_currency"/>
</group>
<group col="4" attrs="{'invisible':[('type','in',['payment', 'receipt', False])]}">
<separator string="Total" colspan="4"/>
<field name="tax_id" on_change="onchange_price(line_ids, tax_id, partner_id)" widget="selection"/>
<group>
<field name="narration" nolabel="1" placeholder="Internal Notes"/>
<group class="oe_subtotal_footer oe_right" attrs="{'invisible':[('type','in',['payment', 'receipt', False])]}">
<field name="tax_id" on_change="onchange_price(line_ids, tax_id, partner_id)" widget="selection" nolabel="1"/>
<field name="tax_amount" nolabel="1"/>
<button type="object" icon="terp-stock_format-scientific" name="compute_tax" string="Compute Tax" attrs="{'invisible': [('state','!=','draft')]}"/>
<label colspan="1" string=""/><field name="amount" string="Total"/>
<div class="oe_subtotal_footer_separator">
<label for="amount"/>
<button type="object" icon="terp-stock_format-scientific" name="compute_tax" class="oe_link oe_edit_only" string="(Update)" attrs="{'invisible': [('state','!=','draft')]}"/>
</div>
<field name="amount" class="oe_subtotal_footer_separator" nolabel="1"/>
</group>
</group>
</page>
@ -272,10 +270,9 @@
<field name="tag">reload</field>
<field name="params" eval="{'menu_id': ref('account.menu_finance')}"/>
</record>
<record id="todo_open_invoice_menu" model="ir.actions.todo">
<record id="base.open_menu" model="ir.actions.todo">
<field name="action_id" ref="action_client_invoice_menu"/>
<field name="type">automatic</field>
<field name="sequence">100</field>
<field name="state">open</field>
</record>
</data>

View File

@ -27,11 +27,12 @@ class invoice(osv.osv):
def invoice_pay_customer(self, cr, uid, ids, context=None):
if not ids: return []
mod,modid = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_dialog_form')
inv = self.browse(cr, uid, ids[0], context=context)
return {
'name':_("Pay Invoice"),
'view_mode': 'form',
'view_id': False,
'view_id': modid,
'view_type': 'form',
'res_model': 'account.voucher',
'type': 'ir.actions.act_window',
@ -41,7 +42,7 @@ class invoice(osv.osv):
'context': {
'default_partner_id': inv.partner_id.id,
'default_amount': inv.type in ('out_refund', 'in_refund') and -inv.residual or inv.residual,
'default_name':inv.name,
'default_number':inv.name,
'close_after_process': True,
'invoice_type': inv.type,
'invoice_id': inv.id,

View File

@ -71,6 +71,7 @@
</group>
<notebook>
<page string="Payment Information">
<label for="line_dr_ids" attrs="{'invisible': [('type', '=', 'receipt')]}"/>
<field name="line_dr_ids" attrs="{'invisible': [('type', '=', 'receipt')]}" context="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="140" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)">
<tree string="Open Supplier Journal Entries" editable="bottom" colors="gray:amount==0">
<field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
@ -84,6 +85,7 @@
<field name="amount" sum="Total Allocation"/>
</tree>
</field>
<label for="line_cr_ids" attrs="{'invisible': [('type', '=', 'payment')]}"/>
<field name="line_cr_ids" attrs="{'invisible': [('type', '=', 'payment')]}" context="{'journal_id':journal_id, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)">
<tree string="Open Customer Journal Entries" editable="bottom" colors="gray:amount==0">
<field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
@ -155,6 +157,7 @@
</group>
<notebook>
<page string="Payment Information">
<label for="line_dr_ids"/>
<field name="line_dr_ids" context="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}">
<tree string="Supplier Invoices and Outstanding transactions" editable="bottom" colors="gray:amount==0">
<field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
@ -170,6 +173,7 @@
<field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)"/>
</tree>
</field>
<label for="line_cr_ids" attrs="{'invisible': [('pre_line','=',False)]}"/>
<field name="line_cr_ids" attrs="{'invisible': [('pre_line','=',False)]}" context="{'journal_id':journal_id, 'partner_id':partner_id}">
<tree string="Credits" editable="bottom" colors="gray:amount==0">
<field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
@ -280,6 +284,111 @@
<menuitem action="action_vendor_payment" icon="STOCK_JUSTIFY_FILL" sequence="12"
id="menu_action_vendor_payment" parent="account.menu_finance_payables"/>
<record model="ir.ui.view" id="view_vendor_receipt_dialog_form">
<field name="name">account.voucher.receipt.dialog.form</field>
<field name="model">account.voucher</field>
<field name="priority">30</field>
<field name="arch" type="xml">
<form string="Payment" version="7.0">
<group>
<group>
<field name="state" invisible="1"/>
<field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Customer" context="{'search_default_customer': 1}"/>
<label for="amount" string="Paid Amount"/>
<div>
<field name="amount" class="oe_inline"
invisible="context.get('line_type', False)"
on_change="onchange_amount(amount, payment_rate, partner_id, journal_id, currency_id, type, date, payment_rate_currency_id, company_id, context)"/>
<field name="currency_id" class="oe_inline"/>
</div>
<field name="journal_id"
domain="[('type','in',['bank', 'cash'])]"
invisible="context.get('line_type', False)"
widget="selection"
on_change="onchange_journal(journal_id, line_cr_ids, False, partner_id, date, amount, type, company_id, context)"
string="Payment Method"/>
</group>
<group>
<field name="date" invisible="context.get('line_type', False)" on_change="onchange_date(date, currency_id, payment_rate_currency_id, amount, company_id, context)"/>
<field name="reference" invisible="context.get('line_type', False)" string="Payment Ref" placeholder="e.g. 003/10"/>
<field name="name" colspan="2" invisible="context.get('line_type', False)" placeholder="e.g. Invoice SAJ/0042"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="account_id"
widget="selection"
invisible="True"/>
<field name="pre_line" invisible="1"/>
<field name="type" invisible="True"/>
</group>
</group>
<notebook invisible="1">
<page string="Payment Information" groups="base.group_user">
<label for="line_cr_ids"/>
<field name="line_cr_ids" context="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)">
<tree string="Invoices and outstanding transactions" editable="bottom" colors="gray:amount==0">
<field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
on_change="onchange_move_line_id(move_line_id)"
domain="[('account_id.type','in',('receivable','payable')), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
required="1"
groups="account.group_account_user"/>
<field name="account_id" groups="base.group_no_one" domain="[('type','=','receivable')]"/>
<field name="date_original" readonly="1"/>
<field name="date_due" readonly="1"/>
<field name="amount_original" readonly="1"/>
<field name="amount_unreconciled" readonly="1" groups="account.group_account_user"/>
<field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)" groups="account.group_account_user"/>
<field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)" string="Allocation"/>
</tree>
</field>
<label for="line_dr_ids" attrs="{'invisible': [('pre_line','=',False)]}"/>
<field name="line_dr_ids" attrs="{'invisible': [('pre_line','=',False)]}" context="{'journal_id':journal_id, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)">
<tree string="Credits" editable="bottom" colors="gray:amount==0">
<field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
on_change="onchange_move_line_id(move_line_id)"
domain="[('account_id.type','in',('receivable','payable')), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
required="1"/>
<field name="account_id" groups="base.group_no_one" domain="[('type','=','receivable')]"/>
<field name="date_original" readonly="1"/>
<field name="date_due" readonly="1"/>
<field name="amount_original" readonly="1"/>
<field name="amount_unreconciled" readonly="1"/>
<field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)"/>
<field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)" string="Allocation"/>
</tree>
</field>
<group col="3">
<group>
<field name="narration" colspan="2" nolabel="1"/>
</group>
<group col="4" attrs="{'invisible':[('currency_id','=',False),('is_multi_currency','=',False)]}">
<field name="is_multi_currency" invisible="1"/>
<field name="payment_rate" required="1" on_change="onchange_rate(payment_rate, amount, currency_id, payment_rate_currency_id, company_id, context)" colspan="3"/>
<field name="payment_rate_currency_id" colspan="1" nolabel="1" on_change="onchange_payment_rate_currency(currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context)" groups="base.group_multi_currency"/>
<field name="paid_amount_in_company_currency" colspan="4" invisible="1"/>
</group>
<group>
<field name="writeoff_amount"/>
<field name="payment_option" required="1"/>
<field name="writeoff_acc_id"
attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"
domain="[('type','=','other')]"/>
<field name="comment"
attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
<field name="analytic_id"
groups="analytic.group_analytic_accounting"/>
</group>
</group>
</page>
</notebook>
<footer>
<button name="button_proforma_voucher" string="Pay" class="oe_highlight" type="object"/> or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_vendor_receipt_form">
<field name="name">account.voucher.receipt.form</field>
<field name="model">account.voucher</field>
@ -293,7 +402,7 @@
<field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/>
</header>
<sheet>
<h1><field name="number"/></h1>
<h1 attrs="{'invisible': [('number','=',False)]}"><field name="number"/></h1>
<group>
<group>
<field name="partner_id" domain="[('customer','=',True)]" required="1" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Customer" context="{'search_default_customer': 1}"/>
@ -325,9 +434,9 @@
<field name="type" invisible="True"/>
</group>
</group>
<notebook>
<page string="Payment Information" groups="base.group_user">
<label for="line_cr_ids"/>
<field name="line_cr_ids" context="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)">
<tree string="Invoices and outstanding transactions" editable="bottom" colors="gray:amount==0">
<field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
@ -344,6 +453,7 @@
<field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)" string="Allocation"/>
</tree>
</field>
<label for="line_dr_ids" attrs="{'invisible': [('pre_line','=',False)]}"/>
<field name="line_dr_ids" attrs="{'invisible': [('pre_line','=',False)]}" context="{'journal_id':journal_id, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)">
<tree string="Credits" editable="bottom" colors="gray:amount==0">
<field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"

View File

@ -38,11 +38,11 @@ that have no counterpart in the general financial accounts.
'security/analytic_security.xml',
'security/ir.model.access.csv',
'analytic_sequence.xml',
'analytic_view.xml'
'analytic_view.xml',
'analytic_data.xml'
],
'demo': [],
'installable': True,
'auto_install': False,
'certificate' : '00462253285027988541',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -96,22 +96,6 @@ class account_analytic_account(osv.osv):
res[row['id']][field] = row[field]
return self._compute_level_tree(cr, uid, ids, child_ids, res, fields, context)
def name_get(self, cr, uid, ids, context=None):
if isinstance(ids, (int, long)):
ids=[ids]
if not ids:
return []
res = []
for account in self.browse(cr, uid, ids, context=context):
data = []
acc = account
while acc:
data.insert(0, acc.name)
acc = acc.parent_id
data = ' / '.join(data)
res.append((account.id, data))
return res
def _complete_name_calc(self, cr, uid, ids, prop, unknow_none, unknow_dict):
res = self.name_get(cr, uid, ids)
return dict(res)
@ -238,8 +222,11 @@ class account_analytic_account(osv.osv):
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
default['code'] = False
default['line_ids'] = []
analytic = self.browse(cr, uid, id, context=context)
default.update(
code=False,
line_ids=[],
name=_("%s (copy)") % (analytic['name']))
return super(account_analytic_account, self).copy(cr, uid, id, default, context=context)
def on_change_company(self, cr, uid, id, company_id):
@ -297,7 +284,8 @@ class account_analytic_account(osv.osv):
def create_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_post(cr, uid, [obj.id], body=_("Contract for <em>%s</em> has been <b>created</b>.") % (obj.partner_id.name), context=context)
self.message_post(cr, uid, [obj.id], body=_("Contract for <em>%s</em> has been <b>created</b>.") % (obj.partner_id.name),
subtype="analytic.mt_account_status", context=context)
account_analytic_account()

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<!-- mail: subtypes -->
<record id="mt_account_status" model="mail.message.subtype">
<field name="name">Status Change</field>
<field name="res_model">account.analytic.account</field>
</record>
</data>
</openerp>

View File

@ -41,6 +41,7 @@
units is reached, the account manager
is warned by email to renew the contract.
</p>
<field name="date_start"/>
<label for="date" string="End Date"/>
<div name="duration">
<field name="date" class="oe_inline"/>

View File

@ -45,6 +45,5 @@ compatible with older configurations.
'demo': [],
'installable': True,
'auto_install': False,
'certificate': '0082277138269',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,63 +1,86 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * analytic_user_function
# Dutch (Belgium) translation for openobject-addons
# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012
# This file is distributed under the same license as the openobject-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 6.0dev\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 15:34:14+0000\n"
"PO-Revision-Date: 2009-08-28 15:34:14+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2012-02-08 00:35+0000\n"
"PO-Revision-Date: 2012-10-02 07:35+0000\n"
"Last-Translator: Els Van Vossel (Agaplan) <Unknown>\n"
"Language-Team: Dutch (Belgium) <nl_BE@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-10-03 05:09+0000\n"
"X-Generator: Launchpad (build 16061)\n"
#. module: analytic_user_function
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr ""
#: field:analytic.user.funct.grid,product_id:0
msgid "Product"
msgstr "Product"
#. module: analytic_user_function
#: model:ir.model,name:analytic_user_function.model_analytic_user_funct_grid
msgid "Relation table between users and products on a analytic account"
msgstr ""
"Relatietabel tussen gebruikers en producten van een analytische rekening"
#. module: analytic_user_function
#: field:analytic_user_funct_grid,product_id:0
msgid "Product"
msgstr ""
#: constraint:hr.analytic.timesheet:0
msgid "You cannot modify an entry in a Confirmed/Done timesheet !."
msgstr "In een bevestigde/afgesloten uurrooster kunt u geen regels wijzigen."
#. module: analytic_user_function
#: field:analytic_user_funct_grid,account_id:0
#: field:analytic.user.funct.grid,account_id:0
#: model:ir.model,name:analytic_user_function.model_account_analytic_account
msgid "Analytic Account"
msgstr ""
msgstr "Analytische rekening"
#. module: analytic_user_function
#: view:account.analytic.account:0
#: field:account.analytic.account,user_product_ids:0
msgid "Users/Products Rel."
msgstr ""
msgstr "Rel. gebruikers/producten"
#. module: analytic_user_function
#: field:analytic_user_funct_grid,user_id:0
#: field:analytic.user.funct.grid,user_id:0
msgid "User"
msgstr "Gebruiker"
#. module: analytic_user_function
#: code:addons/analytic_user_function/analytic_user_function.py:96
#: code:addons/analytic_user_function/analytic_user_function.py:131
#, python-format
msgid "There is no expense account define for this product: \"%s\" (id:%d)"
msgstr ""
"Er is geen kostenrekening gedefinieerd voor dit product: \"%s\" (id:%d)"
#. module: analytic_user_function
#: constraint:ir.model:0
msgid "The Object name must start with x_ and not contain any special character !"
msgstr "De objectnaam moet beginnen met x_ en mag geen speciale karakters bevatten !"
#: code:addons/analytic_user_function/analytic_user_function.py:95
#: code:addons/analytic_user_function/analytic_user_function.py:130
#, python-format
msgid "Error !"
msgstr "Fout"
#. module: analytic_user_function
#: model:ir.module.module,shortdesc:analytic_user_function.module_meta_information
msgid "Analytic User Function"
msgstr ""
#: constraint:account.analytic.account:0
msgid "Error! You can not create recursive analytic accounts."
msgstr "U kunt niet dezelfde analytische rekeningen maken."
#. module: analytic_user_function
#: view:analytic_user_funct_grid:0
#: model:ir.model,name:analytic_user_function.model_hr_analytic_timesheet
msgid "Timesheet Line"
msgstr "Uurroosterlijn"
#. module: analytic_user_function
#: view:analytic.user.funct.grid:0
msgid "User's Product for this Analytic Account"
msgstr ""
msgstr "Product van gebruiker voor deze analytische rekening"
#~ msgid ""
#~ "The Object name must start with x_ and not contain any special character !"
#~ msgstr ""
#~ "De objectnaam moet beginnen met x_ en mag geen speciale karakters bevatten !"

View File

@ -48,7 +48,6 @@ anonymization process to recover your previous data.
],
'installable': True,
'auto_install': False,
'certificate': '00719010980872226045',
'images': ['images/anonymization1.jpeg','images/anonymization2.jpeg','images/anonymization3.jpeg'],
}

View File

@ -64,11 +64,15 @@ class ir_model_fields_anonymization(osv.osv):
state = 'anonymized' # all fields are anonymized
else:
state = 'unstable' # fields are mixed: this should be fixed
return state
def _check_write(self, cr, uid, context=None):
# check that the field is created from the menu and not from an database update
# otherwise the database update can crash:
"""check that the field is created from the menu and not from an database update
otherwise the database update can crash:"""
if context is None:
context = {}
if context.get('manual'):
global_state = self._get_global_state(cr, uid, context=context)
if global_state == 'anonymized':
@ -100,12 +104,16 @@ class ir_model_fields_anonymization(osv.osv):
# check field state: all should be clear before we can add a new field to anonymize:
self._check_write(cr, uid, context=context)
global_state = self._get_global_state(cr, uid, context=context)
if 'field_name' in vals and vals['field_name'] and 'model_name' in vals and vals['model_name']:
vals['model_id'], vals['field_id'] = self._get_model_and_field_ids(cr, uid, vals, context=context)
# check not existing fields:
if not vals.get('field_id'):
vals['state'] = 'not_existing'
else:
vals['state'] = global_state
res = super(ir_model_fields_anonymization, self).create(cr, uid, vals, context=context)
@ -340,8 +348,9 @@ class ir_model_fields_anonymize_wizard(osv.osv_memory):
# remove the placeholer:
eview.remove(placeholder)
else:
# unstable ?
raise
msg = "The database anonymization is currently in an unstable state. Some fields are anonymized," + \
" while some fields are not anonymized. You should try to solve this problem before trying to do anything else."
raise osv.except_osv('Error !', msg)
res['arch'] = etree.tostring(eview)

View File

@ -37,7 +37,6 @@ membership products (schemes).
'demo': [],
'installable': True,
'auto_install': False,
'certificate': '0078696047261',
'images': ['images/association1.jpeg'],
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -42,7 +42,6 @@ and can check logs.
'demo': ['audittrail_demo.xml'],
'installable': True,
'auto_install': False,
'certificate': '0062572348749',
'images': ['images/audittrail1.jpeg','images/audittrail2.jpeg','images/audittrail3.jpeg'],
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -202,7 +202,7 @@ class audittrail_objects_proxy(object_proxy):
res = value
return res
def create_log_line(self, cr, uid, log_id, model, lines=[]):
def create_log_line(self, cr, uid, log_id, model, lines=None):
"""
Creates lines for changed fields with its old and new values
@ -211,6 +211,8 @@ class audittrail_objects_proxy(object_proxy):
@param model: Object which values are being changed
@param lines: List of values for line is to be created
"""
if lines is None:
lines = []
pool = pooler.get_pool(cr.dbname)
obj_pool = pool.get(model.model)
model_pool = pool.get('ir.model')
@ -349,7 +351,7 @@ class audittrail_objects_proxy(object_proxy):
data[(model.id, resource_id)] = {'text':values_text, 'value': values}
return data
def prepare_audittrail_log_line(self, cr, uid, pool, model, resource_id, method, old_values, new_values, field_list=[]):
def prepare_audittrail_log_line(self, cr, uid, pool, model, resource_id, method, old_values, new_values, field_list=None):
"""
This function compares the old data (i.e before the method was executed) and the new data
(after the method was executed) and returns a structure with all the needed information to
@ -378,6 +380,8 @@ class audittrail_objects_proxy(object_proxy):
The reason why the structure returned is build as above is because when modifying an existing
record, we may have to log a change done in a x2many field of that object
"""
if field_list is None:
field_list = []
key = (model.id, resource_id)
lines = {
key: []
@ -416,7 +420,7 @@ class audittrail_objects_proxy(object_proxy):
lines[key].append(data)
return lines
def process_data(self, cr, uid, pool, res_ids, model, method, old_values={}, new_values={}, field_list=[]):
def process_data(self, cr, uid, pool, res_ids, model, method, old_values=None, new_values=None, field_list=None):
"""
This function processes and iterates recursively to log the difference between the old
data (i.e before the method was executed) and the new data and creates audittrail log
@ -435,6 +439,8 @@ class audittrail_objects_proxy(object_proxy):
on specific fields only.
:return: True
"""
if field_list is None:
field_list = []
# loop on all the given ids
for res_id in res_ids:
# compare old and new values and get audittrail log lines accordingly
@ -442,11 +448,13 @@ class audittrail_objects_proxy(object_proxy):
# if at least one modification has been found
for model_id, resource_id in lines:
name = pool.get(model.model).name_get(cr, uid, [resource_id])[0][1]
vals = {
'method': method,
'object_id': model_id,
'user_id': uid,
'res_id': resource_id,
'name': name,
}
if (model_id, resource_id) not in old_values and method not in ('copy', 'read'):
# the resource was not existing so we are forcing the method to 'create'
@ -484,7 +492,7 @@ class audittrail_objects_proxy(object_proxy):
if len(rule['user_id']) == 0 or uid in rule['user_id']:
if rule.get('log_'+method,0):
return True
elif method not in ('default_get','read','fields_view_get','fields_get','search','search_count','name_search','name_get','get','request_get', 'get_sc', 'unlink', 'write', 'create'):
elif method not in ('default_get','read','fields_view_get','fields_get','search','search_count','name_search','name_get','get','request_get', 'get_sc', 'unlink', 'write', 'create', 'read_group', 'import_data'):
if rule['log_action']:
return True

View File

@ -107,7 +107,6 @@ authentication if installed at the same time.
],
'auto_install': False,
'installable': True,
'certificate' : '001141446349334700221',
'external_dependencies' : {
'python' : ['ldap'],
}

View File

@ -180,8 +180,8 @@ class CompanyLDAP(osv.osv):
"""
user_id = False
login = tools.ustr(login)
cr.execute("SELECT id, active FROM res_users WHERE login=%s", (login,))
login = tools.ustr(login.lower())
cr.execute("SELECT id, active FROM res_users WHERE lower(login)=%s", (login,))
res = cr.fetchone()
if res:
if res[1]:

View File

@ -14,7 +14,7 @@
<field name="ldap_server"/>
<field name="ldap_server_port"/>
<field name="ldap_binddn"/>
<field name="ldap_password"/>
<field name="ldap_password" password="True"/>
<field name="ldap_base"/>
<field name="ldap_filter"/>
<field name="create_user"/>

View File

@ -34,10 +34,14 @@ Allow users to login through Google OAuth2.
'depends': ['base', 'web', 'base_setup'],
'data': [
'auth_oauth_data.xml',
'auth_oauth_view.xml'
'auth_oauth_view.xml',
'security/ir.model.access.csv'
],
'js': ['static/src/js/auth_oauth.js'],
'css': ['static/lib/zocial/css/zocial.css'],
'css': [
'static/lib/zocial/css/zocial.css',
'static/src/css/auth_oauth.css',
],
'qweb': ['static/src/xml/auth_oauth.xml'],
'installable': True,
'auto_install': False,

View File

@ -2,6 +2,15 @@
<openerp>
<data>
<record id="provider_openerp" model="auth.oauth.provider">
<field name="name">OpenERP Accounts</field>
<field name="auth_endpoint">https://accounts.openerp.com/oauth2/auth</field>
<field name="scope">userinfo</field>
<field name="validation_endpoint">https://accounts.openerp.com/oauth2/tokeninfo</field>
<field name="data_endpoint"></field>
<field name="css_class">zocial openerp</field>
<field name="body">Sign in with OpenERP account</field>
</record>
<record id="provider_facebook" model="auth.oauth.provider">
<field name="name">Facebook Graph</field>
<field name="auth_endpoint">https://www.facebook.com/dialog/oauth</field>

View File

@ -4,7 +4,6 @@
<record model="ir.ui.view" id="view_oauth_provider_form">
<field name="name">auth.oauth.provider.form</field>
<field name="model">auth.oauth.provider</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="arch" version="7.0">
<sheet>
@ -26,7 +25,6 @@
<record model="ir.ui.view" id="view_oauth_provider_list">
<field name="name">auth.oauth.provider.list</field>
<field name="model">auth.oauth.provider</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="arch" version="7.0">
<field name="name" />

View File

@ -16,10 +16,13 @@ class OAuthController(openerpweb.Controller):
@openerpweb.jsonrequest
def list_providers(self, req, dbname):
try:
registry = openerp.modules.registry.RegistryManager.get(dbname)
with registry.cursor() as cr:
providers = registry.get('auth.oauth.provider')
l = providers.read(cr, SUPERUSER_ID, providers.search(cr, SUPERUSER_ID, [('enabled','=',True)]))
except Exception:
l = []
return l
@openerpweb.httprequest

View File

@ -1,6 +1,7 @@
import logging
import urllib
import urlparse
import urllib2
import simplejson
@ -21,6 +22,9 @@ class res_users(osv.Model):
def auth_oauth_rpc(self, cr, uid, endpoint, access_token, context=None):
params = urllib.urlencode({ 'access_token': access_token })
if urlparse.urlparse(endpoint)[4]:
url = endpoint + '&' + params
else:
url = endpoint + '?' + params
f = urllib2.urlopen(url)
response = f.read()
@ -38,11 +42,16 @@ class res_users(osv.Model):
validation = self.auth_oauth_rpc(cr, uid, p.validation_endpoint, access_token)
if validation.get("error"):
raise openerp.exceptions.AccessDenied
login = validation['email']
if p.data_endpoint:
data = self.auth_oauth_rpc(cr, uid, p.data_endpoint, access_token)
validation.update(data)
# required
oauth_uid = validation['user_id']
name = self.auth_oauth_rpc(cr, uid, p.data_endpoint, access_token)['name']
credentials = (cr.dbname, login, access_token)
if not oauth_uid:
raise openerp.exceptions.AccessDenied
email = validation.get('email', 'provider_%d_user_%d' % (p.id, oauth_uid))
# optional
name = validation.get('name', email)
res = self.search(cr, uid, [("oauth_uid", "=", oauth_uid)])
if res:
self.write(cr, uid, res[0], { 'oauth_access_token': access_token })
@ -50,14 +59,15 @@ class res_users(osv.Model):
# New user
new_user = {
'name': name,
'login': login,
'user_email': login,
'oauth_provider_id': 1,
'login': email,
'user_email': email,
'oauth_provider_id': p.id,
'oauth_uid': oauth_uid,
'oauth_access_token': access_token,
'active': True,
}
self.auth_signup_create(cr, uid, new_user)
credentials = (cr.dbname, email, access_token)
return credentials
def check_credentials(self, cr, uid, password):

View File

@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_auth_oauth_provider,auth_oauth_provider,model_auth_oauth_provider,base.group_system,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_auth_oauth_provider auth_oauth_provider model_auth_oauth_provider base.group_system 1 1 1 1

View File

@ -0,0 +1,35 @@
.openerp .oe_application .zocial {
font: white;
}
.openerp .zocial.openerp:before {
content: "\E02E";
font-style: italic;
text-shadow: 0 1px 1px black;
}
.openerp a.zocial.openerp {
float: right;
border: 1px solid #222222;
color: white;
margin: 0;
background-color: #b92020;
background-image: -webkit-gradient(linear, left top, left bottom, from(#b92020), to(#600606));
background-image: -webkit-linear-gradient(top, #b92020, #600606);
background-image: -moz-linear-gradient(top, #b92020, #600606);
background-image: -ms-linear-gradient(top, #b92020, #600606);
background-image: -o-linear-gradient(top, #b92020, #600606);
background-image: linear-gradient(to bottom, #b92020, #600606);
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(155, 155, 155, 0.4) inset;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(155, 155, 155, 0.4) inset;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(155, 155, 155, 0.4) inset;
text-shadow: none;
font-weight: normal;
}
.openerp .oe_login .oe_oauth_provider_login_button {
margin-top: 4px;
}

View File

@ -1,8 +1,9 @@
openerp.auth_oauth = function(instance) {
var QWeb = instance.web.qweb;
instance.web.Login = instance.web.Login.extend({
instance.web.Login.include({
start: function(parent, params) {
var self = this;
var d = this._super.apply(this, arguments);
this.$el.on('click', 'a.zocial', this.on_oauth_sign_in);
this.oauth_providers = [];
@ -11,7 +12,13 @@ openerp.auth_oauth = function(instance) {
} else if(this.params.oauth_error === 2) {
this.do_warn("Authentication error","");
}
return d.then(this.do_oauth_load);
return d.then(this.do_oauth_load).fail(function() {
self.do_oauth_load([]);
});
},
on_db_loaded: function(result) {
this._super.apply(this, arguments);
this.$("form [name=db]").change(this.do_oauth_load);
},
do_oauth_load: function() {
var db = this.$("form [name=db]").val();
@ -21,6 +28,7 @@ openerp.auth_oauth = function(instance) {
},
on_oauth_loaded: function(result) {
this.oauth_providers = result;
this.$('.oe_oauth_provider_login_button').remove();
var buttons = QWeb.render("auth_oauth.Login.button",{"widget":this});
this.$(".oe_login_pane form ul").after(buttons);
},
@ -33,7 +41,7 @@ openerp.auth_oauth = function(instance) {
var state_object = {
d: dbname,
p: p.id
}
};
var state = JSON.stringify(state_object);
var params = {
response_type: 'token',

View File

@ -2,8 +2,7 @@
<templates id="template" xml:space="preserve">
<t t-name="auth_oauth.Login.button">
<t t-foreach="widget.oauth_providers" t-as="p">
<a href="#" t-att-class="p.css_class" t-att-data-index="p_index"><t t-esc="p.body"/></a>
<br/>
<a href="#" t-attf-class="oe_oauth_provider_login_button #{p.css_class}" t-att-data-index="p_index"><t t-esc="p.body"/></a>
</t>
</t>
</templates>

View File

@ -32,10 +32,6 @@ def message_check(msg, secret):
class res_users(osv.osv):
_inherit = 'res.users'
_sql_constraints = [
('email_uniq', 'UNIQUE (user_email)', 'You can not have two users with the same email!')
]
def _auth_reset_password_secret(self, cr, uid, context=None):
uuid = self.pool.get('ir.config_parameter').get_param(cr, uid, 'database.uuid')
res = {
@ -77,6 +73,7 @@ class res_users(osv.osv):
MailMessage.send(cr, uid, [msg_id], context=context)
def send_reset_password_request(self, cr, uid, email, context=None):
# TODO reseting a password knowing only an email is not good enough (email can be shared between multiple logins).
ids = self.pool.get('res.users').search(cr, SUPERUSER_ID, [('user_email', '=', email)], context=context)
if ids:
self._auth_reset_password_send_email(cr, SUPERUSER_ID, email, 'reset_password_email', ids[0], context=context)

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