diff --git a/addons/account/account.py b/addons/account/account.py index 46cfaf645a8..fa2b10a7478 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -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: diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index d98b53ebbbd..b0c73c132d5 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -2171,7 +2171,6 @@ - diff --git a/addons/account/company.py b/addons/account/company.py index 1ec9b8c55da..409216f29f0 100644 --- a/addons/account/company.py +++ b/addons/account/company.py @@ -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 = { diff --git a/addons/account/company_view.xml b/addons/account/company_view.xml index 447622b57c5..d5ab6d7753a 100644 --- a/addons/account/company_view.xml +++ b/addons/account/company_view.xml @@ -15,18 +15,5 @@ - - res.company.form.inherit - - res.company - - - - - - - - - diff --git a/addons/account/data/configurable_account_chart.xml b/addons/account/data/configurable_account_chart.xml index b8b23344ff3..eca52109597 100644 --- a/addons/account/data/configurable_account_chart.xml +++ b/addons/account/data/configurable_account_chart.xml @@ -381,7 +381,6 @@ - diff --git a/addons/account/demo/account_minimal.xml b/addons/account/demo/account_minimal.xml index 8f858491edc..984711eceef 100644 --- a/addons/account/demo/account_minimal.xml +++ b/addons/account/demo/account_minimal.xml @@ -304,14 +304,6 @@ - - property_account_receivable - - - - - - diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py index d4362484588..00d5e520c42 100644 --- a/addons/account/report/account_invoice_report.py +++ b/addons/account/report/account_invoice_report.py @@ -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, diff --git a/addons/account/report/account_invoice_report_view.xml b/addons/account/report/account_invoice_report_view.xml index 13a137e53df..e352a33d850 100644 --- a/addons/account/report/account_invoice_report_view.xml +++ b/addons/account/report/account_invoice_report_view.xml @@ -28,8 +28,8 @@ - - + + @@ -42,7 +42,7 @@ - + diff --git a/addons/account/res_config_view.xml b/addons/account/res_config_view.xml index 0e4b1fa64c4..728eefe8078 100644 --- a/addons/account/res_config_view.xml +++ b/addons/account/res_config_view.xml @@ -121,7 +121,7 @@