summaryrefslogtreecommitdiff
path: root/addons/analytic
diff options
context:
space:
mode:
authorHarry (OpenERP) <hmo@tinyerp.com>2012-11-30 10:52:40 +0530
committerHarry (OpenERP) <hmo@tinyerp.com>2012-11-30 10:52:40 +0530
commit5bf7ae99fff3c1933830c028d511ea6e864ad55e (patch)
treed54432699923f547e7391136fe7646290d9d38a7 /addons/analytic
parenteecf5b79c299f1b580eb3a9eb45791de1b32242b (diff)
parent69cb769ec5d70f80eaad3391b26870054f394145 (diff)
[MERGE]
bzr revid: hmo@tinyerp.com-20121130052240-ea7s4ufomjdbfq32
Diffstat (limited to 'addons/analytic')
-rw-r--r--addons/analytic/analytic.py11
-rw-r--r--addons/analytic/analytic_view.xml4
2 files changed, 11 insertions, 4 deletions
diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py
index 708f9b3b196..542acb1e88c 100644
--- a/addons/analytic/analytic.py
+++ b/addons/analytic/analytic.py
@@ -20,8 +20,10 @@
##############################################################################
import time
+from datetime import datetime
from osv import fields, osv
+import tools
from tools.translate import _
import decimal_precision as dp
@@ -199,9 +201,14 @@ class account_analytic_account(osv.osv):
return {}
res = {'value':{}}
template = self.browse(cr, uid, template_id, context=context)
- res['value']['date_start'] = template.date_start
- res['value']['date'] = template.date
+ if template.date_start and template.date:
+ from_dt = datetime.strptime(template.date_start, tools.DEFAULT_SERVER_DATE_FORMAT)
+ to_dt = datetime.strptime(template.date, tools.DEFAULT_SERVER_DATE_FORMAT)
+ timedelta = to_dt - from_dt
+ res['value']['date'] = datetime.strftime(datetime.now() + timedelta, tools.DEFAULT_SERVER_DATE_FORMAT)
+ res['value']['date_start'] = fields.date.today()
res['value']['quantity_max'] = template.quantity_max
+ res['value']['parent_id'] = template.parent_id and template.parent_id.id or False
res['value']['description'] = template.description
return res
diff --git a/addons/analytic/analytic_view.xml b/addons/analytic/analytic_view.xml
index 1277d25de71..0faca841a0f 100644
--- a/addons/analytic/analytic_view.xml
+++ b/addons/analytic/analytic_view.xml
@@ -26,10 +26,10 @@
<field name="currency_id" attrs="{'invisible': ['|',('type', '&lt;&gt;', 'view'), ('company_id', '&lt;&gt;', False)]}"/>
</group>
<group>
- <field name="code"/>
<field name="type" invisible="context.get('default_type', False)"/>
- <field name="parent_id" on_change="on_change_parent(parent_id)" attrs="{'invisible': [('type','in',['contract','template'])]}"/>
<field name="template_id" on_change="on_change_template(template_id,context)" domain="[('type','=','template')]" attrs="{'invisible': [('type','in',['view', 'normal','template'])]}" context="{'default_type' : 'template'}"/>
+ <field name="code"/>
+ <field name="parent_id" on_change="on_change_parent(parent_id)" attrs="{'invisible': [('type','in',['contract'])]}"/>
<field name="company_id" on_change="on_change_company(company_id)" widget="selection" groups="base.group_multi_company" attrs="{'required': [('type','&lt;&gt;','view')]}"/>
</group>
</group>