[MERGE] staging branch with removal of property_reserve_and_surplus_account, fixes in invoice analysis report, usability improvements in account and hr

bzr revid: qdp-launchpad@openerp.com-20121015142729-0vlvv1mx54zr6p4f
This commit is contained in:
Quentin (OpenERP) 2012-10-15 16:27:29 +02:00
commit 24f5e3d042
24 changed files with 73 additions and 63 deletions

View File

@ -2768,7 +2768,6 @@ class account_chart_template(osv.osv):
'property_account_income_categ': fields.many2one('account.account.template', 'Income Category Account'),
'property_account_expense': fields.many2one('account.account.template', 'Expense Account on Product Template'),
'property_account_income': fields.many2one('account.account.template', 'Income Account on Product Template'),
'property_reserve_and_surplus_account': fields.many2one('account.account.template', 'Reserve and Profit/Loss Account', domain=[('type', '=', 'payable')], help='This Account is used for transferring Profit/Loss(If It is Profit: Amount will be added, Loss: Amount will be deducted.), Which is calculated from Profilt & Loss Report'),
'property_account_income_opening': fields.many2one('account.account.template', 'Opening Entries Income Account'),
'property_account_expense_opening': fields.many2one('account.account.template', 'Opening Entries Expense Account'),
}
@ -3216,7 +3215,6 @@ class wizard_multi_charts_accounts(osv.osv_memory):
('property_account_income_categ','product.category','account.account'),
('property_account_expense','product.template','account.account'),
('property_account_income','product.template','account.account'),
('property_reserve_and_surplus_account','res.company','account.account')
]
template = self.pool.get('account.chart.template').browse(cr, uid, chart_template_id, context=context)
for record in todo_list:

View File

@ -2171,7 +2171,6 @@
<field name="property_account_income" domain="[('id', 'child_of', [account_root_id])]"/>
<field name="property_account_income_opening" domain="[('id', 'child_of', [account_root_id])]"/>
<field name="property_account_expense_opening" domain="[('id', 'child_of', [account_root_id])]"/>
<field name="property_reserve_and_surplus_account" />
</group>
</form>
</field>

View File

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

View File

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

View File

@ -381,7 +381,6 @@
<field name="property_account_income_categ" ref="conf_a_sale"/>
<field name="property_account_income_opening" ref="conf_o_income"/>
<field name="property_account_expense_opening" ref="conf_o_expense"/>
<field name="property_reserve_and_surplus_account" ref="conf_a_reserve_and_surplus"/>
<field name="complete_tax_set" eval="False"/>
</record>

View File

@ -304,14 +304,6 @@
<field name="company_id" ref="base.main_company"/>
</record>
<record forcecreate="True" id="property_reserve_and_surplus_account" model="ir.property">
<field name="name">property_account_receivable</field>
<field name="fields_id" search="[('model','=','res.company'),('name','=','property_reserve_and_surplus_account')]"/>
<field eval="'account.account,'+str(rsa)" name="value"/>
<field name="company_id" ref="base.main_company"/>
</record>
<!--
Account Journal
-->

View File

@ -20,6 +20,7 @@
##############################################################################
import tools
import decimal_precision as dp
from osv import fields,osv
class account_invoice_report(osv.osv):
@ -27,6 +28,31 @@ class account_invoice_report(osv.osv):
_description = "Invoices Statistics"
_auto = False
_rec_name = 'date'
def _compute_amounts_in_user_currency(self, cr, uid, ids, field_names, args, context=None):
"""Compute the amounts in the currency of the user
"""
if context is None:
context={}
currency_obj = self.pool.get('res.currency')
currency_rate_obj = self.pool.get('res.currency.rate')
user_currency_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id
currency_rate_id = currency_rate_obj.search(cr, uid, [('rate', '=', 1)], limit=1, context=context)[0]
base_currency_id = currency_rate_obj.browse(cr, uid, currency_rate_id, context=context).currency_id.id
res = {}
ctx = context.copy()
for item in self.browse(cr, uid, ids, context=context):
ctx['date'] = item.date
price_total = currency_obj.compute(cr, uid, base_currency_id, user_currency_id, item.price_total, context=ctx)
price_average = currency_obj.compute(cr, uid, base_currency_id, user_currency_id, item.price_average, context=ctx)
residual = currency_obj.compute(cr, uid, base_currency_id, user_currency_id, item.residual, context=ctx)
res[item.id] = {
'user_currency_price_total': price_total,
'user_currency_price_average': price_average,
'user_currency_residual': residual,
}
return res
_columns = {
'date': fields.date('Date', readonly=True),
'year': fields.char('Year', size=4, readonly=True),
@ -47,7 +73,9 @@ class account_invoice_report(osv.osv):
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'user_id': fields.many2one('res.users', 'Salesperson', readonly=True),
'price_total': fields.float('Total Without Tax', readonly=True),
'user_currency_price_total': fields.function(_compute_amounts_in_user_currency, string="Total Without Tax", type='float', digits_compute=dp.get_precision('Account'), multi="_compute_amounts"),
'price_average': fields.float('Average Price', readonly=True, group_operator="avg"),
'user_currency_price_average': fields.function(_compute_amounts_in_user_currency, string="Average Price", type='float', digits_compute=dp.get_precision('Account'), multi="_compute_amounts"),
'currency_rate': fields.float('Currency Rate', readonly=True),
'nbr':fields.integer('# of Lines', readonly=True),
'type': fields.selection([
@ -69,6 +97,7 @@ class account_invoice_report(osv.osv):
'account_line_id': fields.many2one('account.account', 'Account Line',readonly=True),
'partner_bank_id': fields.many2one('res.partner.bank', 'Bank Account',readonly=True),
'residual': fields.float('Total Residual', readonly=True),
'user_currency_residual': fields.function(_compute_amounts_in_user_currency, string="Total Residual", type='float', digits_compute=dp.get_precision('Account'), multi="_compute_amounts"),
'delay_to_pay': fields.float('Avg. Delay To Pay', readonly=True, group_operator="avg"),
'due_delay': fields.float('Avg. Due Delay', readonly=True, group_operator="avg"),
}
@ -161,7 +190,7 @@ class account_invoice_report(osv.osv):
left join product_uom u on (u.id=ail.uos_id),
res_currency_rate cr
where cr.id in (select id from res_currency_rate cr2 where (cr2.currency_id = ai.currency_id)
and ((ai.date_invoice is not null and cr.name <= ai.date_invoice) or (ai.date_invoice is null and cr.name <= NOW())) limit 1)
and ((ai.date_invoice is not null and cr.name <= ai.date_invoice) or (ai.date_invoice is null and cr.name <= NOW())) order by name desc limit 1)
group by ail.product_id,
ai.date_invoice,
ai.id,

View File

@ -28,8 +28,8 @@
<field name="nbr" sum="# of Lines"/>
<field name="product_qty" sum="Qty"/>
<!-- <field name="reconciled" sum="# Reconciled"/> -->
<field name="price_total" sum="Total Without Tax"/>
<field name="residual" sum="Total Residual" invisible="context.get('residual_invisible',False)"/>
<field name="user_currency_price_total" sum="Total Without Tax"/>
<field name="user_currency_residual" sum="Total Residual" invisible="context.get('residual_invisible',False)"/>
<field name="due_delay" sum="Avg. Due Delay" invisible="context.get('residual_invisible',False)"/>
<field name="delay_to_pay" sum="Avg. Delay To Pay" invisible="context.get('residual_invisible',False)"/>
</tree>
@ -42,7 +42,7 @@
<field name="arch" type="xml">
<graph string="Invoices Analysis" type="bar">
<field name="product_id"/>
<field name="price_total"/>
<field name="user_currency_price_total"/>
</graph>
</field>
</record>

View File

@ -121,7 +121,7 @@
</div>
<label for="id" string="Features"/>
<div>
<div>
<div name="group_multi_currency">
<field name="group_multi_currency" class="oe_inline"/>
<label for="group_multi_currency"/>
</div>

View File

@ -154,7 +154,7 @@
<field name="view_id" ref="view_bank_statement_line_list"/>
</record>
<menuitem action="action_bank_statement_line" id="bank_statement_line" parent="account.menu_finance_bank_and_cash" sequence="20"/>
<menuitem action="action_bank_statement_line" id="bank_statement_line" parent="account.menu_finance_bank_and_cash" sequence="20" groups="base.group_no_one"/>
</data>
</openerp>

View File

@ -42,6 +42,21 @@ class res_company(osv.osv):
res_company()
class account_config_settings(osv.osv_memory):
_inherit = 'account.config.settings'
_columns = {
'income_currency_exchange_account_id': fields.related(
'company_id', 'income_currency_exchange_account_id',
type='many2one',
relation='account.account',
string="Gain Exchange Rate Account"),
'expense_currency_exchange_account_id': fields.related(
'company_id', 'expense_currency_exchange_account_id',
type="many2one",
relation='account.account',
string="Loss Exchange Rate Account"),
}
class account_voucher(osv.osv):
def _check_paid(self, cr, uid, ids, name, args, context=None):
res = {}

View File

@ -249,16 +249,23 @@
</field>
</record>
<!-- res.company form view -->
<record model="ir.ui.view" id="view_company_inherit_currency_xchange_form">
<field name="name">res.company.form.inherit</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="model">res.company</field>
<!-- res.config form view -->
<record model="ir.ui.view" id="view_account_settings_currency_xchange_form">
<field name="name">account.config.settings.inherit</field>
<field name="inherit_id" ref="account.view_account_config_settings"/>
<field name="model">account.config.settings</field>
<field name="priority">20</field>
<field name="arch" type="xml">
<field name="currency_id" position="after">
<field name="income_currency_exchange_account_id"/>
<field name="expense_currency_exchange_account_id"/>
</field>
<xpath expr="//div[@name='group_multi_currency']" position="after">
<group attrs="{'invisible': [('group_multi_currency', '&lt;&gt;', True)]}" col="2">
<group>
<field name="income_currency_exchange_account_id"/>
<field name="expense_currency_exchange_account_id"/>
</group>
<group>
</group>
</group>
</xpath>
</field>
</record>

View File

@ -36,9 +36,11 @@
<page string="Public Information">
<group>
<group string="Contact Information">
<field name="address_id" on_change="onchange_address_id(address_id)" context="{'show_address': 1}" options='{"always_reload": True, "highlight_first_line": True}'/>
<field name="work_email" widget="email"/>
<field name="work_phone"/>
<field name="mobile_phone"/>
<field name="work_location"/>
</group>
<group string="Position">
<field name="department_id" on_change="onchange_department_id(department_id)"/>
@ -49,7 +51,6 @@
<group>
<field name="company_id" groups="base.group_multi_company" on_change="onchange_company(company_id)"/>
<field name="user_id" on_change="onchange_user(user_id)" string="Related User"/>
<field name="address_id" on_change="onchange_address_id(address_id)" context="{'show_address': 1}" options='{"always_reload": True, "highlight_first_line": True}'/>
</group>
</group>
<field name="notes" placeholder="Other Information ..." colspan="4"/>

View File

@ -55,11 +55,11 @@
<sheet>
<label for="employee_id" class="oe_edit_only"/>
<h1><field name="employee_id" on_change="onchange_employee_id(employee_id)"/></h1>
<label for="date_from" class="oe_edit_only" string="Timesheet Period"/>
<h2>From <field name="date_from"/> to <field name="date_to"/></h2>
<group>
<group>
<field name="name"/>
<label for="date_from" string="Timesheet Period"/>
<div><field name="date_from"/> to <field name="date_to"/></div>
<field name="name" invisible="1"/>
<field name="department_id"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>

View File

@ -11807,7 +11807,6 @@
<field name="property_account_income" ref="ch_3200"/>
<field name="property_account_income_opening" ref="ch_2990"/>
<field name="property_account_expense_opening" ref="ch_2990"/>
<field name="property_reserve_and_surplus_account" ref="ch_2991"/>
</record>
<!-- journal configuration of account -->

View File

@ -957,7 +957,6 @@
<field name="property_account_payable" ref="chart2202"/>
<field name="property_account_expense_categ" ref="chart1401"/>
<field name="property_account_income_categ" ref="chart6001"/>
<field name="property_reserve_and_surplus_account" ref="chart4103"/>
</record>
<!-- 增值税 -->
<record id="vats" model="account.tax.template">

View File

@ -441,7 +441,6 @@
<field name="property_account_payable" ref="fr_pcg_pay"/>
<field name="property_account_expense_categ" ref="pcg_6071"/>
<field name="property_account_income_categ" ref="pcg_7071"/>
<field name="property_reserve_and_surplus_account" ref="pcg_120"/>
</record>
</data>

View File

@ -35,7 +35,6 @@
<field name="bank_account_view_id" ref="cta1101"/>
<field name="property_account_receivable" ref="cta110201"/>
<field name="property_account_payable" ref="cta210101"/>
<field name="property_reserve_and_surplus_account" ref="cta310103"/>
<field name="property_account_income_categ" ref="cta410101"/>
<field name="property_account_expense_categ" ref="cta510101"/>
</record>

View File

@ -21,7 +21,6 @@
<field name="bank_account_view_id" ref="cta1101"/>
<field name="property_account_receivable" ref="cta110201"/>
<field name="property_account_payable" ref="cta210101"/>
<field name="property_reserve_and_surplus_account" ref="cta310103"/>
<field name="property_account_income_categ" ref="cta410101"/>
<field name="property_account_expense_categ" ref="cta510101"/>
</record>

View File

@ -514,7 +514,6 @@
<field name="property_account_payable" ref="a215"/>
<field name="property_account_expense_categ" ref="a540"/>
<field name="property_account_income_categ" ref="a311"/>
<field name="property_reserve_and_surplus_account" ref="a260"/>
</record>

View File

@ -668,7 +668,6 @@
<field name="property_account_payable" ref="p21000"/>
<field name="property_account_expense_categ" ref="p41010"/>
<field name="property_account_income_categ" ref="p31010"/>
<field name="property_reserve_and_surplus_account" ref="p24600"/>
</record>
</data>

View File

@ -4102,7 +4102,6 @@
<field name="property_account_payable" ref="a_pay"/> <!-- crediteuren -->
<field name="property_account_expense_categ" ref="a_expense"/><!-- aankoop grondstoffen -->
<field name="property_account_income_categ" ref="a_sale"/> <!-- verkoop rekening -->
<field name="property_reserve_and_surplus_account" ref="a_9999"/>
</record>
<!-- BTW Template

View File

@ -1,2 +1,2 @@
"id","name","account_root_id:id","tax_code_root_id:id","bank_account_view_id:id","property_account_receivable:id","property_account_payable:id","property_account_expense_categ:id","property_account_income_categ:id","property_reserve_and_surplus_account:id"
"l10n_uk","UK Tax and Account Chart Template (by SmartMode)","UK0","0","1200","1100","2100","5000","4000","3200"
"id","name","account_root_id:id","tax_code_root_id:id","bank_account_view_id:id","property_account_receivable:id","property_account_payable:id","property_account_expense_categ:id","property_account_income_categ:id"
"l10n_uk","UK Tax and Account Chart Template (by SmartMode)","UK0","0","1200","1100","2100","5000","4000"

1 id name account_root_id:id tax_code_root_id:id bank_account_view_id:id property_account_receivable:id property_account_payable:id property_account_expense_categ:id property_account_income_categ:id property_reserve_and_surplus_account:id
2 l10n_uk UK Tax and Account Chart Template (by SmartMode) UK0 0 1200 1100 2100 5000 4000 3200

View File

@ -1895,7 +1895,6 @@
<field name="property_account_payable" ref="uy_code_21100"/>
<field name="property_account_income_categ" ref="uy_code_4100"/>
<field name="property_account_expense_categ" ref="uy_code_5100"/>
<field name="property_reserve_and_surplus_account" ref="uy_code_3313"/>
</record>