[MERGE] fixes in account

bzr revid: fp@tinyerp.com-20120920092726-5747f5kj14u26sb1
This commit is contained in:
Fabien Pinckaers 2012-09-20 11:27:26 +02:00
commit 5ffbf77067
21 changed files with 96 additions and 120 deletions

View File

@ -836,6 +836,8 @@ 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)

View File

@ -1103,10 +1103,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')]

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
@ -926,6 +931,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'], ))

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>
@ -1718,8 +1719,10 @@
<field name="model">account.payment.term.line</field>
<field name="arch" type="xml">
<form string="Payment Term" version="7.0">
<field name="name"/>
<field name="sequence"/>
<group>
<field name="name"/>
<field name="sequence"/>
</group>
<group>
<group string="Amount Computation">
<field name="value"/>
@ -1767,12 +1770,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>

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"/>
@ -93,8 +94,10 @@
</group>
<field name="bank_ids">
<form string="Bank account" version="7.0">
<field name="state"/>
<field name="acc_number"/>
<group col="4">
<field name="state"/>
<field name="acc_number"/>
</group>
<group>
<group name="owner" string="Bank Account Owner">
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/>

View File

@ -92,7 +92,7 @@ class account_move_journal(osv.osv_memory):
journal = False
if journal_id:
journal = journal_pool.read(cr, uid, journal_id, ['name'], context=context).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")

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',

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

@ -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

@ -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)]"/>

View File

@ -22,6 +22,10 @@
<field eval="True" name="global"/>
<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

@ -404,9 +404,9 @@
<field name="name"/>
<field name="statement_id" readonly="1"/>
<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="partner_id" />
<field name="type" />
<field name="account_id" />
<field name="amount" readonly="1" sum="Total Amount"/>
<field name="globalisation_id" string="Glob. Id"/>
<field name="globalisation_amount" string="Glob. Am."/>
@ -426,9 +426,9 @@
<field name="val_date"/>
<field name="name"/>
<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 name="partner_id"/>
<field name="type" />
<field domain="[('type', '&lt;&gt;', 'view')]" name="account_id"/>
<field name="amount"/>
<field name="globalisation_id"/>
<field name="sequence" readonly="0"/>

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>

View File

@ -19,7 +19,6 @@
#
##############################################################################
import company
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,45 +0,0 @@
# -*- 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 osv
class res_company(osv.osv):
_inherit = "res.company"
_description = 'Company'
def _get_default_ad(self, addresses):
name = email = phone = city = post_code = address = country_code = ""
for ads in addresses:
if ads.type == 'default':
city = ads.city or ""
post_code = ads.zip or ""
if ads.street:
address = ads.street or ""
if ads.street2:
address += " " + ads.street2
if ads.country_id:
country_code = ads.country_id and ads.country_id.code or ""
name = ads.name or ""
email = ads.email or ""
phone = ads.phone or ""
return name, email, phone, city, post_code, address, country_code
res_company()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -45,8 +45,8 @@ class l10n_be_vat_declaration(osv.osv_memory):
'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', domain=[('parent_id', '=', False)], required=True),
'msg': fields.text('File created', size=64, readonly=True),
'file_save': fields.binary('Save File'),
'ask_restitution': fields.boolean('Ask Restitution',help='It indicates whether a restitution is to made or not?'),
'ask_payment': fields.boolean('Ask Payment',help='It indicates whether a payment is to made or not?'),
'ask_restitution': fields.boolean('Ask Restitution',help='It indicates whether a restitution is to make or not?'),
'ask_payment': fields.boolean('Ask Payment',help='It indicates whether a payment is to make or not?'),
'client_nihil': fields.boolean('Last Declaration, no clients in client listing', help='Tick this case only if it concerns only the last statement on the civil or cessation of activity: ' \
'no clients to be included in the client listing.'),
'comments': fields.text('Comments'),
@ -70,6 +70,7 @@ class l10n_be_vat_declaration(osv.osv_memory):
obj_tax_code = self.pool.get('account.tax.code')
obj_acc_period = self.pool.get('account.period')
obj_user = self.pool.get('res.users')
obj_partner = self.pool.get('res.partner')
mod_obj = self.pool.get('ir.model.data')
if context is None:
@ -83,7 +84,7 @@ class l10n_be_vat_declaration(osv.osv_memory):
obj_company = obj_user.browse(cr, uid, uid, context=context).company_id
vat_no = obj_company.partner_id.vat
if not vat_no:
raise osv.except_osv(_('Insufficient Data!'), _('No VAT Number Associated with Main Company.'))
raise osv.except_osv(_('insufficient data!'), _('No VAT number associated with your company.'))
vat_no = vat_no.replace(' ','').upper()
vat = vat_no[2:]
@ -93,8 +94,9 @@ class l10n_be_vat_declaration(osv.osv_memory):
ctx['period_id'] = data['period_id'][0]
tax_info = obj_tax_code.read(cr, uid, tax_code_ids, ['code','sum_period'], context=ctx)
name = email = phone = address = post_code = city = country_code = ''
name, email, phone, city, post_code, address, country_code = self.pool.get('res.company')._get_default_ad(obj_company.partner_id)
default_address = obj_partner.address_get(cr, uid, [obj_company.partner_id.id])
default_address_id = default_address.get("default", obj_company.partner_id.id)
address_id= obj_partner.browse(cr, uid, default_address_id, context)
account_period = obj_acc_period.browse(cr, uid, data['period_id'][0], context=context)
issued_by = vat_no[:2]
@ -106,21 +108,21 @@ class l10n_be_vat_declaration(osv.osv_memory):
ending_month = account_period.date_stop[5:7]
quarter = str(((int(starting_month) - 1) / 3) + 1)
if not email:
if not address_id.email:
raise osv.except_osv(_('Insufficient Data!'),_('No email address associated with the company.'))
if not phone:
if not address_id.phone:
raise osv.except_osv(_('Insufficient Data!'),_('No phone associated with the company.'))
file_data = {
'issued_by': issued_by,
'vat_no': vat_no,
'only_vat': vat_no[2:],
'cmpny_name': obj_company.name,
'address': address,
'post_code': post_code,
'city': city,
'country_code': country_code,
'email': email,
'phone': phone.replace('.','').replace('/','').replace('(','').replace(')','').replace(' ',''),
'address': "%s %s"%(address_id.street or "",address_id.street2 or ""),
'post_code': address_id.zip or "",
'city': address_id.city or "",
'country_code': address_id.country_id and address_id.country_id.code or "",
'email': address_id.email or "",
'phone': address_id.phone.replace('.','').replace('/','').replace('(','').replace(')','').replace(' ',''),
'send_ref': send_ref,
'quarter': quarter,
'month': starting_month,

View File

@ -61,7 +61,7 @@ class partner_vat(osv.osv_memory):
company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
period_ids = obj_period.search(cr, uid, [('date_start' ,'>=', date_start), ('date_stop','<=',date_stop), ('company_id','=',company_id)])
if not period_ids:
raise osv.except_osv(_('Insufficient Data!'), _('No data for the selected year.'))
raise osv.except_osv(_('insufficient data!'), _('No data for the selected year.'))
partners = []
partner_ids = obj_partner.search(cr, uid, [('vat_subjected', '!=', False), ('vat','ilike','BE%')], context=context)
@ -87,6 +87,9 @@ class partner_vat(osv.osv_memory):
if record['turnover'] >= data['limit_amount']:
id_client = obj_vat_lclient.create(cr, uid, record, context=context)
partners.append(id_client)
if not partners:
raise osv.except_osv(_('insufficient data!'), _('No data found for the selected year.'))
context.update({'partner_ids': partners, 'year': data['year'], 'limit_amount': data['limit_amount']})
model_data_ids = obj_model_data.search(cr, uid, [('model','=','ir.ui.view'), ('name','=','view_vat_listing')])
resource_id = obj_model_data.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id']
@ -190,7 +193,7 @@ class partner_vat_list(osv.osv_memory):
phone = ads.phone.replace(' ','') or ''
email = ads.email or ''
name = ads.name or ''
city = obj_partner.get_city(cr, uid, ads.id)
city = ads.city or ''
zip = obj_partner.browse(cr, uid, ads.id, context=context).zip or ''
if not city:
city = ''

View File

@ -6,18 +6,18 @@
<field name="model">partner.vat</field>
<field name="arch" type="xml">
<form string="Partner VAT Listing" version="7.0">
<header>
<p class="oe_grey">
This wizard will create an XML file for VAT details and total invoiced amounts per partner.
</p>
<group>
<field name="year"/>
<field name="limit_amount"/>
</group>
<footer>
<button name="get_partner" string="View Customers" type="object" class="oe_highlight" />
or
<button string="Cancel" class="oe_link" special="cancel" />
</header>
<group>
<label string="This wizard will create an XML file for VAT details and total invoiced amounts per partner." colspan="4"/>
</group>
<newline/>
<field name="year"/>
<newline/>
<field name="limit_amount"/>
</footer>
</form>
</field>
</record>

View File

@ -108,7 +108,7 @@ class partner_vat_intra(osv.osv_memory):
# Get Company vat
company_vat = data_company.partner_id.vat
if not company_vat:
raise osv.except_osv(_('Insufficient Data!'),_('No VAT number associated with the company.'))
raise osv.except_osv(_('insufficient data!'),_('No VAT number associated with your company.'))
company_vat = company_vat.replace(' ','').upper()
issued_by = company_vat[:2]

View File

@ -8,7 +8,7 @@
<field name="inherit_id" ref="account.view_partner_property_form" />
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='bank_ids']/form/field[@name='acc_number']" position="before">
<xpath expr="//field[@name='bank_ids']//field[@name='acc_number']" position="before">
<newline />
<field name="bank_code" />
<field name="office" />