[MERGE] merged the dev3 branch

bzr revid: qdp-launchpad@tinyerp.com-20101126160454-7h9jwvqih2ds0va5
This commit is contained in:
qdp-launchpad@tinyerp.com 2010-11-26 17:04:54 +01:00
commit 4d2e3cb5ad
54 changed files with 456 additions and 50 deletions

View File

@ -48,7 +48,6 @@ module named account_voucher.
'security/account_security.xml',
'security/ir.model.access.csv',
'account_menuitem.xml',
'account_wizard.xml',
'report/account_invoice_report_view.xml',
'report/account_entries_report_view.xml',
'report/account_report_view.xml',

View File

@ -149,6 +149,7 @@ class account_bank_statement(osv.osv):
\n* And after getting confirmation from the bank it will be in \'Confirmed\' state.'),
'currency': fields.function(_currency, method=True, string='Currency',
type='many2one', relation='res.currency'),
'account_id': fields.related('journal_id', 'default_debit_account_id', type='many2one', relation='account.account', string='Account used in this journal', readonly=True, help='used in statement reconciliation domain, but shouldn\'t be used elswhere.'),
}
_defaults = {
@ -369,14 +370,15 @@ class account_bank_statement(osv.osv):
done.append(st.id)
return self.write(cr, uid, done, {'state':'draft'}, context=context)
def onchange_journal_id(self, cursor, user, statement_id, journal_id, context=None):
cursor.execute('SELECT balance_end_real \
def onchange_journal_id(self, cr, uid, statement_id, journal_id, context=None):
cr.execute('SELECT balance_end_real \
FROM account_bank_statement \
WHERE journal_id = %s AND NOT state = %s \
ORDER BY date DESC,id DESC LIMIT 1', (journal_id, 'draft'))
res = cursor.fetchone()
res = cr.fetchone()
balance_start = res and res[0] or 0.0
return {'value': {'balance_start': balance_start}}
account_id = self.pool.get('account.journal').read(cr, uid, journal_id, ['default_debit_account_id'], context=context)['default_debit_account_id']
return {'value': {'balance_start': balance_start, 'account_id': account_id}}
def unlink(self, cr, uid, ids, context=None):
stat = self.read(cr, uid, ids, ['state'])
@ -454,4 +456,4 @@ class account_bank_statement_line(osv.osv):
account_bank_statement_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -36,7 +36,7 @@
<menuitem id="menu_finance_periodical_processing_billing" name="Billing" parent="menu_finance_periodical_processing" sequence="35"/>
<menuitem id="menu_finance_statistic_report_statement" name="Statistic Reports" parent="menu_finance_reporting" sequence="300"/>
<menuitem id="next_id_22" name="Partners" parent="menu_finance_generic_reporting" sequence="1"/>
<menuitem
parent="account.menu_finance_legal_statement"
id="final_accounting_reports"

View File

@ -82,7 +82,7 @@ class account_move_line(osv.osv):
periods = fiscalperiod_obj.search(cr, uid, [('date_start', '<', first_period.date_start)])
periods = ','.join([str(x) for x in periods])
if periods:
query = obj+".state <> 'draft' AND "+obj+".period_id IN (SELECT id FROM account_period WHERE fiscalyear_id IN (%s) OR id IN (%s)) %s %s" % (fiscalyear_clause, periods, where_move_state, where_move_lines_by_date)
query = obj+".state <> 'draft' AND "+obj+".period_id IN (SELECT id FROM account_period WHERE fiscalyear_id IN (%s) AND id IN (%s)) %s %s" % (fiscalyear_clause, periods, where_move_state, where_move_lines_by_date)
else:
ids = ','.join([str(x) for x in context['periods']])
query = obj+".state <> 'draft' AND "+obj+".period_id IN (SELECT id FROM account_period WHERE fiscalyear_id IN (%s) AND id IN (%s)) %s %s" % (fiscalyear_clause, ids, where_move_state, where_move_lines_by_date)
@ -541,7 +541,9 @@ class account_move_line(osv.osv):
]
#TODO: ONCHANGE_ACCOUNT_ID: set account_tax_id
def onchange_currency(self, cr, uid, ids, account_id, amount, currency_id, date=False, journal=False):
def onchange_currency(self, cr, uid, ids, account_id, amount, currency_id, date=False, journal=False, context=None):
if context is None:
context = {}
account_obj = self.pool.get('account.account')
journal_obj = self.pool.get('account.journal')
currency_obj = self.pool.get('res.currency')
@ -552,7 +554,8 @@ class account_move_line(osv.osv):
if (amount>0) and journal:
x = journal_obj.browse(cr, uid, journal).default_credit_account_id
if x: acc = x
v = currency_obj.compute(cr, uid, currency_id, acc.company_id.currency_id.id, amount, account=acc)
context.update({'date': date})
v = currency_obj.compute(cr, uid, currency_id, acc.company_id.currency_id.id, amount, account=acc, context=context)
result['value'] = {
'debit': v > 0 and v or 0.0,
'credit': v < 0 and -v or 0.0

View File

@ -609,16 +609,29 @@
<group col="7" colspan="4">
<field name="name" select="1"/>
<field name="date" select="1" on_change="onchange_date(date)"/>
<field name="journal_id" domain="[('type', '=', 'bank')]" on_change="onchange_journal_id(journal_id)" select="1"/>
<field name="journal_id" domain="[('type', '=', 'bank')]" on_change="onchange_journal_id(journal_id)" widget="selection"/>
<newline/>
<field name="period_id"/>
<field name="balance_start"/>
<field name="balance_end_real"/>
<field name="currency" invisible="1"/>
<field name="account_id" invisible="1"/>
</group>
<notebook colspan="4">
<page string="Journal Entries">
<field colspan="4" name="move_line_ids" nolabel="1" widget="many2many"/>
<field colspan="4" name="move_line_ids" nolabel="1" widget="many2many" domain="[('account_id','=',account_id),('statement_id', '=', False)]">
<tree string="Statement lines">
<field name="date"/>
<field name="period_id"/>
<field name="journal_id"/>
<field name="ref"/>
<field name="name"/>
<field name="account_id"/>
<field name="partner_id"/>
<field name="debit"/>
<field name="credit"/>
</tree>
</field>
</page>
</notebook>
<group col="8" colspan="4">
@ -1155,7 +1168,7 @@
<filter
icon="terp-dolar_ok!"
string="Unreconciled"
domain="[('reconcile_id','=',False), ('account_id.type','in',['receivable', 'payable'])]" help="Unreconciled Journal Items"
domain="[('reconcile_id','=',False), ('account_id.reconcile','=',True)]" help="Unreconciled Journal Items"
name="unreconciled"/>
<separator orientation="vertical"/>
<field name="move_id" select="1" string="Number (Move)"/>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<menuitem id="next_id_22" name="Partners" parent="menu_finance_generic_reporting" sequence="1"/>
</data>
</openerp>

View File

@ -406,6 +406,11 @@ msgstr ""
msgid "Error! You can not create recursive analytic accounts."
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.bank.statement.reconcile,total_entry:0
msgid "Total entries"

View File

@ -26,6 +26,11 @@ msgstr "Вътрешно име"
msgid "Account Tax Code"
msgstr "Данъчен код"
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.action_invoice_tree9
#: model:ir.ui.menu,name:account.menu_action_invoice_tree9

View File

@ -26,6 +26,11 @@ msgstr "Interni naziv"
msgid "Account Tax Code"
msgstr "Šifra poreza"
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.action_invoice_tree9
#: model:ir.ui.menu,name:account.menu_action_invoice_tree9

View File

@ -27,6 +27,11 @@ msgstr "Nom intern"
msgid "Account Tax Code"
msgstr "Codi impost comptable"
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.action_invoice_tree9
#: model:ir.ui.menu,name:account.menu_action_invoice_tree9

View File

@ -28,6 +28,11 @@ msgstr "Interní jméno"
msgid "Partner's"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,display_partner:0
msgid "Display Partners"

View File

@ -28,6 +28,11 @@ msgstr "Nombre interno"
msgid "Partner's"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,display_partner:0
msgid "Display Partners"

View File

@ -21,6 +21,11 @@ msgstr ""
msgid "Internal Name"
msgstr "Sisemine nimi"
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: view:account.tax.code:0
msgid "Account Tax Code"

View File

@ -29,6 +29,11 @@ msgstr "Barne Izena"
msgid "Partner's"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,display_partner:0
msgid "Display Partners"

View File

@ -22,6 +22,11 @@ msgstr ""
msgid "Internal Name"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,result_selection:0
#: field:account.aged.trial.balance,result_selection:0

View File

@ -27,6 +27,11 @@ msgstr "Sisäinen nimi"
msgid "Account Tax Code"
msgstr "Tilin verokoodi"
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.action_invoice_tree9
#: model:ir.ui.menu,name:account.menu_action_invoice_tree9

View File

@ -25,6 +25,11 @@ msgstr ""
msgid "Partner's"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,display_partner:0
msgid "Display Partners"

View File

@ -24,6 +24,11 @@ msgstr ""
msgid "Partner's"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,display_partner:0
msgid "Display Partners"

View File

@ -21,6 +21,11 @@ msgstr ""
msgid "Internal Name"
msgstr "Interni naziv"
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: view:account.tax.code:0
msgid "Account Tax Code"

View File

@ -28,6 +28,11 @@ msgstr ""
msgid "Partner's"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,display_partner:0
msgid "Display Partners"

View File

@ -29,6 +29,11 @@ msgstr "Nama Internal"
msgid "Partner's"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,display_partner:0
msgid "Display Partners"

View File

@ -22,6 +22,11 @@ msgstr ""
msgid "Internal Name"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,result_selection:0
#: field:account.aged.trial.balance,result_selection:0

View File

@ -22,6 +22,11 @@ msgstr ""
msgid "Internal Name"
msgstr "내부 명칭"
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,result_selection:0
#: field:account.aged.trial.balance,result_selection:0

View File

@ -21,6 +21,11 @@ msgstr ""
msgid "Internal Name"
msgstr "Vidinis vardas"
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: view:account.tax.code:0
msgid "Account Tax Code"

View File

@ -22,6 +22,11 @@ msgstr ""
msgid "Internal Name"
msgstr "Iekšējais Nosaukums"
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,result_selection:0
#: field:account.aged.trial.balance,result_selection:0

View File

@ -22,6 +22,11 @@ msgstr ""
msgid "Internal Name"
msgstr "Дотоод нэр"
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: view:account.tax.code:0
msgid "Account Tax Code"

View File

@ -22,6 +22,11 @@ msgstr ""
msgid "Internal Name"
msgstr "Internt Navn"
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: view:account.tax.code:0
msgid "Account Tax Code"

View File

@ -26,6 +26,11 @@ msgstr "Interne naam"
msgid "Account Tax Code"
msgstr "Belasting code"
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,result_selection:0
#: field:account.aged.trial.balance,result_selection:0

View File

@ -22,6 +22,11 @@ msgstr ""
msgid "Internal Name"
msgstr "Nom intèrne"
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: view:account.tax.code:0
msgid "Account Tax Code"

View File

@ -34,6 +34,11 @@ msgstr ""
msgid "Partner's"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,display_partner:0
msgid "Display Partners"

View File

@ -3860,6 +3860,11 @@ msgstr ""
msgid "Select Chart"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: selection:account.chart,init,target_move:0
#: model:ir.actions.report.xml,name:account.account_move_line_list

View File

@ -28,6 +28,11 @@ msgstr "Interni naziv"
msgid "Partner's"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.menu_account_pl_report
msgid "Profit And Loss"

View File

@ -29,6 +29,11 @@ msgstr "Emri i Brendshëm"
msgid "Partner's"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,display_partner:0
msgid "Display Partners"

View File

@ -27,6 +27,11 @@ msgstr "Interno ime"
msgid "Account Tax Code"
msgstr "Poreska tarifa konta"
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.action_invoice_tree9
#: model:ir.ui.menu,name:account.menu_action_invoice_tree9

View File

@ -29,6 +29,11 @@ msgstr "உட் பெயர்"
msgid "Partner's"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.menu_account_pl_report
msgid "Profit And Loss"

View File

@ -32,6 +32,11 @@ msgstr ""
msgid "Profit And Loss"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.menu_account_bs_report
msgid "Balance Sheet"

View File

@ -34,6 +34,11 @@ msgstr "รหัสบัญชีภาษี"
msgid "Partner's"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,display_partner:0
msgid "Display Partners"

View File

@ -33,6 +33,11 @@ msgstr ""
msgid "Partner's"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,display_partner:0
msgid "Display Partners"

View File

@ -29,6 +29,11 @@ msgstr "ئىچكى ئىسمى"
msgid "Partner's"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,display_partner:0
msgid "Display Partners"

View File

@ -28,6 +28,11 @@ msgstr "Внутрішня назва"
msgid "Partner's"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,display_partner:0
msgid "Display Partners"

View File

@ -26,6 +26,11 @@ msgstr "内部名称"
msgid "Account Tax Code"
msgstr "税事务科目"
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.action_invoice_tree9
#: model:ir.ui.menu,name:account.menu_action_invoice_tree9

View File

@ -27,6 +27,11 @@ msgstr "內部名稱"
msgid "Account Tax Code"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: model:ir.actions.act_window,name:account.action_invoice_tree9
#: model:ir.ui.menu,name:account.menu_action_invoice_tree9

View File

@ -27,6 +27,11 @@ msgstr "內部名稱"
msgid "Partner's"
msgstr ""
#. module: account
#: model:ir.ui.menu,name:account.next_id_22
msgid "Partners"
msgstr ""
#. module: account
#: field:account.partner.balance,display_partner:0
msgid "Display Partners"

View File

@ -20,5 +20,6 @@
##############################################################################
import account_sequence
import account_sequence_installer
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -30,7 +30,11 @@
'website': 'http://www.openerp.com',
'depends': ['account'],
'init_xml': [],
'update_xml': ['account_sequence_data.xml','account_sequence.xml'],
'update_xml': [
'account_sequence_data.xml',
'account_sequence_installer_view.xml',
'account_sequence.xml'
],
'demo_xml': [],
'installable': True,
'active': False,

View File

@ -33,11 +33,11 @@ class account_move(osv.osv):
obj_sequence = self.pool.get('ir.sequence')
res = super(account_move, self).post(cr, uid, ids, context=context)
seq_no = False
for line in self.browse(cr, uid, ids):
if line.journal_id.internal_sequence:
seq_no = obj_sequence.get_id(cr, uid, line.journal_id.internal_sequence.id, context=context)
for move in self.browse(cr, uid, ids, context):
if move.journal_id.internal_sequence_id:
seq_no = obj_sequence.get_id(cr, uid, move.journal_id.internal_sequence_id.id, context=context)
if seq_no:
self.write(cr, uid, [line.id], {'internal_sequence_number': seq_no})
self.write(cr, uid, [move.id], {'internal_sequence_number': seq_no})
return res
account_move()
@ -46,7 +46,7 @@ class account_journal(osv.osv):
_inherit = "account.journal"
_columns = {
'internal_sequence': fields.many2one('ir.sequence', 'Internal Sequence'),
'internal_sequence_id': fields.many2one('ir.sequence', 'Internal Sequence', help="This sequence will be used to maintain the internal number for the journal entries related to this journal."),
}
account_journal()
@ -57,5 +57,7 @@ class account_move_line(osv.osv):
_columns = {
'internal_sequence_number': fields.related('move_id','internal_sequence_number', type='char', relation='account.move', help='Internal Sequence Number', string='Internal Number'),
}
account_move_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -21,7 +21,7 @@
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml">
<field name="sequence_id" position="after">
<field name="internal_sequence"/>
<field name="internal_sequence_id"/>
</field>
</field>
</record>

View File

@ -1,14 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!--Account Journal Internal Sequences-->
<record id="internal_sequence_journal" model="ir.sequence">
<field name="name">Internal Sequence Journal</field>
<field name="code">account.journal</field>
<field name="number_next">1</field>
</record>
<function eval="('default', False, 'internal_sequence', [('account.journal', False)], internal_sequence_journal, True, False, False, False, True)" id="internal_seq_default_set" model="ir.values" name="set"/>
<!--Account Journal Internal Number of account move line-->

View File

@ -0,0 +1,83 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
class account_sequence_installer(osv.osv_memory):
_name = 'account.sequence.installer'
_inherit = 'res.config.installer'
_columns = {
'name': fields.char('Name',size=64, required=True),
'prefix': fields.char('Prefix',size=64, help="Prefix value of the record for the sequence"),
'suffix': fields.char('Suffix',size=64, help="Suffix value of the record for the sequence"),
'number_next': fields.integer('Next Number', required=True, help="Next number of this sequence"),
'number_increment': fields.integer('Increment Number', required=True, help="The next number of the sequence will be incremented by this number"),
'padding' : fields.integer('Number padding', required=True, help="OpenERP will automatically adds some '0' on the left of the 'Next Number' to get the required padding size."),
'company_id': fields.many2one('res.company', 'Company'),
}
_defaults = {
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'ir.sequence', context=c),
'number_increment': 1,
'number_next': 1,
'padding' : 0,
'name': 'Internal Sequence Journal',
}
def execute(self, cr, uid, ids, context=None):
if context is None:
context = {}
jou_obj = self.pool.get('account.journal')
obj_sequence = self.pool.get('ir.sequence')
record = self.browse(cr, uid, ids, context)[0]
j_ids = []
if record.company_id:
company_id = record.company_id.id,
search_criteria = [('company_id', '=', company_id)]
else:
company_id = False
search_criteria = []
vals = {
'id': 'internal_sequence_journal',
'code': 'account.journal',
'name': record.name,
'prefix': record.prefix,
'suffix': record.suffix,
'number_next': record.number_next,
'number_increment': record.number_increment,
'padding' : record.padding,
'company_id': company_id,
}
ir_seq = obj_sequence.create(cr, uid, vals, context)
res = super(account_sequence_installer, self).execute(cr, uid, ids, context=context)
journal_ids = jou_obj.search(cr, uid, search_criteria, context=context)
for journal in jou_obj.browse(cr, uid, journal_ids, context):
if not journal.internal_sequence_id:
j_ids.append(journal.id)
if j_ids:
jou_obj.write(cr, uid, j_ids, {'internal_sequence_id': ir_seq})
self.pool.get('ir.values').set(cr, uid, key='default', key2=False, name='internal_sequence_id', models =[('account.journal', False)], value=ir_seq)
return res
account_sequence_installer()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_account_sequence_installer" model="ir.ui.view">
<field name="name">account.sequence.installer.view</field>
<field name="model">account.sequence.installer</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.res_config_installer"/>
<field name="arch" type="xml">
<data>
<form position="attributes">
<attribute name="string">Account Sequence Application Configuration</attribute>
</form>
<separator string="title" position="attributes">
<attribute name="string">Configure Your Account Sequence Application</attribute>
</separator>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='string'></attribute>
</xpath>
<xpath expr="//label[@string='description']" position="attributes">
<attribute name="string">You can enhance the Account Sequence Application by installing .</attribute>
</xpath>
<group colspan="8">
<field name="name" colspan="4"/>
<field name="prefix"/>
<field name="suffix"/>
<field name="number_next"/>
<field name="number_increment"/>
<field name="padding"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<xpath expr="//button[@string='Install Modules']" position="attributes">
<attribute name="string">Configure</attribute>
</xpath>
</data>
</field>
</record>
<record id="action_account_seq_installer" model="ir.actions.act_window">
<field name="name">Account Sequence Application Configuration</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.sequence.installer</field>
<field name="view_id" ref="view_account_sequence_installer"/>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record id="account_seq_installer_todo" model="ir.actions.todo">
<field name="action_id" ref="action_account_seq_installer"/>
<field name="sequence">3</field>
<field name="restart">onskip</field>
</record>
</data>
</openerp>

View File

@ -140,6 +140,20 @@ class account_voucher(osv.osv):
res['arch'] = etree.tostring(doc)
return res
def _get_writeoff_amount(self, cr, uid, ids, name, args, context=None):
if not ids: return {}
res = {}
for voucher in self.browse(cr, uid, ids, context=context):
debit= credit = 0.0
if voucher.line_dr_ids:
for line in voucher.line_dr_ids:
debit += line.amount_unreconciled
if voucher.line_cr_ids:
for line in voucher.line_cr_ids:
credit += line.amount_unreconciled
res[voucher.id] = abs(voucher.amount - abs(credit - debit))
return res
_name = 'account.voucher'
_description = 'Accounting Voucher'
_order = "date desc, id desc"
@ -190,6 +204,15 @@ class account_voucher(osv.osv):
'tax_id':fields.many2one('account.tax', 'Tax', readonly=True, states={'draft':[('readonly',False)]}),
'pre_line':fields.boolean('Previous Payments ?', required=False),
'date_due': fields.date('Due Date', readonly=True, states={'draft':[('readonly',False)]}),
'payment_option':fields.selection([
('without_writeoff', 'Without Write-off'),
('with_writeoff', 'With Write-off'),
], 'Payment Option', required=True, readonly=True, states={'draft': [('readonly', False)]}),
'writeoff_acc_id': fields.many2one('account.account', 'Write-Off account', readonly=True, states={'draft': [('readonly', False)]}),
'writeoff_journal_id': fields.many2one('account.journal', 'Write-Off journal', readonly=True, states={'draft': [('readonly', False)]}),
'comment': fields.char('Comment', size=64, readonly=True, states={'draft': [('readonly', False)]}),
'analytic_id': fields.many2one('account.analytic.account','Analytic Account', readonly=True, states={'draft': [('readonly', False)]}),
'writeoff_amount': fields.function(_get_writeoff_amount, method=True, string='Writeoff Amount', type='float', readonly=True),
}
_defaults = {
'period_id': _get_period,
@ -205,6 +228,8 @@ class account_voucher(osv.osv):
'date': lambda *a: time.strftime('%Y-%m-%d'),
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.voucher',context=c),
'tax_id': _get_tax,
'payment_option': 'without_writeoff',
'comment': 'Write-Off',
}
def compute_tax(self, cr, uid, ids, context={}):
@ -638,7 +663,6 @@ class account_voucher(osv.osv):
'date': inv.date,
'date_maturity': inv.date_due
}
if (debit == 0.0 or credit == 0.0 or debit+credit > 0) and (debit > 0.0 or credit > 0.0):
master_line = move_line_pool.create(cr, uid, move_line)
@ -695,6 +719,10 @@ class account_voucher(osv.osv):
if line.move_line_id.id:
rec_ids = [master_line, line.move_line_id.id]
rec_list_ids.append(rec_ids)
writeoff_account_id = False
writeoff_journal_id = False
writeoff_period_id = inv.period_id.id,
comment = False
if not currency_pool.is_zero(cr, uid, inv.currency_id, line_total):
diff = line_total
@ -718,6 +746,15 @@ class account_voucher(osv.osv):
move_line['account_id'] = account_id
move_line_pool.create(cr, uid, move_line)
for rec_ids in rec_list_ids:
if len(rec_ids) >= 2:
if inv.payment_option == 'with_writeoff':
writeoff_account_id = inv.writeoff_acc_id.id
writeoff_journal_id = inv.writeoff_journal_id.id
comment = inv.comment
move_line_pool.reconcile(cr, uid, rec_ids, 'manual', writeoff_account_id, writeoff_period_id, writeoff_journal_id, context)
else:
move_line_pool.reconcile_partial(cr, uid, rec_ids)
self.write(cr, uid, [inv.id], {
'move_id': move_id,
@ -725,9 +762,6 @@ class account_voucher(osv.osv):
'number': name,
})
move_pool.post(cr, uid, [move_id], context={})
for rec_ids in rec_list_ids:
if len(rec_ids) >= 2:
move_line_pool.reconcile_partial(cr, uid, rec_ids)
return True
def copy(self, cr, uid, id, default={}, context=None):

View File

@ -196,10 +196,29 @@
<field name="narration" colspan="2" nolabel="1"/>
</group>
<group col="2" colspan="1">
<group col="2" colspan="1">
<separator string="Payment Options" colspan="2"/>
<field name="payment_option" required="1"/>
<field name="writeoff_amount"
attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
<field name="writeoff_acc_id"
attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"
domain="[('type','=','liquidity')]"/>
<!-- should select income accounts only. Or use the journal for this ? -->
<field name="writeoff_journal_id"
attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"/>
<field name="comment"
attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
<field name="analytic_id"
attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"
groups="analytic.group_analytic_accounting"/>
</group>
<separator string="Other Information" colspan="2"/>
<field name="date" select="1" on_change="onchange_date(date)"/>
<field name="currency_id" invisible="True"/>
<field name="number"/>
<group col="4" colspan="1">
<field name="date" select="1" on_change="onchange_date(date)"/>
<field name="currency_id" invisible="True"/>
<field name="number"/>
</group>
</group>
</page>
<page string="Journal Items" groups="base.group_extended" attrs="{'invisible': [('state','!=','posted')]}">
@ -304,10 +323,29 @@
<field name="narration" colspan="2" nolabel="1"/>
</group>
<group col="2" colspan="1">
<group col="2" colspan="1">
<separator string="Payment Options" colspan="2"/>
<field name="payment_option" required="1"/>
<field name="writeoff_amount"
attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
<field name="writeoff_acc_id"
attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"
domain="[('type','=','liquidity')]"/>
<!-- should select income accounts only. Or use the journal for this ? -->
<field name="writeoff_journal_id"
attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"/>
<field name="comment"
attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
<field name="analytic_id"
attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"
groups="analytic.group_analytic_accounting"/>
</group>
<separator string="Other Information" colspan="2"/>
<field name="date" select="1" on_change="onchange_date(date)"/>
<field name="currency_id" invisible="True"/>
<field name="number"/>
<group col="4" colspan="1">
<field name="date" select="1" on_change="onchange_date(date)"/>
<field name="currency_id" invisible="True"/>
<field name="number"/>
</group>
</group>
</page>
<page string="Journal Items" groups="base.group_extended" attrs="{'invisible': [('state','!=','posted')]}">

View File

@ -62,12 +62,12 @@ _ref_iban = { 'al':'ALkk BBBS SSSK CCCC CCCC CCCC CCCC', 'ad':'ADkk BBBB SSSS CC
def _format_iban(string):
'''
This function removes all characters from given 'string' that isn't a alpha numeric and converts it to lower case.
This function removes all characters from given 'string' that isn't a alpha numeric and converts it to upper case.
'''
res = ""
for char in string:
if char.isalnum():
res += char.lower()
res += char.upper()
return res
class res_partner_bank(osv.osv):
@ -92,7 +92,7 @@ class res_partner_bank(osv.osv):
for bank_acc in self.browse(cr, uid, ids):
if not bank_acc.iban:
continue
iban = _format_iban(bank_acc.iban)
iban = _format_iban(bank_acc.iban).lower()
if iban[:2] in _iban_len and len(iban) != _iban_len[iban[:2]]:
return False
#the four first digits have to be shifted to the end

View File

@ -69,7 +69,7 @@
<filter string="Approved" icon="terp-check" domain="[('state','=','accepted')]"
help = "Approved Expenses"/>
<separator orientation="vertical"/>
<filter string="Invoiced" icon="terp-dolar" domain="[('state','=','invoiced')]"
<filter string="Invoiced" icon="terp-dolar" domain="[('state','in', ('invoiced', 'paid'))]"
help = "Invoiced Expenses"/>
<separator orientation="vertical"/>
<field name="employee_id"/>