diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py index 7b0723ca07f..e3332d15ca0 100644 --- a/addons/account/account_analytic_line.py +++ b/addons/account/account_analytic_line.py @@ -55,7 +55,16 @@ class account_analytic_line(osv.osv): else: result[rec.id] = False return result - + + def _get_account_line(self, cr, uid, ids, context={}): + aac_ids = {} + for acc in self.pool.get('account.analytic.account').browse(cr, uid, ids): + aac_ids[acc.id] = True + aal_ids = [] + if aac_ids: + aal_ids = self.pool.get('account.analytic.line').search(cr, uid, [('account_id','in',aac_ids.keys())], context=context) + return aal_ids + _columns = { 'name' : fields.char('Description', size=256, required=True), 'date' : fields.date('Date', required=True), @@ -70,13 +79,17 @@ class account_analytic_line(osv.osv): 'code' : fields.char('Code', size=8), 'user_id' : fields.many2one('res.users', 'User',), 'ref': fields.char('Ref.', size=32), - 'currency_id': fields.function(_get_account_currency, method=True, type='many2one', relation='res.currency', string='Currency', - store=True, help="The related account currency if not equal to the company one."), + 'currency_id': fields.function(_get_account_currency, method=True, type='many2one', relation='res.currency', string='Account currency', + store={ + 'account.analytic.account': (_get_account_line, ['company_id'], 50), + }, + help="The related account currency if not equal to the company one."), 'company_id': fields.many2one('res.company','Company',required=True), 'amount_currency': fields.function(_amount_currency, method=True, digits=(16, int(config['price_accuracy'])), string='Amount currency', - store=True, - help="The amount expressed in the related account currency if not equal to the company one.", - ), + store={ + 'account.analytic.account': (_get_account_line, ['company_id'], 50), + }, + help="The amount expressed in the related account currency if not equal to the company one.",), } _defaults = { diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index 8876928caa6..425cde301d3 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -183,7 +183,10 @@ class account_analytic_account(osv.osv): and amount_currency<0 \ GROUP BY account_analytic_line.account_id"""%acc_set) for account_id, sum in cr.fetchall(): - res[account_id] += round(sum,2) + if res.has_key(account_id): + res[account_id] += round(sum,2) + else: + res[account_id] = round(sum,2) for obj_id in ids: res.setdefault(obj_id, 0.0) for child_id in self.search(cr, uid, diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index be0b8c4ccad..2a44dc4c5f8 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -52,15 +52,15 @@ class account_analytic_account(osv.osv): res[id] = round(res.get(id, 0.0),2) return res - def _get_account_currency(self, cr, uid, ids, field_name, arg, context={}): - result=super(account_analytic_account, self)._get_account_currency(cr, uid, ids, field_name, arg, context) - for rec in self.browse(cr, uid, ids, context): - result[rec.id] = rec.pricelist_id and (rec.pricelist_id.currency_id.id,rec.pricelist_id.currency_id.code) or result[rec.id] - return result + # def _get_account_currency(self, cr, uid, ids, field_name, arg, context={}): + # result=super(account_analytic_account, self)._get_account_currency(cr, uid, ids, field_name, arg, context) + # for rec in self.browse(cr, uid, ids, context): + # result[rec.id] = rec.pricelist_id and (rec.pricelist_id.currency_id.id,rec.pricelist_id.currency_id.code) or result[rec.id] + # return result _inherit = "account.analytic.account" _columns = { - 'currency_id': fields.function(_get_account_currency, method=True, type='many2one', relation='res.currency', string='Account currency', store=True), + # 'currency_id': fields.function(_get_account_currency, method=True, type='many2one', relation='res.currency', string='Account currency', store=True), 'pricelist_id' : fields.many2one('product.pricelist', 'Sale Pricelist'), 'amount_max': fields.float('Max. Invoice Price'), 'amount_invoiced': fields.function(_invoiced_calc, method=True, string='Invoiced Amount', diff --git a/addons/multi_company/multi_company_demo.xml b/addons/multi_company/multi_company_demo.xml index 7f18b7edd86..292cae0a0b5 100644 --- a/addons/multi_company/multi_company_demo.xml +++ b/addons/multi_company/multi_company_demo.xml @@ -1,6 +1,24 @@ + + + + + Valuation Pricelist USD + valuation + + + + + Default Valuation Pricelist Version USD + + + + + Default Valuation Pricelist Line USD + + OpenERP Corp. @@ -29,26 +47,32 @@ OpenERP Editor + OpenERP US + + OpenERP BE + OpenERP IN OpenERP IN + Odoo +