summaryrefslogtreecommitdiff
path: root/addons/analytic
diff options
context:
space:
mode:
authoruco (OpenERP) <uco@tinyerp.com>2010-12-30 11:37:53 +0530
committeruco (OpenERP) <uco@tinyerp.com>2010-12-30 11:37:53 +0530
commite0416f8a8fb82174fdaafdbf4bb6dfced55a2b04 (patch)
tree5d46c1dd0eb72bf230a4bcbf9d7980ada4c8fd51 /addons/analytic
parentc3098f4f437708c7b2d6d4a52cd02950c5b67f31 (diff)
parentb352cf0e20d1e17f4cdbd93c3c388fc0004ea50a (diff)
[MERGE]
bzr revid: uco@tinyerp.com-20101230060753-wujam7otb5f13f0z
Diffstat (limited to 'addons/analytic')
-rw-r--r--addons/analytic/analytic.py33
-rw-r--r--addons/analytic/i18n/el.po21
-rw-r--r--addons/analytic/i18n/es.po4
3 files changed, 44 insertions, 14 deletions
diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py
index f87df6200d6..a94d1a36a9d 100644
--- a/addons/analytic/analytic.py
+++ b/addons/analytic/analytic.py
@@ -30,11 +30,15 @@ class account_analytic_account(osv.osv):
def _compute_level_tree(self, cr, uid, ids, child_ids, res, field_names, context=None):
def recursive_computation(account_id, res):
+ currency_obj = self.pool.get('res.currency')
account = self.browse(cr, uid, account_id)
for son in account.child_ids:
res = recursive_computation(son.id, res)
for field in field_names:
- res[account.id][field] += res[son.id][field]
+ if account.currency_id.id == son.currency_id.id:
+ res[account.id][field] += res[son.id][field]
+ else:
+ res[account.id][field] += currency_obj.compute(cr, uid, son.currency_id.id, account.currency_id.id, res[son.id][field], context=context)
return res
for account in self.browse(cr, uid, ids, context=context):
if account.id not in child_ids:
@@ -125,7 +129,7 @@ class account_analytic_account(osv.osv):
'user_id': fields.many2one('res.users', 'Account Manager'),
'date_start': fields.date('Date Start'),
'date': fields.date('Date End'),
- 'company_id': fields.many2one('res.company', 'Company', required=True),
+ 'company_id': fields.many2one('res.company', 'Company', required=False), #not required because we want to allow different companies to use the same chart of account, except for leaf accounts.
'state': fields.selection([('draft','Draft'),('open','Open'), ('pending','Pending'),('cancelled', 'Cancelled'),('close','Closed'),('template', 'Template')], 'State', required=True,
help='* When an account is created its in \'Draft\' state.\
\n* If any associated partner is there, it can be in \'Open\' state.\
@@ -133,7 +137,7 @@ class account_analytic_account(osv.osv):
\n* And finally when all the transactions are over, it can be in \'Close\' state. \
\n* The project can be in either if the states \'Template\' and \'Running\'.\n If it is template then we can make projects based on the template projects. If its in \'Running\' state it is a normal project.\
\n If it is to be reviewed then the state is \'Pending\'.\n When the project is completed the state is set to \'Done\'.'),
- 'currency_id': fields.related('company_id', 'currency_id', type='many2one', relation='res.currency', string='Account currency', store=True, readonly=True),
+ 'currency_id': fields.many2one('res.currency', 'Account currency', required=True),
}
def _default_company(self, cr, uid, context=None):
@@ -142,6 +146,10 @@ class account_analytic_account(osv.osv):
return user.company_id.id
return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
+ def _get_default_currency(self, cr, uid, context=None):
+ user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
+ return user.company_id.currency_id.id
+
_defaults = {
'type': 'normal',
'company_id': _default_company,
@@ -149,15 +157,24 @@ class account_analytic_account(osv.osv):
'user_id': lambda self, cr, uid, ctx: uid,
'partner_id': lambda self, cr, uid, ctx: ctx.get('partner_id', False),
'contact_id': lambda self, cr, uid, ctx: ctx.get('contact_id', False),
- 'date_start': lambda *a: time.strftime('%Y-%m-%d')
+ 'date_start': lambda *a: time.strftime('%Y-%m-%d'),
+ 'currency_id': _get_default_currency,
}
+ def check_currency(self, cr, uid, ids, context=None):
+ obj = self.browse(cr, uid, ids[0], context=context)
+ if obj.company_id:
+ if obj.currency_id.id != self.pool.get('res.company').browse(cr, uid, obj.company_id.id, context=context).currency_id.id:
+ return False
+ return True
+
def check_recursion(self, cr, uid, ids, parent=None):
return super(account_analytic_account, self)._check_recursion(cr, uid, ids, parent=parent)
_order = 'date_start desc,parent_id desc,code'
_constraints = [
- (check_recursion, 'Error! You can not create recursive analytic accounts.', ['parent_id'])
+ (check_recursion, 'Error! You can not create recursive analytic accounts.', ['parent_id']),
+ (check_currency, 'Error! The currency has to be the same as the currency of the selected company', ['currency_id', 'company_id']),
]
def copy(self, cr, uid, id, default=None, context=None):
@@ -167,6 +184,12 @@ class account_analytic_account(osv.osv):
default['line_ids'] = []
return super(account_analytic_account, self).copy(cr, uid, id, default, context=context)
+ def on_change_company(self, cr, uid, id, company_id):
+ if not company_id:
+ return {}
+ currency = self.pool.get('res.company').read(cr, uid, [company_id], ['currency_id'])[0]['currency_id']
+ return {'value': {'currency_id': currency}}
+
def on_change_parent(self, cr, uid, id, parent_id):
if not parent_id:
return {}
diff --git a/addons/analytic/i18n/el.po b/addons/analytic/i18n/el.po
index 0bab19b40d6..ef1eef949f3 100644
--- a/addons/analytic/i18n/el.po
+++ b/addons/analytic/i18n/el.po
@@ -8,13 +8,13 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2010-12-21 19:43+0000\n"
-"PO-Revision-Date: 2010-10-23 07:01+0000\n"
-"Last-Translator: OpenERP Administrators <Unknown>\n"
+"PO-Revision-Date: 2010-12-28 17:18+0000\n"
+"Last-Translator: Dimitris Andavoglou <dimitrisand@gmail.com>\n"
"Language-Team: Greek <el@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-12-24 05:53+0000\n"
+"X-Launchpad-Export-Date: 2010-12-29 04:57+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: analytic
@@ -30,7 +30,7 @@ msgstr "Όνομα λογαριασμού"
#. module: analytic
#: help:account.analytic.line,unit_amount:0
msgid "Specifies the amount of quantity to count."
-msgstr ""
+msgstr "Καθορίζει την επιμετρούμενη ποσότητα"
#. module: analytic
#: model:ir.module.module,description:analytic.module_meta_information
@@ -38,6 +38,8 @@ msgid ""
"Module for defining analytic accounting object.\n"
" "
msgstr ""
+"Άρθρωμα προς ορισμό αντικειμένου αναλυτικής λογιστικής\n"
+" "
#. module: analytic
#: field:account.analytic.account,state:0
@@ -101,7 +103,7 @@ msgstr "Εκκρεμεί"
#. module: analytic
#: model:ir.model,name:analytic.model_account_analytic_line
msgid "Analytic Line"
-msgstr ""
+msgstr "Γραμμή Αναλυτικής"
#. module: analytic
#: field:account.analytic.account,description:0
@@ -143,7 +145,7 @@ msgstr "Ημερομηνία"
#. module: analytic
#: field:account.analytic.account,currency_id:0
msgid "Account currency"
-msgstr ""
+msgstr "Νόμισμα Λογαριασμού"
#. module: analytic
#: field:account.analytic.account,quantity:0
@@ -157,11 +159,14 @@ msgid ""
"Calculated by multiplying the quantity and the price given in the Product's "
"cost price. Always expressed in the company main currency."
msgstr ""
+"Υπολογίστηκε πολλαπλασιάζοντας τη νποσότητα επί την τιμή που προκύπτει από "
+"την τιμή κόστους του πίνακα Προϊόντων. Πάντα εκφράζεται στο κύριο νόμισμα "
+"της εταιρείας."
#. module: analytic
#: help:account.analytic.account,quantity_max:0
msgid "Sets the higher limit of quantity of hours."
-msgstr ""
+msgstr "Θέτει τα ανώτατα όρια των ωρών"
#. module: analytic
#: field:account.analytic.account,credit:0
@@ -199,6 +204,8 @@ msgid ""
"If you select the View Type, it means you won't allow to create journal "
"entries using that account."
msgstr ""
+"Εαν επιλέξετε Προβολή Τύπου, αυτό σημαίνει ότι δεν θα επιτρέπετε την "
+"δημιουργία εγγραφών ημερολογίου χρησιμοποιόντας αυτόν τον λογαριασμό."
#. module: analytic
#: field:account.analytic.account,date:0
diff --git a/addons/analytic/i18n/es.po b/addons/analytic/i18n/es.po
index 5f5a01a8fe6..bd6b2c2a802 100644
--- a/addons/analytic/i18n/es.po
+++ b/addons/analytic/i18n/es.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2010-12-21 19:43+0000\n"
-"PO-Revision-Date: 2010-12-26 20:17+0000\n"
+"PO-Revision-Date: 2010-12-27 09:11+0000\n"
"Last-Translator: Jordi Esteve (www.zikzakmedia.com) "
"<jesteve@zikzakmedia.com>\n"
"Language-Team: Spanish <es@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-12-27 04:40+0000\n"
+"X-Launchpad-Export-Date: 2010-12-28 04:43+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: analytic