From c1e2afebe8f3eea7f08dd39dfb1840f0bb867cef Mon Sep 17 00:00:00 2001
From: "tfr@openerp.com" <>
Date: Fri, 8 Jul 2011 14:06:28 +0200
Subject: [PATCH 01/64] [FIX] cannot open from of task when project caldav is
installed
bzr revid: tfr@openerp.com-20110708120628-i6eyl0kdpkgt2ara
---
addons/project_caldav/project_caldav.py | 2 +-
addons/project_caldav/project_caldav_view.xml | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/addons/project_caldav/project_caldav.py b/addons/project_caldav/project_caldav.py
index ada89d35e69..c0f780dfc57 100644
--- a/addons/project_caldav/project_caldav.py
+++ b/addons/project_caldav/project_caldav.py
@@ -42,11 +42,11 @@ class project_task(osv.osv):
help='If the task is created the state is \'Draft\'.\n If the task is started, the state becomes \'In Progress\'.\n If review is needed the task is in \'Pending\' state.\
\n If the task is over, the states is set to \'Done\'.'),
}
+
_defaults = {
'state': 'draft',
}
-
def open_task(self, cr, uid, ids, context=None):
"""
Open Task Form for Project Task.
diff --git a/addons/project_caldav/project_caldav_view.xml b/addons/project_caldav/project_caldav_view.xml
index d27a4474fc9..f361dc9580b 100644
--- a/addons/project_caldav/project_caldav_view.xml
+++ b/addons/project_caldav/project_caldav_view.xml
@@ -66,8 +66,7 @@
-
+
From 461e41910255a1366270cd8e54d263b267c299de Mon Sep 17 00:00:00 2001
From: "tfr@openerp.com" <>
Date: Fri, 8 Jul 2011 15:12:03 +0200
Subject: [PATCH 02/64] [FIX] event.todo don't erase project.task column
anymore
bzr revid: tfr@openerp.com-20110708131203-o9cduv00he161ahl
---
addons/project_caldav/project_caldav.py | 2 +-
addons/project_caldav/project_caldav_view.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/addons/project_caldav/project_caldav.py b/addons/project_caldav/project_caldav.py
index c0f780dfc57..f17ef3050d4 100644
--- a/addons/project_caldav/project_caldav.py
+++ b/addons/project_caldav/project_caldav.py
@@ -28,7 +28,7 @@ from project.project import task as base_project_task
class project_task(osv.osv):
_name = "project.task"
- _inherit = ["calendar.todo", "project.task"]
+ _inherit = ["project.task", "calendar.todo"]
_columns = {
# force inherit from project.project_task so that
# calendar.todo.active is masked oute
diff --git a/addons/project_caldav/project_caldav_view.xml b/addons/project_caldav/project_caldav_view.xml
index f361dc9580b..57e9e75a53b 100644
--- a/addons/project_caldav/project_caldav_view.xml
+++ b/addons/project_caldav/project_caldav_view.xml
@@ -66,7 +66,7 @@
-
+
From a2dcc919cea8e2bce788ab656c4d6674f2a67490 Mon Sep 17 00:00:00 2001
From: "tfr@openerp.com" <>
Date: Fri, 8 Jul 2011 15:35:02 +0200
Subject: [PATCH 03/64] [CLEAN] clean recurrent option view in task, but
deactivate reccurency for task in openerp since it's not well implemented
bzr revid: tfr@openerp.com-20110708133502-gqdovbyhm717xdgx
---
addons/project_caldav/project_caldav_view.xml | 64 +++++++++++--------
1 file changed, 38 insertions(+), 26 deletions(-)
diff --git a/addons/project_caldav/project_caldav_view.xml b/addons/project_caldav/project_caldav_view.xml
index 57e9e75a53b..0d566be4619 100644
--- a/addons/project_caldav/project_caldav_view.xml
+++ b/addons/project_caldav/project_caldav_view.xml
@@ -65,7 +65,8 @@
form
-
+
+
@@ -78,46 +79,57 @@
form
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
-
-
+
+
-
+
+
-
+
-
-
+
+
-
-
-
-
-
-
+
+
+
+
From 7c75f19da5e025fd7971d10c233c1c5a45037158 Mon Sep 17 00:00:00 2001
From: "tfr@openerp.com" <>
Date: Fri, 8 Jul 2011 17:35:07 +0200
Subject: [PATCH 04/64] [FIX] creation of todo
bzr revid: tfr@openerp.com-20110708153507-0old9j33jus9grmc
---
addons/base_calendar/base_calendar.py | 3 +--
addons/caldav/caldav_node.py | 2 +-
addons/project_caldav/project_caldav.py | 2 ++
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py
index 5f24b08884a..e50bb52abd9 100644
--- a/addons/base_calendar/base_calendar.py
+++ b/addons/base_calendar/base_calendar.py
@@ -1208,7 +1208,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
def remove_virtual_id(self, ids):
- if isinstance(ids, (str, int)):
+ if isinstance(ids, (str, int, long)):
return base_calendar_id2real_id(ids)
if isinstance(ids, (list, tuple)):
@@ -1239,7 +1239,6 @@ rule or repeating pattern of time to exclude from the recurring rule."),
if until_date:
continue
until_date = arg[2]
-
res = super(calendar_event, self).search(cr, uid, args_without_date, \
0, 0, order, context, count=False)
res = self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit, context=context)
diff --git a/addons/caldav/caldav_node.py b/addons/caldav/caldav_node.py
index 5272d0fc1fd..71e9bdc2468 100644
--- a/addons/caldav/caldav_node.py
+++ b/addons/caldav/caldav_node.py
@@ -324,7 +324,6 @@ class node_calendar(nodes.node_class):
uid = self.context.uid
res = self.set_data(cr, data)
-
if res and len(res):
# We arbitrarily construct only the first node of the data
# that have been imported. ICS may have had more elements,
@@ -332,6 +331,7 @@ class node_calendar(nodes.node_class):
assert isinstance(res[0], (int, long))
fnodes = fil_obj.get_calendar_objects(cr, uid, [self.calendar_id], self,
domain=[('id','=',res[0])], context=ctx)
+
if self.context.get('DAV-client','') in ('iPhone', 'iCalendar',):
# For those buggy clients, register the alias
bca_obj = fil_obj.pool.get('basic.calendar.alias')
diff --git a/addons/project_caldav/project_caldav.py b/addons/project_caldav/project_caldav.py
index f17ef3050d4..782f167d69b 100644
--- a/addons/project_caldav/project_caldav.py
+++ b/addons/project_caldav/project_caldav.py
@@ -109,6 +109,8 @@ class project_task(osv.osv):
self.write(cr, uid, [exists], val)
ids.append(exists)
else:
+ #set user_id with id, needed later
+ val.update({'user_id' : uid})
task_id = self.create(cr, uid, val)
ids.append(task_id)
return ids
From aedeaadb4663a57e0ee9c45b7b372d5bae000946 Mon Sep 17 00:00:00 2001
From: "tfr@openerp.com" <>
Date: Mon, 11 Jul 2011 14:20:55 +0200
Subject: [PATCH 05/64] [FIX] caldav write_date problem + attendees
synchronization
bzr revid: tfr@openerp.com-20110711122055-63syh4xflmko9ajb
---
addons/caldav/calendar.py | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/addons/caldav/calendar.py b/addons/caldav/calendar.py
index a70a31bc017..94d28e4ad37 100644
--- a/addons/caldav/calendar.py
+++ b/addons/caldav/calendar.py
@@ -121,10 +121,10 @@ def str2mailto(emailstr, multi=False):
for mas in mailz:
m = mege.match(mas.strip())
if not m:
- # one of the rare non-matching strings is "sad" :(
- # retz.append({ 'name': mas.strip() })
- # continue
- raise ValueError("Invalid email address %r" % mas)
+ #one of the rare non-matching strings is "sad" :(
+ retz.append({ 'name': mas.strip() })
+ continue
+ # raise ValueError("Invalid email address %r" % mas)
rd = { 'name': m.group(1).strip(),
'email': m.group(5), }
if m.group(2):
@@ -189,6 +189,9 @@ def map_data(cr, uid, obj, context=None):
field = obj.ical_get(map_dict, 'field')
field_type = obj.ical_get(map_dict, 'type')
if field:
+ #ignore write date, this field is resered for the orm
+ if field == 'write_date':
+ continue
if field_type == 'selection':
if not map_val:
continue
@@ -299,7 +302,6 @@ class CalDAV(object):
att_data = []
exdates = []
_server_tzinfo = pytz.timezone(tools.get_server_timezone())
-
for cal_data in child.getChildren():
if cal_data.name.lower() == 'organizer':
dmail = { 'name': cal_data.params.get('CN', ['',])[0],
@@ -552,7 +554,7 @@ class CalDAV(object):
@param data_id: Get Data’s ID or False
@param context: A standard dictionary for contextual values
"""
-
+
ical_data = content
self.__attribute__ = get_attribute_mapping(cr, uid, self._calname, context)
parsedCal = vobject.readOne(ical_data)
From 0a583564912137386a36da42c5fefb651add8ee9 Mon Sep 17 00:00:00 2001
From: "tfr@openerp.com" <>
Date: Mon, 11 Jul 2011 17:51:29 +0200
Subject: [PATCH 06/64] [IMP] in progress translate rrule into openerp data
bzr revid: tfr@openerp.com-20110711155129-jjhuvaby3m5eryuu
---
addons/base_calendar/base_calendar.py | 80 ++++++++++++++++++++++++++-
1 file changed, 77 insertions(+), 3 deletions(-)
diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py
index e50bb52abd9..dfa898c633f 100644
--- a/addons/base_calendar/base_calendar.py
+++ b/addons/base_calendar/base_calendar.py
@@ -991,14 +991,80 @@ class calendar_event(osv.osv):
"""
result = {}
+ if not isinstance(ids, list):
+ ids = [ids]
+
for datas in self.read(cr, uid, ids, ['id','byday','recurrency', 'month_list','end_date', 'rrule_type', 'select1', 'interval', 'count', 'end_type', 'mo', 'tu', 'we', 'th', 'fr', 'sa', 'su', 'exrule', 'day', 'week_list' ], context=context):
event = datas['id']
if datas.get('interval', 0) < 0:
raise osv.except_osv(_('Warning!'), _('Interval can not be Negative'))
if datas.get('count', 0) < 0:
raise osv.except_osv(_('Warning!'), _('Count can not be Negative'))
- result[event] = self.compute_rule_string(datas)
+ if datas['recurrency']:
+ result[event] = self.compute_rule_string(datas)
+ else:
+ result[event] = ""
return result
+
+ def _parse_rrule(self, rule, data):
+ day_list = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su']
+ r = rrule.rrulestr(rule)
+ data['count'] = r._count
+ data['interval'] = r._interval
+ data['end_date'] = r._until and r._until.strftime("%Y-%m-%d %H:%M:%S")
+ #repeat weekly
+ if r._byweekday:
+ for i in xrange(0,7):
+ if i in r._byweekday:
+ data[day_list[i]] = True
+ data['rrule_type'] = 'weekly'
+ #repeat monthly bynweekday ((weekday, weeknumber), )
+ if r._bynweekday:
+ data['week_list'] = day_list[r._bynweekday[0][0]].upper()
+ data['byday'] = r._bynweekday[0][1]
+ data['rrule_type'] = 'monthly'
+
+ #end of recurrence
+ #in case of repeat for ever that we do not support right now
+ if not (data.get('count') or data.get('end_date')):
+ data['count'] = 100
+ if data.get('count'):
+ data['end_type'] = 'count'
+ else:
+ data['end_type'] = 'end_date'
+ return data
+
+ def _write_rrule(self, cr, uid, ids, field_name, field_value, arg, context):
+ print field_name, field_value
+ data = {
+ 'byday' : False,
+ 'recurrency' : False,
+ 'month_list' : False,
+ 'end_date' : False,
+ 'rrule_type' : False,
+ 'select1' : False,
+ 'interval' : 0,
+ 'count' : False,
+ 'end_type' : False,
+ 'mo' : False,
+ 'tu' : False,
+ 'we' : False,
+ 'th' : False,
+ 'fr' : False,
+ 'sa' : False,
+ 'su' : False,
+ 'exrule' : False,
+ 'day' : False,
+ 'week_list' : False
+ }
+
+ if field_value:
+ update_data = self._parse_rrule(field_value, dict(data))
+ print update_data
+ #parse_rrule
+ self.write(cr, uid, ids, data, context=context)
+
+ print "rrule", self._get_rulestring(cr, uid, ids, None, arg, context)
_columns = {
'id': fields.integer('ID'),
@@ -1022,7 +1088,7 @@ class calendar_event(osv.osv):
defines the list of date/time exceptions for a recurring calendar component."),
'exrule': fields.char('Exception Rule', size=352, help="Defines a \
rule or repeating pattern of time to exclude from the recurring rule."),
- 'rrule': fields.function(_get_rulestring, type='char', size=124, \
+ 'rrule': fields.function(_get_rulestring, fnct_inv=_write_rrule, type='char', size=124, \
store=True, string='Recurrent Rule'),
'rrule_type': fields.selection([('none', ''), ('daily', 'Daily'), \
('weekly', 'Weekly'), ('monthly', 'Monthly'), \
@@ -1173,7 +1239,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
@param self: the object pointer
@param datas: dictionary of freq and interval value.
"""
-
+ print "compute rule string"
def get_week_string(freq, datas):
weekdays = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su']
if freq == 'weekly':
@@ -1277,6 +1343,8 @@ rule or repeating pattern of time to exclude from the recurring rule."),
except Exception:
return True
+
+
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
if context is None:
context = {}
@@ -1284,6 +1352,9 @@ rule or repeating pattern of time to exclude from the recurring rule."),
select = [ids]
else:
select = ids
+
+
+
new_ids = []
res = False
for event_id in select:
@@ -1335,6 +1406,9 @@ rule or repeating pattern of time to exclude from the recurring rule."),
context=context)
vals.update(updated_vals.get('value', {}))
if new_ids:
+ if 'rrule' in vals.keys():
+ print "write, rrule"
+ print "write ", vals
res = super(calendar_event, self).write(cr, uid, new_ids, vals, context=context)
if ('alarm_id' in vals or 'base_calendar_alarm_id' in vals)\
From 842b67f5b095a11c2185307102eba11e2e7ceeae Mon Sep 17 00:00:00 2001
From: "tfr@openerp.com" <>
Date: Tue, 12 Jul 2011 12:03:12 +0200
Subject: [PATCH 07/64] [IMP] support caldav recurrency
bzr revid: tfr@openerp.com-20110712100312-lj0uib1rnx90dbhc
---
addons/base_calendar/base_calendar.py | 155 +++++++++++++++-----------
1 file changed, 92 insertions(+), 63 deletions(-)
diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py
index dfa898c633f..1e71ea65634 100644
--- a/addons/base_calendar/base_calendar.py
+++ b/addons/base_calendar/base_calendar.py
@@ -1006,66 +1006,9 @@ class calendar_event(osv.osv):
result[event] = ""
return result
- def _parse_rrule(self, rule, data):
- day_list = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su']
- r = rrule.rrulestr(rule)
- data['count'] = r._count
- data['interval'] = r._interval
- data['end_date'] = r._until and r._until.strftime("%Y-%m-%d %H:%M:%S")
- #repeat weekly
- if r._byweekday:
- for i in xrange(0,7):
- if i in r._byweekday:
- data[day_list[i]] = True
- data['rrule_type'] = 'weekly'
- #repeat monthly bynweekday ((weekday, weeknumber), )
- if r._bynweekday:
- data['week_list'] = day_list[r._bynweekday[0][0]].upper()
- data['byday'] = r._bynweekday[0][1]
- data['rrule_type'] = 'monthly'
-
- #end of recurrence
- #in case of repeat for ever that we do not support right now
- if not (data.get('count') or data.get('end_date')):
- data['count'] = 100
- if data.get('count'):
- data['end_type'] = 'count'
- else:
- data['end_type'] = 'end_date'
- return data
+
+
- def _write_rrule(self, cr, uid, ids, field_name, field_value, arg, context):
- print field_name, field_value
- data = {
- 'byday' : False,
- 'recurrency' : False,
- 'month_list' : False,
- 'end_date' : False,
- 'rrule_type' : False,
- 'select1' : False,
- 'interval' : 0,
- 'count' : False,
- 'end_type' : False,
- 'mo' : False,
- 'tu' : False,
- 'we' : False,
- 'th' : False,
- 'fr' : False,
- 'sa' : False,
- 'su' : False,
- 'exrule' : False,
- 'day' : False,
- 'week_list' : False
- }
-
- if field_value:
- update_data = self._parse_rrule(field_value, dict(data))
- print update_data
- #parse_rrule
- self.write(cr, uid, ids, data, context=context)
-
- print "rrule", self._get_rulestring(cr, uid, ids, None, arg, context)
-
_columns = {
'id': fields.integer('ID'),
'sequence': fields.integer('Sequence'),
@@ -1088,7 +1031,7 @@ class calendar_event(osv.osv):
defines the list of date/time exceptions for a recurring calendar component."),
'exrule': fields.char('Exception Rule', size=352, help="Defines a \
rule or repeating pattern of time to exclude from the recurring rule."),
- 'rrule': fields.function(_get_rulestring, fnct_inv=_write_rrule, type='char', size=124, \
+ 'rrule': fields.function(_get_rulestring, type='char', size=124, \
store=True, string='Recurrent Rule'),
'rrule_type': fields.selection([('none', ''), ('daily', 'Daily'), \
('weekly', 'Weekly'), ('monthly', 'Monthly'), \
@@ -1239,7 +1182,6 @@ rule or repeating pattern of time to exclude from the recurring rule."),
@param self: the object pointer
@param datas: dictionary of freq and interval value.
"""
- print "compute rule string"
def get_week_string(freq, datas):
weekdays = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su']
if freq == 'weekly':
@@ -1271,7 +1213,85 @@ rule or repeating pattern of time to exclude from the recurring rule."),
return ''
interval_srting = datas.get('interval') and (';INTERVAL=' + str(datas.get('interval'))) or ''
return 'FREQ=' + freq.upper() + get_week_string(freq, datas) + interval_srting + get_end_date(datas) + get_month_string(freq, datas)
+
+ def _get_empty_rrule_data(self):
+ return {
+ 'byday' : False,
+ 'recurrency' : False,
+ 'end_date' : False,
+ 'rrule_type' : False,
+ 'select1' : False,
+ 'interval' : 0,
+ 'count' : False,
+ 'end_type' : False,
+ 'mo' : False,
+ 'tu' : False,
+ 'we' : False,
+ 'th' : False,
+ 'fr' : False,
+ 'sa' : False,
+ 'su' : False,
+ 'exrule' : False,
+ 'day' : False,
+ 'week_list' : False
+ }
+ def _write_rrule(self, cr, uid, ids, field_value, rule_date=False, context=None):
+ data = self._get_empty_rrule_data()
+
+ if field_value:
+ data['recurrency'] = True
+ for event in self.browse(cr, uid, ids, context=context):
+ rdate = rule_date or event.date
+ update_data = self._parse_rrule(field_value, dict(data), rdate)
+ data.update(update_data)
+ #parse_rrule
+ self.write(cr, uid, event.id, data, context=context)
+
+
+ def _parse_rrule(self, rule, data, date_start):
+ day_list = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su']
+ rrule_type = ['yearly', 'monthly', 'weekly', 'daily']
+ r = rrule.rrulestr(rule, dtstart=datetime.strptime(date_start, "%Y-%m-%d %H:%M:%S"))
+
+ if r._freq > 0 and r._freq < 4:
+ data['rrule_type'] = rrule_type[r._freq]
+
+ data['count'] = r._count
+ data['interval'] = r._interval
+ data['end_date'] = r._until and r._until.strftime("%Y-%m-%d %H:%M:%S")
+ #repeat weekly
+ if r._byweekday:
+ for i in xrange(0,7):
+ if i in r._byweekday:
+ data[day_list[i]] = True
+ data['rrule_type'] = 'weekly'
+ #repeat monthly bynweekday ((weekday, weeknumber), )
+ if r._bynweekday:
+ data['week_list'] = day_list[r._bynweekday[0][0]].upper()
+ data['byday'] = r._bynweekday[0][1]
+ data['select1'] = 'day'
+ data['rrule_type'] = 'monthly'
+
+ if r._bymonthday:
+ data['day'] = r._bymonthday[0]
+ data['select1'] = 'date'
+ data['rrule_type'] = 'monthly'
+
+ #yearly but for openerp it's monthly, take same information as monthly but interval is 12 times
+ if r._bymonth:
+ data['interval'] = data['interval'] * 12
+
+ #FIXEME handle forever case
+ #end of recurrence
+ #in case of repeat for ever that we do not support right now
+ if not (data.get('count') or data.get('end_date')):
+ data['count'] = 100
+ if data.get('count'):
+ data['end_type'] = 'count'
+ else:
+ data['end_type'] = 'end_date'
+ return data
def remove_virtual_id(self, ids):
if isinstance(ids, (str, int, long)):
@@ -1407,8 +1427,12 @@ rule or repeating pattern of time to exclude from the recurring rule."),
vals.update(updated_vals.get('value', {}))
if new_ids:
if 'rrule' in vals.keys():
- print "write, rrule"
- print "write ", vals
+ if 'date' in vals.keys():
+ date_to_write = vals['date']
+ else:
+ date_to_write = False
+ self._write_rrule(cr, uid, new_ids, vals['rrule'], date_to_write, context)
+
res = super(calendar_event, self).write(cr, uid, new_ids, vals, context=context)
if ('alarm_id' in vals or 'base_calendar_alarm_id' in vals)\
@@ -1535,6 +1559,11 @@ rule or repeating pattern of time to exclude from the recurring rule."),
if vals.get('vtimezone', '') and vals.get('vtimezone', '').startswith('/freeassociation.sourceforge.net/tzfile/'):
vals['vtimezone'] = vals['vtimezone'][40:]
+
+ if 'date' in vals and 'rrule' in vals and vals['rrule']:
+ update_datas = self._parse_rrule(vals['rrule'], self._get_empty_rrule_data(), vals['date'])
+ update_datas['recurrency'] = True
+ vals.update(update_datas)
updated_vals = self.onchange_dates(cr, uid, [],
vals.get('date', False),
From cac9fb4e0322ad041acc2cdb9e9a90322b9decba Mon Sep 17 00:00:00 2001
From: "tfr@openerp.com" <>
Date: Tue, 12 Jul 2011 16:02:13 +0200
Subject: [PATCH 08/64] [FIX] get hostname using tools.get_hostname
bzr revid: tfr@openerp.com-20110712140213-flf80sbimzhkmekx
---
addons/caldav/wizard/caldav_browse.py | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/addons/caldav/wizard/caldav_browse.py b/addons/caldav/wizard/caldav_browse.py
index f6ecc5dccd5..49b313b9886 100644
--- a/addons/caldav/wizard/caldav_browse.py
+++ b/addons/caldav/wizard/caldav_browse.py
@@ -24,6 +24,7 @@ from tools import config
import base64
import addons
from tools.translate import _
+import tools
class caldav_browse(osv.osv_memory):
@@ -239,12 +240,8 @@ class user_preference(osv.osv_memory):
return ids[0]
def _get_default_host(self, cr, uid, context):
- ids=self.search(cr,uid,[])
- host_name = ''
- if ids:
- ids = len(ids)> 1 and len(ids)-1 or ids[0] # Use len(ids)-1 for taking the value of last id
- host_name = self.browse(cr, uid,[ids],context=context)[0].host_name
- return host_name
+
+ return tools.get_hostname(self, cr, uid)
_defaults={
'service': 'webdav',
From 8a69cc5504369c565e8c11545b9164bcf4b905cc Mon Sep 17 00:00:00 2001
From: "DBR (OpenERP)"
Date: Fri, 16 Sep 2011 15:24:46 +0530
Subject: [PATCH 09/64] [FIX] After installing base_contact Contact in search
view of partner not work
lp bug: https://launchpad.net/bugs/849420 fixed
bzr revid: dbr@tinyerp.com-20110916095446-6cwydtneyhng01by
---
addons/base_contact/base_contact.py | 18 +++++++++++++++++-
addons/base_contact/base_contact_view.xml | 16 +++++++++++++++-
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/addons/base_contact/base_contact.py b/addons/base_contact/base_contact.py
index cf0bc610be8..8be20109591 100644
--- a/addons/base_contact/base_contact.py
+++ b/addons/base_contact/base_contact.py
@@ -131,7 +131,7 @@ class res_partner_address(osv.osv):
if not len(ids):
return []
res = []
- if context is None:
+ if context is None:
context = {}
for r in self.read(cr, user, ids, ['zip', 'city', 'partner_id', 'street']):
if context.get('contact_display', 'contact')=='partner' and r['partner_id']:
@@ -143,6 +143,22 @@ class res_partner_address(osv.osv):
res.append((r['id'], addr.strip() or '/'))
return res
+ def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
+ if not args:
+ args=[]
+ if not context:
+ context={}
+ if name:
+ ids = []
+ job_ids = self.pool.get('res.partner.job').search(cr, user, [('contact_id', operator, name)] + args, limit=limit, context=context)
+ partner_ids = self.pool.get('res.partner.job').browse(cr, user, job_ids)
+ partner_data = [(partner.name.name) for partner in partner_ids]
+ for partner in partner_data:
+ ids += self.search(cr, user, [('partner_id',operator,partner)] + args, limit=limit, context=context)
+ else:
+ ids = self.search(cr, user, args, limit=limit, context=context)
+ return self.name_get(cr, user, ids, context)
+
_name = 'res.partner.address'
_inherit = 'res.partner.address'
_description ='Partner Address'
diff --git a/addons/base_contact/base_contact_view.xml b/addons/base_contact/base_contact_view.xml
index 8029084b7c3..a65f107fb25 100644
--- a/addons/base_contact/base_contact_view.xml
+++ b/addons/base_contact/base_contact_view.xml
@@ -252,7 +252,20 @@
-
+
+
+
+
+ res.partner.select
+ search
+ res.partner
+
+
+
+
+
+
+
@@ -422,3 +435,4 @@
+
From 0c13fea7cd069ea761824f9fba79e873c1dec895 Mon Sep 17 00:00:00 2001
From: "DBR (OpenERP)"
Date: Fri, 16 Sep 2011 18:02:07 +0530
Subject: [PATCH 10/64] [RMV]base_contact: Remove the extra added inherited
view
bzr revid: dbr@tinyerp.com-20110916123207-voyla0qs0bx1j3te
---
addons/base_contact/base_contact_view.xml | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/addons/base_contact/base_contact_view.xml b/addons/base_contact/base_contact_view.xml
index a65f107fb25..0ac009169b3 100644
--- a/addons/base_contact/base_contact_view.xml
+++ b/addons/base_contact/base_contact_view.xml
@@ -252,20 +252,6 @@
-
-
-
-
- res.partner.select
- search
- res.partner
-
-
-
-
-
-
-
From 007af7601f455ab5b21a6e977efbfe25920c8756 Mon Sep 17 00:00:00 2001
From: "DBR (OpenERP)"
Date: Fri, 16 Sep 2011 18:10:46 +0530
Subject: [PATCH 11/64] [IMP]base_contact:Improve the code
bzr revid: dbr@tinyerp.com-20110916124046-2p713bhbsi8g9zev
---
addons/base_contact/base_contact.py | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/addons/base_contact/base_contact.py b/addons/base_contact/base_contact.py
index 8be20109591..2f228bdf345 100644
--- a/addons/base_contact/base_contact.py
+++ b/addons/base_contact/base_contact.py
@@ -144,14 +144,13 @@ class res_partner_address(osv.osv):
return res
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
+ ids = []
if not args:
args=[]
- if not context:
- context={}
+ jobs = self.pool.get('res.partner.job')
if name:
- ids = []
- job_ids = self.pool.get('res.partner.job').search(cr, user, [('contact_id', operator, name)] + args, limit=limit, context=context)
- partner_ids = self.pool.get('res.partner.job').browse(cr, user, job_ids)
+ job_ids = jobs.search(cr, user, [('contact_id', operator, name)] + args, limit=limit, context=context)
+ partner_ids = jobs.browse(cr, user, job_ids)
partner_data = [(partner.name.name) for partner in partner_ids]
for partner in partner_data:
ids += self.search(cr, user, [('partner_id',operator,partner)] + args, limit=limit, context=context)
From 2b997a1fce1f48105f67a6570953a40245edc50c Mon Sep 17 00:00:00 2001
From: "DBR (OpenERP)"
Date: Tue, 20 Sep 2011 11:39:49 +0530
Subject: [PATCH 12/64] [FIX] : Remove the conflict
bzr revid: dbr@tinyerp.com-20110920060949-j8wtqlq7huc9jvd1
---
addons/auction/auction_demo.xml | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/addons/auction/auction_demo.xml b/addons/auction/auction_demo.xml
index 7f34eb6697c..e93cc3ea04d 100644
--- a/addons/auction/auction_demo.xml
+++ b/addons/auction/auction_demo.xml
@@ -39,7 +39,7 @@
Auction Adjudications
A7x*
- receivable
+ other
@@ -48,7 +48,7 @@
Auction Adjudication Expenses
A6x*
- payable
+ other
@@ -56,7 +56,7 @@
Auction Buyer Costs
A8x*
- payable
+ other
@@ -64,7 +64,7 @@
Auction Seller Costs
A9x*
- receivable
+ other
@@ -251,7 +251,7 @@
- Frais de vente
+ Frais de vente0
0
auction
From a9eaeb39598726af1e09956f462ee09bad501e75 Mon Sep 17 00:00:00 2001
From: "DBR (OpenERP)"
Date: Tue, 20 Sep 2011 14:24:19 +0530
Subject: [PATCH 13/64] [IMP]base_contact : Improve the code
bzr revid: dbr@tinyerp.com-20110920085419-8vft3k6yu72eb54n
---
addons/base_contact/base_contact.py | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/addons/base_contact/base_contact.py b/addons/base_contact/base_contact.py
index 2f228bdf345..25cd38d60fb 100644
--- a/addons/base_contact/base_contact.py
+++ b/addons/base_contact/base_contact.py
@@ -144,18 +144,14 @@ class res_partner_address(osv.osv):
return res
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
- ids = []
if not args:
args=[]
+ ids = self.search(cr, user, [('name',operator,name)] + args, limit=limit, context=context)
jobs = self.pool.get('res.partner.job')
if name:
job_ids = jobs.search(cr, user, [('contact_id', operator, name)] + args, limit=limit, context=context)
- partner_ids = jobs.browse(cr, user, job_ids)
- partner_data = [(partner.name.name) for partner in partner_ids]
- for partner in partner_data:
+ for partner in [(partner.name.name) for partner in (jobs.browse(cr, user, job_ids))]:
ids += self.search(cr, user, [('partner_id',operator,partner)] + args, limit=limit, context=context)
- else:
- ids = self.search(cr, user, args, limit=limit, context=context)
return self.name_get(cr, user, ids, context)
_name = 'res.partner.address'
From 8693b8108a5c76115654e0d719249417590da9fc Mon Sep 17 00:00:00 2001
From: "Atik Agewan (OpenERP)"
Date: Thu, 13 Oct 2011 16:10:34 +0530
Subject: [PATCH 14/64] [Fix] Account :[Account]In menu
Accounting/Configuration/Miscellaneous/Payment Terms Improve some usability
Issue
lp bug: https://launchpad.net/bugs/873234 fixed
bzr revid: aag@tinyerp.com-20111013104034-znmers3jo3h6e7j0
---
addons/account/account_view.xml | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 2ae910a36b3..74157fb8f19 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1714,19 +1714,20 @@
form
From d5426481fa919b8896ddbdf0e9eb64d5c95db53a Mon Sep 17 00:00:00 2001
From: "Atik Agewan (OpenERP)"
Date: Wed, 19 Oct 2011 15:18:46 +0530
Subject: [PATCH 15/64] [IMP]Account: Add Computation seprator
bzr revid: aag@tinyerp.com-20111019094846-1zmij1x1gmo8w45q
---
addons/account/account_view.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 004ccaba186..394387cae4e 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1772,6 +1772,7 @@
+
From 9f1d8942527e9545aa79b6fa433ca58ca91a7f31 Mon Sep 17 00:00:00 2001
From: "Atik Agewan (OpenERP)"
Date: Wed, 19 Oct 2011 16:53:27 +0530
Subject: [PATCH 16/64] [IMP]Account: Add seprator
bzr revid: aag@tinyerp.com-20111019112327-xbhaossu4i28efmw
---
addons/account/account_view.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 394387cae4e..45836140648 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1729,7 +1729,8 @@
-
+
+
From 3a106f0d881d92336d7baaef38e6e685d9574b82 Mon Sep 17 00:00:00 2001
From: "Atik Agewan (OpenERP)"
Date: Wed, 19 Oct 2011 17:24:22 +0530
Subject: [PATCH 17/64] [IMP]:Examples => Example
bzr revid: aag@tinyerp.com-20111019115422-o60bq1uhu6pdkr90
---
addons/account/account_view.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 45836140648..8f899281aa5 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1729,7 +1729,7 @@
-
+
From e1f44eaaac0cf27bb7a584cb2b1017201f16a818 Mon Sep 17 00:00:00 2001
From: "Rucha (Open ERP)"
Date: Wed, 19 Oct 2011 17:31:50 +0530
Subject: [PATCH 18/64] [IMP]: account: Removed indexing example of payement
term in payment line view as there is only one example
bzr revid: rpa@tinyerp.com-20111019120150-9rdg720tpdre7jzf
---
addons/account/account_view.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 8f899281aa5..de4725f9ddb 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1730,7 +1730,7 @@
-
+
From 280a57484e923aa10d9601f2d490468e9f2dfa7f Mon Sep 17 00:00:00 2001
From: "Rucha (Open ERP)"
Date: Wed, 19 Oct 2011 17:40:37 +0530
Subject: [PATCH 19/64] [IMP]: account: Usabililty Improvements in payment term
line view
bzr revid: rpa@tinyerp.com-20111019121037-uhvtkpzii0qomluc
---
addons/account/account_view.xml | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index de4725f9ddb..ad2d616c2e5 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1733,18 +1733,18 @@
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
From abe5a3e1d05613176660cf4b596dd6e4be4c5216 Mon Sep 17 00:00:00 2001
From: "Rucha (Open ERP)"
Date: Wed, 19 Oct 2011 17:50:53 +0530
Subject: [PATCH 20/64] [FIX]: account: typo + improvement in payment term line
view
bzr revid: rpa@tinyerp.com-20111019122053-qr4uuz9z244s389u
---
addons/account/account_view.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index ad2d616c2e5..3912f665916 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1730,10 +1730,10 @@
-
+
-
+
@@ -1741,7 +1741,7 @@
-
+
From ee7f8b1d70dec5e3c67d8075108bb659acf8cbb5 Mon Sep 17 00:00:00 2001
From: "Bharat (OpenERP)"
Date: Thu, 20 Oct 2011 12:55:35 +0530
Subject: [PATCH 21/64] [FIX] point_of_sale : changed the table name of field
user_id in point_of_sale/wizard/pos_payment_report_user.py
lp bug: https://launchpad.net/bugs/872675 fixed
bzr revid: bde@tinyerp.com-20111020072535-u7f983qnej28x5d3
---
addons/point_of_sale/wizard/pos_payment_report_date_view.xml | 4 ++--
addons/point_of_sale/wizard/pos_payment_report_user.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/addons/point_of_sale/wizard/pos_payment_report_date_view.xml b/addons/point_of_sale/wizard/pos_payment_report_date_view.xml
index 7c74ae1d9be..053e7c9a723 100644
--- a/addons/point_of_sale/wizard/pos_payment_report_date_view.xml
+++ b/addons/point_of_sale/wizard/pos_payment_report_date_view.xml
@@ -21,7 +21,7 @@
-
+
@@ -35,4 +35,4 @@
new
-
+
diff --git a/addons/point_of_sale/wizard/pos_payment_report_user.py b/addons/point_of_sale/wizard/pos_payment_report_user.py
index 02db921618b..e947b8d06a9 100644
--- a/addons/point_of_sale/wizard/pos_payment_report_user.py
+++ b/addons/point_of_sale/wizard/pos_payment_report_user.py
@@ -46,7 +46,7 @@ class pos_payment_report_user(osv.osv_memory):
}
_columns = {
- 'user_id': fields.many2many('res.users', 'res_user_sale', 'user_id', 'sale_id', 'Salesman')
+ 'user_id': fields.many2many('res.users', 'res_user_sale_user', 'user_id', 'sale_id', 'Salesman')
}
pos_payment_report_user()
From 8e34b97b090b7b3dc80875c2932af8f04bc5487b Mon Sep 17 00:00:00 2001
From: Fabien Meghazi
Date: Thu, 20 Oct 2011 11:15:27 +0200
Subject: [PATCH 22/64] [ADD] Add format_text_node callback in qweb instance.
Will be used for translations
bzr revid: fme@openerp.com-20111020091527-wxnw5kfpucvlncif
---
addons/web/static/lib/qweb/qweb2.js | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/addons/web/static/lib/qweb/qweb2.js b/addons/web/static/lib/qweb/qweb2.js
index 621ea39c74f..5785ddaaa30 100644
--- a/addons/web/static/lib/qweb/qweb2.js
+++ b/addons/web/static/lib/qweb/qweb2.js
@@ -207,6 +207,7 @@ QWeb2.Engine = (function() {
this.reserved_words = QWeb2.RESERVED_WORDS.slice(0);
this.actions_precedence = QWeb2.ACTIONS_PRECEDENCE.slice(0);
this.word_replacement = QWeb2.tools.extend({}, QWeb2.WORD_REPLACEMENT);
+ this.format_text_node = null;
for (var i = 0; i < arguments.length; i++) {
this.add_template(arguments[i]);
}
@@ -486,12 +487,16 @@ QWeb2.Element = (function() {
},
_compile : function() {
switch (this.node.nodeType) {
- case 3:
- case 4:
- this.top_string(this.node.data);
+ case 3:
+ case 4:
+ var text = this.node.data;
+ if (this.engine.format_text_node) {
+ text = this.engine.format_text_node.call(this, text);
+ }
+ this.top_string(text);
break;
- case 1:
- this.compile_element();
+ case 1:
+ this.compile_element();
}
var r = this._top.join('');
if (this.process_children) {
From 278955b20741283746914d9633075a831db890f1 Mon Sep 17 00:00:00 2001
From: Fabien Meghazi
Date: Thu, 20 Oct 2011 11:16:19 +0200
Subject: [PATCH 23/64] [ADD] Web client now support template translations
bzr revid: fme@openerp.com-20111020091619-1i2nhopdgszsy48q
---
addons/web/static/src/js/core.js | 17 +++++++++++++++--
npybabel.py | 2 +-
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js
index 8dfbd68e6de..21a4ca21931 100644
--- a/addons/web/static/src/js/core.js
+++ b/addons/web/static/src/js/core.js
@@ -10,8 +10,6 @@ if (!console.debug) {
}
openerp.web.core = function(openerp) {
-openerp.web.qweb = new QWeb2.Engine();
-openerp.web.qweb.debug = (window.location.search.indexOf('?debug') !== -1);
/**
* John Resig Class with factory improvement
*/
@@ -1040,6 +1038,21 @@ openerp.web.TranslationDataBase = openerp.web.Class.extend(/** @lends openerp.we
});
openerp.web._t = new openerp.web.TranslationDataBase().build_translation_function();
+openerp.web.qweb = new QWeb2.Engine();
+openerp.web.qweb.debug = (window.location.search.indexOf('?debug') !== -1);
+openerp.web.qweb.format_text_node = function(s) {
+ // Note that 'this' is the Qweb Node of the text
+ var translation = this.node.parentElement.attributes['t-translation'];
+ if (translation && translation.value === 'off') {
+ return s;
+ }
+ var ts = _.trim(s);
+ if (ts.length === 0) {
+ return s;
+ }
+ var tr = openerp.web._t(ts);
+ return tr === ts ? s : tr;
+}
};
diff --git a/npybabel.py b/npybabel.py
index 0a3c75025c9..1b2e80a7a67 100755
--- a/npybabel.py
+++ b/npybabel.py
@@ -54,7 +54,7 @@ def extract_qweb(fileobj, keywords, comment_tags, options):
for el in current_element:
if "t-js" not in el.attrib and \
not ("t-jquery" in el.attrib and "t-operation" not in el.attrib) and \
- not ("t-trad" in el.attrib and el.attrib["t-trad"].strip() == "off"):
+ not ("t-translation" in el.attrib and el.attrib["t-translation"].strip() == "off"):
handle_text(el.text)
iter_elements(el)
handle_text(el.tail)
From 42b8b5a1391a225648bf669c9d0f09426ea4a8c0 Mon Sep 17 00:00:00 2001
From: "Bharat (OpenERP)"
Date: Thu, 20 Oct 2011 15:21:37 +0530
Subject: [PATCH 24/64] [FIX] point_of_sale : changed the table name and given
appropriate menu name for report
bzr revid: bde@tinyerp.com-20111020095137-onr5un3j6o9pmkvj
---
addons/point_of_sale/wizard/pos_payment_report_date.py | 2 +-
addons/point_of_sale/wizard/pos_payment_report_date_view.xml | 2 +-
addons/point_of_sale/wizard/pos_payment_report_user.py | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/addons/point_of_sale/wizard/pos_payment_report_date.py b/addons/point_of_sale/wizard/pos_payment_report_date.py
index e498eef6697..f97391c7f7d 100644
--- a/addons/point_of_sale/wizard/pos_payment_report_date.py
+++ b/addons/point_of_sale/wizard/pos_payment_report_date.py
@@ -55,7 +55,7 @@ class pos_payment_report_date(osv.osv_memory):
_columns = {
'date_start': fields.date('Start Date', required=True),
'date_end': fields.date('End Date', required=True),
- 'user_id': fields.many2many('res.users', 'res_user_sale', 'user_id', 'sale_id', 'Salesman')
+ 'user_id': fields.many2many('res.users', 'res_user_sale_date', 'user_id', 'sale_id', 'Salesman')
}
_defaults = {
'date_start': lambda *a: time.strftime('%Y-%m-%d'),
diff --git a/addons/point_of_sale/wizard/pos_payment_report_date_view.xml b/addons/point_of_sale/wizard/pos_payment_report_date_view.xml
index 053e7c9a723..b684fd35839 100644
--- a/addons/point_of_sale/wizard/pos_payment_report_date_view.xml
+++ b/addons/point_of_sale/wizard/pos_payment_report_date_view.xml
@@ -27,7 +27,7 @@
- Sales by Products
+ Sales by Users
ir.actions.act_window
pos.payment.report.date
form
diff --git a/addons/point_of_sale/wizard/pos_payment_report_user.py b/addons/point_of_sale/wizard/pos_payment_report_user.py
index e947b8d06a9..02db921618b 100644
--- a/addons/point_of_sale/wizard/pos_payment_report_user.py
+++ b/addons/point_of_sale/wizard/pos_payment_report_user.py
@@ -46,7 +46,7 @@ class pos_payment_report_user(osv.osv_memory):
}
_columns = {
- 'user_id': fields.many2many('res.users', 'res_user_sale_user', 'user_id', 'sale_id', 'Salesman')
+ 'user_id': fields.many2many('res.users', 'res_user_sale', 'user_id', 'sale_id', 'Salesman')
}
pos_payment_report_user()
From 6a7c1b1002477917261df34e287b60cc42695f62 Mon Sep 17 00:00:00 2001
From: "Quentin (OpenERP)"
Date: Thu, 20 Oct 2011 12:21:26 +0200
Subject: [PATCH 25/64] [FIX] stock, partial picking: reverted fix of bug
833770 (made in revision 5413) to implement it in another way. The reason is
that if you want to process a picking that is partially available, you have
several solutions: you can force the availability of unready lines but it
means that if you partially process those lines, the quantity not processed
will stay with the status 'available', or you can just allow people to see
also the unready lines in the partial picking wizard.... but, in order to
have a smooth processing for most of the cases, the unassigned lines will be
with a quantity of 0, so that if you don't change anything it will process
only available lines, and if you want to partially process an unavailable
line, then you still have the opportunity to do so. This approach is much
more flexible.
bzr revid: qdp-launchpad@openerp.com-20111020102126-rizauy5k2gmrmdbj
---
addons/stock/wizard/stock_partial_picking.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/addons/stock/wizard/stock_partial_picking.py b/addons/stock/wizard/stock_partial_picking.py
index dd810ae7182..d617ea2b5da 100644
--- a/addons/stock/wizard/stock_partial_picking.py
+++ b/addons/stock/wizard/stock_partial_picking.py
@@ -62,7 +62,7 @@ class stock_partial_picking(osv.osv_memory):
res.update(picking_id=picking_id)
if 'move_ids' in fields:
picking = self.pool.get('stock.picking').browse(cr, uid, picking_id, context=context)
- moves = [self._partial_move_for(cr, uid, m) for m in picking.move_lines if m.state == 'assigned']
+ moves = [self._partial_move_for(cr, uid, m) for m in picking.move_lines if m.state not in ('done','cancel')]
res.update(move_ids=moves)
if 'date' in fields:
res.update(date=time.strftime(DEFAULT_SERVER_DATETIME_FORMAT))
@@ -88,7 +88,7 @@ class stock_partial_picking(osv.osv_memory):
def _partial_move_for(self, cr, uid, move):
partial_move = {
'product_id' : move.product_id.id,
- 'quantity' : move.product_qty,
+ 'quantity' : move.state == 'assigned' and move.product_qty or 0,
'product_uom' : move.product_uom.id,
'prodlot_id' : move.prodlot_id.id,
'move_id' : move.id,
From ca453718e8498f29ecefca587c8dadfd72beb11a Mon Sep 17 00:00:00 2001
From: Fabien Meghazi
Date: Thu, 20 Oct 2011 12:39:26 +0200
Subject: [PATCH 26/64] [FIX] Fix calendar notification. Only notify events
with no date_start in debug mode.
bzr revid: fme@openerp.com-20111020103926-oyfx6d903a85b3jc
---
addons/web_calendar/static/src/js/calendar.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/addons/web_calendar/static/src/js/calendar.js b/addons/web_calendar/static/src/js/calendar.js
index e98a3620eb0..a5fd8bcac9c 100644
--- a/addons/web_calendar/static/src/js/calendar.js
+++ b/addons/web_calendar/static/src/js/calendar.js
@@ -156,7 +156,9 @@ openerp.web_calendar.CalendarView = openerp.web.View.extend({
for (var e = 0; e < events.length; e++) {
var evt = events[e];
if (!evt[this.date_start]) {
- this.notification.warn("Start date is not defined for event :", evt['id']);
+ if (this.session.debug) {
+ this.do_warn("Start date is not defined for event :", evt['id']);
+ }
break;
}
From b4cb0ae4772e2fab08678ce5255295a3ece1f4ac Mon Sep 17 00:00:00 2001
From: Fabien Meghazi
Date: Thu, 20 Oct 2011 12:42:18 +0200
Subject: [PATCH 27/64] [IMP] QWeb2: do not swallow stack trace with try,catch
in debug mode
bzr revid: fme@openerp.com-20111020104218-q0qe91v99hz8a4yq
---
addons/web/static/lib/qweb/qweb2.js | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/addons/web/static/lib/qweb/qweb2.js b/addons/web/static/lib/qweb/qweb2.js
index 5785ddaaa30..34457ade4fd 100644
--- a/addons/web/static/lib/qweb/qweb2.js
+++ b/addons/web/static/lib/qweb/qweb2.js
@@ -318,12 +318,14 @@ QWeb2.Engine = (function() {
" dict = dict || {};\n" +
" dict['__template__'] = '" + template + "';\n" +
" var r = [];\n" +
- " /* START TEMPLATE */ try {\n" +
+ " /* START TEMPLATE */" +
+ (this.debug ? "" : " try {\n") +
(e.compile()) + "\n" +
- " /* END OF TEMPLATE */ } catch(error) {\n" +
+ " /* END OF TEMPLATE */" +
+ (this.debug ? "" : " } catch(error) {\n" +
" if (console && console.exception) console.exception(error);\n" +
- " context.engine.tools.exception('Runtime Error: ' + error, context);\n" +
- " }\n" +
+ " context.engine.tools.exception('Runtime Error: ' + error, context);\n") +
+ (this.debug ? "" : " }\n") +
" return r.join('');";
},
render : function(template, dict) {
From ae8d719ba8ac120314ec810408ad3257fe1a31dc Mon Sep 17 00:00:00 2001
From: Xavier Morel
Date: Thu, 20 Oct 2011 15:20:20 +0200
Subject: [PATCH 28/64] [FIX] missing state field in account.invoice.line
inlined in form view account.invoice.supplier.form
bzr revid: xmo@openerp.com-20111020132020-kwifihi24r4bb77u
---
.../account_invoice_layout_view.xml | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/addons/account_invoice_layout/account_invoice_layout_view.xml b/addons/account_invoice_layout/account_invoice_layout_view.xml
index 6bdabae9326..062349f7716 100644
--- a/addons/account_invoice_layout/account_invoice_layout_view.xml
+++ b/addons/account_invoice_layout/account_invoice_layout_view.xml
@@ -55,6 +55,18 @@
+
+ account.invoice.supplier.form.layout
+ account.invoice
+
+ form
+
+
+
+
+
+
+
notify.message.search
From f858b6b9f531dbc1b8cd812dc3e7173f37922e08 Mon Sep 17 00:00:00 2001
From: Fabien Meghazi
Date: Thu, 20 Oct 2011 15:41:05 +0200
Subject: [PATCH 29/64] [IMP] Kanban: do not fetch all fields when reloading
record
bzr revid: fme@openerp.com-20111020134105-qlpib73bmqotu3jd
---
addons/web_kanban/static/src/js/kanban.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js
index dcd168536d8..9f31f368c7f 100644
--- a/addons/web_kanban/static/src/js/kanban.js
+++ b/addons/web_kanban/static/src/js/kanban.js
@@ -242,7 +242,7 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({
*/
on_reload_record: function (record_id){
var self = this;
- this.dataset.read_ids([record_id], [], function (records) {
+ this.dataset.read_ids([record_id], _.keys(self.fields_view.fields), function (records) {
if (records.length > 0) {
for (var i=0, ii=self.all_display_data.length; i < ii; i++) {
for(j=0, jj=self.all_display_data[i].records.length; j < jj; j++) {
From b424be8f23b7dd0945b6a0e93d77d0ebc38defa2 Mon Sep 17 00:00:00 2001
From: Fabien Meghazi
Date: Thu, 20 Oct 2011 16:32:54 +0200
Subject: [PATCH 30/64] [IMP] Kanban: we always have a form view
bzr revid: fme@openerp.com-20111020143254-38fk0dfbq00j7kwf
---
addons/web_kanban/static/src/js/kanban.js | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js
index 9f31f368c7f..f32d9be0890 100644
--- a/addons/web_kanban/static/src/js/kanban.js
+++ b/addons/web_kanban/static/src/js/kanban.js
@@ -18,10 +18,8 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({
this.qweb = new QWeb2.Engine();
this.aggregates = {};
this.NO_OF_COLUMNS = 3;
- if (this.options.action_views_ids.form) {
- this.form_dialog = new openerp.web.FormDialog(this, {}, this.options.action_views_ids.form, dataset).start();
- this.form_dialog.on_form_dialog_saved.add_last(this.on_record_saved);
- }
+ this.form_dialog = new openerp.web.FormDialog(this, {}, this.options.action_views_ids.form, dataset).start();
+ this.form_dialog.on_form_dialog_saved.add_last(this.on_record_saved);
},
start: function() {
this._super();
@@ -203,12 +201,8 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({
this.do_switch_view('form');
},
do_edit_record: function(record_id) {
- if (this.form_dialog) {
- this.form_dialog.load_id(record_id);
- this.form_dialog.open();
- } else {
- this.notification.warn("Kanban", "No form view defined for this object");
- }
+ this.form_dialog.load_id(record_id);
+ this.form_dialog.open();
},
on_record_saved: function(r) {
var id = this.form_dialog.form.datarecord.id;
From 9ecff1245aedd5d7a3d6d565389d35d9920acf59 Mon Sep 17 00:00:00 2001
From: "Quentin (OpenERP)"
Date: Thu, 20 Oct 2011 16:42:17 +0200
Subject: [PATCH 31/64] [IMP] account_voucher: onchange_partner_id small
refactoring + improved the splitting of the amount by existing voucher lines
bzr revid: qdp-launchpad@openerp.com-20111020144217-t4owndjuntdeuts9
---
addons/account_voucher/account_voucher.py | 91 ++++++++++---------
addons/account_voucher/invoice.py | 5 +-
.../voucher_payment_receipt_view.xml | 30 +++---
3 files changed, 68 insertions(+), 58 deletions(-)
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index 38af59009d8..d2f9d230fbd 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -427,36 +427,31 @@ class account_voucher(osv.osv):
if date:
context_multi_currency.update({'date': date})
- line_pool = self.pool.get('account.voucher.line')
- line_ids = ids and line_pool.search(cr, uid, [('voucher_id', '=', ids[0])]) or False
- if line_ids:
- line_pool.unlink(cr, uid, line_ids)
-
currency_pool = self.pool.get('res.currency')
move_line_pool = self.pool.get('account.move.line')
partner_pool = self.pool.get('res.partner')
journal_pool = self.pool.get('account.journal')
+ line_pool = self.pool.get('account.voucher.line')
+ #get default values
vals = self.onchange_journal(cr, uid, ids, journal_id, [], False, partner_id, context)
vals = vals.get('value')
-
- journal = journal_pool.browse(cr, uid, journal_id, context=context)
currency_id = vals.get('currency_id', currency_id)
default = {
'value':{'line_ids':[], 'line_dr_ids':[], 'line_cr_ids':[], 'pre_line': False, 'currency_id':currency_id},
}
- currency_id = currency_id or journal.company_id.currency_id.id
+
+ #drop existing lines
+ line_ids = ids and line_pool.search(cr, uid, [('voucher_id', '=', ids[0])]) or False
+ if line_ids:
+ line_pool.unlink(cr, uid, line_ids)
if not partner_id:
return default
- if not partner_id and ids:
- line_ids = line_pool.search(cr, uid, [('voucher_id', '=', ids[0])])
- if line_ids:
- line_pool.unlink(cr, uid, line_ids)
- return default
-
+ journal = journal_pool.browse(cr, uid, journal_id, context=context)
partner = partner_pool.browse(cr, uid, partner_id, context=context)
+ currency_id = currency_id or journal.company_id.currency_id.id
account_id = False
if journal.type in ('sale','sale_refund'):
account_id = partner.property_account_receivable.id
@@ -484,64 +479,78 @@ class account_voucher(osv.osv):
ids = move_line_pool.search(cr, uid, [('state','=','valid'), ('account_id.type', '=', account_type), ('reconcile_id', '=', False), ('partner_id', '=', partner_id)], context=context)
else:
ids = context['move_line_ids']
+ invoice_id = context.get('invoice_id', False)
+ company_currency = journal.company_id.currency_id.id
+ move_line_found = False
+
+ #order the lines by most old first
ids.reverse()
moves = move_line_pool.browse(cr, uid, ids, context=context)
- #company_currency = journal.company_id.currency_id.id
- #if company_currency != currency_id and ttype == 'payment':
- # total_debit = currency_pool.compute(cr, uid, currency_id, company_currency, total_debit, context=context_multi_currency)
- #elif company_currency != currency_id and ttype == 'receipt':
- # total_credit = currency_pool.compute(cr, uid, currency_id, company_currency, total_credit, context=context_multi_currency)
-
- company_currency = journal.company_id.currency_id.id
for line in moves:
if line.credit and line.reconcile_partial_id and ttype == 'receipt':
continue
if line.debit and line.reconcile_partial_id and ttype == 'payment':
continue
+ if invoice_id:
+ if line.invoice.id == invoice_id:
+ #if the invoice linked to the voucher line is equal to the invoice_id in context
+ #then we assign the amount on that line, whatever the other voucher lines
+ move_line_found = line.id
+ break
+ elif currency_id == company_currency:
+ #otherwise treatments is the same but with other field names
+ if line.amount_residual == price:
+ #if the amount residual is equal the amount voucher, we assign it to that voucher
+ #line, whatever the other voucher lines
+ move_line_found = line.id
+ break
+ #otherwise we will split the voucher amount on each line (by most old first)
+ total_credit += line.credit or 0.0
+ total_debit += line.debit or 0.0
+ elif currency_id == line.currency_id.id:
+ if line.amount_residual_currency == price:
+ move_line_found = line.id
+ break
+ total_credit += line.credit and line.amount_currency or 0.0
+ total_debit += line.debit and line.amount_currency or 0.0
- if line.currency_id and currency_id==line.currency_id.id:
- total_credit += line.amount_currency <0 and -line.amount_currency or 0.0
- total_debit += line.amount_currency >0 and line.amount_currency or 0.0
- else:
- total_credit += currency_pool.compute(cr, uid, company_currency, currency_id, line.credit or 0.0)
- total_debit += currency_pool.compute(cr, uid, company_currency, currency_id, line.debit or 0.0)
-
+ #voucher line creation
for line in moves:
if line.credit and line.reconcile_partial_id and ttype == 'receipt':
continue
if line.debit and line.reconcile_partial_id and ttype == 'payment':
continue
-
if line.currency_id and currency_id==line.currency_id.id:
amount_original = abs(line.amount_currency)
amount_unreconciled = abs(line.amount_residual_currency)
else:
amount_original = currency_pool.compute(cr, uid, company_currency, currency_id, line.credit or line.debit or 0.0)
amount_unreconciled = currency_pool.compute(cr, uid, company_currency, currency_id, abs(line.amount_residual))
-
- #original_amount = line.credit or line.debit or 0.0
- #amount_unreconciled = currency_pool.compute(cr, uid, line.currency_id and line.currency_id.id or company_currency, currency_id, abs(line.amount_residual_currency), context=context_multi_currency)
rs = {
'name':line.move_id.name,
'type': line.credit and 'dr' or 'cr',
'move_line_id':line.id,
'account_id':line.account_id.id,
'amount_original': amount_original,
+ 'amount': (move_line_found == line.id) and min(price, amount_unreconciled) or 0.0,
'date_original':line.date,
'date_due':line.date_maturity,
'amount_unreconciled': amount_unreconciled,
-
}
- if line.credit:
- amount = min(amount_unreconciled, total_debit)
- rs['amount'] = amount
- total_debit -= amount
- else:
- amount = min(amount_unreconciled, total_credit)
- rs['amount'] = amount
- total_credit -= amount
+ #split voucher amount by most old first, but only for lines in the same currency
+ if not move_line_found:
+ line_currency_id = line.currency_id and line.currency_id.id or company_currency
+ if currency_id == line_currency_id:
+ if line.credit:
+ amount = min(amount_unreconciled, abs(total_debit))
+ rs['amount'] = amount
+ total_debit -= amount
+ else:
+ amount = min(amount_unreconciled, abs(total_credit))
+ rs['amount'] = amount
+ total_credit -= amount
default['value']['line_ids'].append(rs)
if rs['type'] == 'cr':
diff --git a/addons/account_voucher/invoice.py b/addons/account_voucher/invoice.py
index 0230cac1009..b108bc14fe3 100644
--- a/addons/account_voucher/invoice.py
+++ b/addons/account_voucher/invoice.py
@@ -45,10 +45,11 @@ class invoice(osv.osv):
'close_after_process': True,
'invoice_type':inv.type,
'invoice_id':inv.id,
- 'default_type': inv.type in ('out_invoice','out_refund') and 'receipt' or 'payment'
+ 'default_type': inv.type in ('out_invoice','out_refund') and 'receipt' or 'payment',
+ 'type': inv.type in ('out_invoice','out_refund') and 'receipt' or 'payment'
}
}
invoice()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml
index 9c8bdffb35d..0ddc868cb45 100644
--- a/addons/account_voucher/voucher_payment_receipt_view.xml
+++ b/addons/account_voucher/voucher_payment_receipt_view.xml
@@ -74,14 +74,14 @@
1
- Europ
+ Europe
diff --git a/addons/survey/survey_view.xml b/addons/survey/survey_view.xml
index f92ce45a037..d5d0100534e 100644
--- a/addons/survey/survey_view.xml
+++ b/addons/survey/survey_view.xml
@@ -1066,7 +1066,7 @@
-
+
From f5661001a61a3b4b43d03eed643d7465c4d28da1 Mon Sep 17 00:00:00 2001
From: Xavier Morel
Date: Fri, 21 Oct 2011 12:36:39 +0200
Subject: [PATCH 42/64] [FIX] invalid action descriptor shape returned by
(hr.expense.expense).invoice
* Due to a stray comma, returns view_id as a list of tuples of ids
(with a single tuple of a single id), should *at most* return a list
or tuple of ids
* If returning a view_id, pair it with a single view_mode (nobody I
asked was able to nail down the exact semantics for multiple
view_mode and a view_ids, so openerp-web accepts either multiple
view_mode or a view_id but not both)
lp bug: https://launchpad.net/bugs/879314 fixed
bzr revid: xmo@openerp.com-20111021103639-3zx71fu0qrt36zpg
---
addons/hr_expense/hr_expense.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py
index 2dc6ad090ac..201c70c642c 100644
--- a/addons/hr_expense/hr_expense.py
+++ b/addons/hr_expense/hr_expense.py
@@ -131,16 +131,14 @@ class hr_expense_expense(osv.osv):
wf_service = netsvc.LocalService("workflow")
mod_obj = self.pool.get('ir.model.data')
res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_supplier_form')
- res_id = res and res[1] or False,
inv_ids = []
for id in ids:
wf_service.trg_validate(uid, 'hr.expense.expense', id, 'invoice', cr)
inv_ids.append(self.browse(cr, uid, id).invoice_id.id)
return {
'name': _('Supplier Invoices'),
- 'view_type': 'form',
- 'view_mode': 'form,tree',
- 'view_id': [res_id],
+ 'view_mode': 'form',
+ 'view_id': [res[1] if res else False],
'res_model': 'account.invoice',
'context': "{'type':'out_invoice', 'journal_type': 'purchase'}",
'type': 'ir.actions.act_window',
From 8773fca3a87a3cda0c921da83845a2b2f2e2d5a1 Mon Sep 17 00:00:00 2001
From: Xavier Morel
Date: Fri, 21 Oct 2011 12:43:12 +0200
Subject: [PATCH 43/64] [FIX] if an action descriptor does not have a view_type
attribute, behave as if it was 'form'
bzr revid: xmo@openerp.com-20111021104312-0d21m130wkedabfn
---
addons/web/controllers/main.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py
index 55e23aae979..cdcd155966e 100644
--- a/addons/web/controllers/main.py
+++ b/addons/web/controllers/main.py
@@ -526,7 +526,7 @@ def fix_view_modes(action):
if 'views' not in action:
generate_views(action)
- if action.pop('view_type') != 'form':
+ if action.pop('view_type', 'form') != 'form':
return action
action['views'] = [
From 4da3e5d354f9fa84ef30d371fe60e7fa301b001f Mon Sep 17 00:00:00 2001
From: Xavier Morel
Date: Fri, 21 Oct 2011 13:50:18 +0200
Subject: [PATCH 44/64] [FIX] tests runner: changed file names
bzr revid: xmo@openerp.com-20111021115018-0qbmhwhcjmckco0w
---
addons/web/static/test/formats.js | 2 +-
addons/web/static/test/test.html | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/addons/web/static/test/formats.js b/addons/web/static/test/formats.js
index 331725dd9a5..57ffd981ed8 100644
--- a/addons/web/static/test/formats.js
+++ b/addons/web/static/test/formats.js
@@ -51,4 +51,4 @@ $(document).ready(function () {
var val = openerp.web.parse_value(str, {type:"float"});
equal(val, -134112.1234);
});
-});
\ No newline at end of file
+});
diff --git a/addons/web/static/test/test.html b/addons/web/static/test/test.html
index 38237a0600a..e45b982fa9e 100644
--- a/addons/web/static/test/test.html
+++ b/addons/web/static/test/test.html
@@ -21,7 +21,7 @@
-
+
@@ -31,10 +31,10 @@
-
-
+
+
From 0259bb76299927f7a15566ac79a389effeeb3e20 Mon Sep 17 00:00:00 2001
From: vishmita
Date: Fri, 21 Oct 2011 17:36:45 +0530
Subject: [PATCH 45/64] [FIX] FF issues in dataset limit.
lp bug: https://launchpad.net/bugs/876603 fixed
bzr revid: vja@vja-desktop-20111021120645-qx0en9plxihle0dj
---
addons/web/static/src/js/data.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js
index 475dbe5421c..069506586ad 100644
--- a/addons/web/static/src/js/data.js
+++ b/addons/web/static/src/js/data.js
@@ -493,7 +493,7 @@ openerp.web.DataSetStatic = openerp.web.DataSet.extend({
offset = options.offset || 0,
limit = options.limit || false,
fields = fields || false;
- var end_pos = limit && limit !== -1 ? offset + limit : undefined;
+ var end_pos = limit && limit !== -1 ? offset + limit : this.ids.length;
return this.read_ids(this.ids.slice(offset, end_pos), fields, callback);
},
set_ids: function (ids) {
From 01897c8aa6b946492eeaba1595e7e925837527b7 Mon Sep 17 00:00:00 2001
From: Xavier Morel
Date: Fri, 21 Oct 2011 14:07:41 +0200
Subject: [PATCH 46/64] [FIX] completely broken float formatting when leading 0
Formatting converted the decimal part into an integer, dropping all
leading 0s and failing to reinsert them.
The conversion also lead to compounded errors, casting 0.1100 into
0.10999 (something like that).
Replace this by a straight float formatting via _.sprintf and the
slicing of the decimal part from the resulting string (Math.abs and %1
clamp the value to format to the [0, 1[ range, ensuring we just need
to slice off the first two characters). Also add some tests.
lp bug: https://launchpad.net/bugs/879355 fixed
bzr revid: xmo@openerp.com-20111021120741-813im5bzup7vho1f
---
addons/web/static/src/js/formats.js | 11 +++++++----
addons/web/static/test/formats.js | 12 ++++++++++++
addons/web/static/test/test.html | 3 ---
3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js
index 94b2c7085db..3ab972f7a86 100644
--- a/addons/web/static/src/js/formats.js
+++ b/addons/web/static/src/js/formats.js
@@ -28,10 +28,13 @@ openerp.web.format_value = function (value, descriptor, value_if_empty) {
case 'float':
var precision = descriptor.digits ? descriptor.digits[1] : 2;
var int_part = Math.floor(value);
- var dec_part = Math.abs(Math.floor((value % 1) * Math.pow(10, precision)));
- return _.sprintf('%d%s%d',
- int_part,
- openerp.web._t.database.parameters.decimal_point, dec_part);
+ var dec_part = _.sprintf(
+ '%.' + precision + 'f',
+ Math.abs(value) % 1).substring(2);
+ return _.sprintf('%d%s%s',
+ int_part,
+ openerp.web._t.database.parameters.decimal_point,
+ dec_part);
case 'float_time':
return _.sprintf("%02d:%02d",
Math.floor(value),
diff --git a/addons/web/static/test/formats.js b/addons/web/static/test/formats.js
index 57ffd981ed8..3c3c6b06e72 100644
--- a/addons/web/static/test/formats.js
+++ b/addons/web/static/test/formats.js
@@ -27,6 +27,18 @@ $(document).ready(function () {
var fl = 12.1234;
var str = openerp.web.format_value(fl, {type:"float"});
equal(str, "12.12");
+ equal(openerp.web.format_value(12.02, {type: 'float'}),
+ '12.02');
+ equal(openerp.web.format_value(0.0002, {type: 'float', digits: [1, 3]}),
+ '0.000');
+ equal(openerp.web.format_value(0.0002, {type: 'float', digits: [1, 4]}),
+ '0.0002');
+ equal(openerp.web.format_value(0.0002, {type: 'float', digits: [1, 6]}),
+ '0.000200');
+ equal(openerp.web.format_value(1, {type: 'float', digits: [1, 6]}),
+ '1.000000');
+ equal(openerp.web.format_value(1, {type: 'float'}),
+ '1.00');
});
test("parse_datetime", function () {
var val = openerp.web.str_to_datetime("2009-05-04 12:34:23");
diff --git a/addons/web/static/test/test.html b/addons/web/static/test/test.html
index e45b982fa9e..f6248e705c0 100644
--- a/addons/web/static/test/test.html
+++ b/addons/web/static/test/test.html
@@ -33,9 +33,6 @@
-
From 0e9d7318fc2c47a1b3fe495bf12f90c968e36ea9 Mon Sep 17 00:00:00 2001
From: Xavier Morel
Date: Fri, 21 Oct 2011 14:22:56 +0200
Subject: [PATCH 47/64] [FIX] float formatting in form view should take
digits/@digits in account
lp bug: https://launchpad.net/bugs/879346 fixed
bzr revid: xmo@openerp.com-20111021122256-ld3gm8u3yt4kdn71
---
addons/web/static/src/js/view_form.js | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index f8168d21466..8736f2d69e3 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -1233,6 +1233,19 @@ openerp.web.form.FieldUrl = openerp.web.form.FieldChar.extend({
});
openerp.web.form.FieldFloat = openerp.web.form.FieldChar.extend({
+ init: function (view, node) {
+ this._super(view, node);
+ if (node.attrs.digits) {
+ this.parse_digits(node.attrs.digits);
+ } else {
+ this.digits = view.fields_view.fields[node.attrs.name].digits;
+ }
+ },
+ parse_digits: function (digits_attr) {
+ // could use a Python parser instead.
+ var match = /^\s*[\(\[](\d+),\s*(\d+)/.exec(digits_attr);
+ return [parseInt(match[1], 10), parseInt(match[2], 10)];
+ },
set_value: function(value) {
if (value === false || value === undefined) {
// As in GTK client, floats default to 0
From 88c75e94d381f75009c9c2719ff16234d5792bcb Mon Sep 17 00:00:00 2001
From: Xavier Morel
Date: Fri, 21 Oct 2011 15:03:59 +0200
Subject: [PATCH 48/64] [FIX] project_issue: incorrect invisible attrs domain
on list view field
lp bug: https://launchpad.net/bugs/879376 fixed
bzr revid: xmo@openerp.com-20111021130359-vz9s4x46od2p9zwf
---
addons/project_issue/project_issue_view.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml
index 916c67b15d4..00e6a00c163 100644
--- a/addons/project_issue/project_issue_view.xml
+++ b/addons/project_issue/project_issue_view.xml
@@ -188,7 +188,7 @@
-
+
From 222d75cb1e9a8b52ad8b6845e7eed5ce2fc02d27 Mon Sep 17 00:00:00 2001
From: Olivier Dony
Date: Fri, 21 Oct 2011 15:28:02 +0200
Subject: [PATCH 49/64] [FIX] ir.action.report_xml: useless required attribute
on boolean column
bzr revid: odo@openerp.com-20111021132802-segctl9j05k2khq0
---
openerp/addons/base/ir/ir_actions.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/openerp/addons/base/ir/ir_actions.py b/openerp/addons/base/ir/ir_actions.py
index 7850006c31a..1d8f31a61e4 100644
--- a/openerp/addons/base/ir/ir_actions.py
+++ b/openerp/addons/base/ir/ir_actions.py
@@ -117,7 +117,7 @@ class report_xml(osv.osv):
'multi': fields.boolean('On multiple doc.', help="If set to true, the action will not be displayed on the right toolbar of a form view."),
'attachment': fields.char('Save As Attachment Prefix', size=128, help='This is the filename of the attachment used to store the printing result. Keep empty to not save the printed reports. You can use a python expression with the object and time variables.'),
'attachment_use': fields.boolean('Reload from Attachment', help='If you check this, then the second time the user prints with same attachment name, it returns the previous report.'),
- 'auto': fields.boolean('Custom python parser', required=True),
+ 'auto': fields.boolean('Custom python parser'),
'header': fields.boolean('Add RML header', help="Add or not the coporate RML header"),
From 7f8fb0804af0e928214c568e210bcd92eab59b30 Mon Sep 17 00:00:00 2001
From: "Quentin (OpenERP)"
Date: Fri, 21 Oct 2011 15:52:40 +0200
Subject: [PATCH 50/64] [IMP] account_voucher: added payment_rate field on the
voucher, if you don't want to use the rate encoded in openerp for this
payment + made some order in the views
bzr revid: qdp-launchpad@openerp.com-20111021135240-0qjjs9p7y92ed1nr
---
addons/account_voucher/account_voucher.py | 88 ++++++++++++-------
.../voucher_payment_receipt_view.xml | 59 +++++++------
2 files changed, 88 insertions(+), 59 deletions(-)
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index d2f9d230fbd..6d30820d54c 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -39,8 +39,6 @@ class account_voucher(osv.osv):
res[voucher.id] = ok
return res
-
-
def _get_type(self, cr, uid, context=None):
if context is None:
context = {}
@@ -98,7 +96,6 @@ class account_voucher(osv.osv):
journal_id = context.get('journal_id', False)
if journal_id:
journal = journal_pool.browse(cr, uid, journal_id, context=context)
-# currency_id = journal.company_id.currency_id.id
if journal.currency:
return journal.currency.id
return False
@@ -182,6 +179,14 @@ class account_voucher(osv.osv):
res[voucher.id] = abs(voucher.amount - abs(credit - debit))
return res
+ def _paid_amount_in_company_currency(self, cr, uid, ids, name, args, context=None):
+ if not ids: return {}
+ res = {}
+ debit = credit = 0.0
+ for voucher in self.browse(cr, uid, ids, context=context):
+ res[voucher.id] = voucher.amount / voucher.payment_rate
+ return res
+
_name = 'account.voucher'
_description = 'Accounting Voucher'
_order = "date desc, id desc"
@@ -242,6 +247,9 @@ class account_voucher(osv.osv):
'comment': fields.char('Counterpart Comment', size=64, required=True, readonly=True, states={'draft': [('readonly', False)]}),
'analytic_id': fields.many2one('account.analytic.account','Write-Off Analytic Account', readonly=True, states={'draft': [('readonly', False)]}),
'writeoff_amount': fields.function(_get_writeoff_amount, string='Reconcile Amount', type='float', readonly=True),
+ 'payment_rate': fields.float('Payment Rate', digits=(12,6), required=True,
+ help='The rate between the journal currency and the company currency for this particular payment.'),
+ 'paid_amount_in_company_currency': fields.function(_paid_amount_in_company_currency, string='Paid Amount in Company Currency', type='float', readonly=True),
}
_defaults = {
'period_id': _get_period,
@@ -409,6 +417,19 @@ class account_voucher(osv.osv):
return default
+ def onchange_rate(self, cr, uid, ids, rate, amount, context=None):
+ res = {'value': {'paid_amount_in_company_currency': 0.0}}
+ if rate and amount:
+ res['value']['paid_amount_in_company_currency'] = amount / rate
+ return res
+
+ def onchange_amount(self, cr, uid, ids, amount, rate, partner_id, journal_id, currency_id, ttype, date, context=None):
+ res = self.onchange_partner_id(cr, uid, ids, partner_id, journal_id, amount, currency_id, ttype, date, context=context)
+ vals = self.onchange_rate(cr, uid, ids, rate, amount, context=context)
+ for key in vals.keys():
+ res[key].update(vals[key])
+ return res
+
def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=None):
"""
Returns a dict that contains new values and context
@@ -421,8 +442,6 @@ class account_voucher(osv.osv):
"""
if context is None:
context = {}
- if not journal_id:
- return {}
context_multi_currency = context.copy()
if date:
context_multi_currency.update({'date': date})
@@ -433,12 +452,9 @@ class account_voucher(osv.osv):
journal_pool = self.pool.get('account.journal')
line_pool = self.pool.get('account.voucher.line')
- #get default values
- vals = self.onchange_journal(cr, uid, ids, journal_id, [], False, partner_id, context)
- vals = vals.get('value')
- currency_id = vals.get('currency_id', currency_id)
+ #set default values
default = {
- 'value':{'line_ids':[], 'line_dr_ids':[], 'line_cr_ids':[], 'pre_line': False, 'currency_id':currency_id},
+ 'value': {'line_ids': [] ,'line_dr_ids': [] ,'line_cr_ids': [] ,'pre_line': False,},
}
#drop existing lines
@@ -446,7 +462,7 @@ class account_voucher(osv.osv):
if line_ids:
line_pool.unlink(cr, uid, line_ids)
- if not partner_id:
+ if not partner_id or not journal_id:
return default
journal = journal_pool.browse(cr, uid, journal_id, context=context)
@@ -565,23 +581,30 @@ class account_voucher(osv.osv):
default['value']['writeoff_amount'] = self._compute_writeoff_amount(cr, uid, default['value']['line_dr_ids'], default['value']['line_cr_ids'], price)
return default
- def onchange_date(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=None):
+ def onchange_date(self, cr, uid, ids, date, currency_id, amount, context=None):
"""
@param date: latest value from user input for field date
@param args: other arguments
@param context: context arguments, like lang, time zone
@return: Returns a dict which contains new values, and context
"""
+ res = {'value': {}}
+ #set the period of the voucher
period_pool = self.pool.get('account.period')
- res = self.onchange_partner_id(cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=context)
pids = period_pool.search(cr, uid, [('date_start', '<=', date), ('date_stop', '>=', date)])
if pids:
- if not 'value' in res:
- res['value'] = {}
res['value'].update({'period_id':pids[0]})
+ #set the default payment rate of the voucher and compute the paid amount in company currency
+ payment_rate = 1.0
+ if currency_id:
+ payment_rate = self.pool.get('res.currency').browse(cr, uid, currency_id, context={'date': date}).rate
+ res['value'].update({'payment_rate': payment_rate})
+ vals = self.onchange_rate(cr, uid, ids, payment_rate, amount, context=context)
+ for key in vals.keys():
+ res[key].update(vals[key])
return res
- def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context=None):
+ def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, date, amount, ttype, context=None):
if not journal_id:
return False
journal_pool = self.pool.get('account.journal')
@@ -593,10 +616,18 @@ class account_voucher(osv.osv):
vals = self.onchange_price(cr, uid, ids, line_ids, tax_id, partner_id, context)
vals['value'].update({'tax_id':tax_id})
- currency_id = False #journal.company_id.currency_id.id
+ currency_id = False
if journal.currency:
currency_id = journal.currency.id
- vals['value'].update({'currency_id':currency_id})
+ payment_rate = self.pool.get('res.currency').browse(cr, uid, currency_id, context={'date': date}).rate
+ vals['value'].update({'payment_rate': payment_rate})
+ res = self.onchange_rate(cr, uid, ids, payment_rate, amount, context=context)
+ for key in res.keys():
+ vals[key].update(res[key])
+ vals['value'].update({'currency_id': currency_id})
+ res = self.onchange_partner_id(cr, uid, ids, partner_id, journal_id, amount, currency_id, ttype, date, context)
+ for key in res.keys():
+ vals[key].update(res[key])
return vals
def proforma_voucher(self, cr, uid, ids, context=None):
@@ -640,7 +671,6 @@ class account_voucher(osv.osv):
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Voucher(s) which are already opened or paid !'))
return super(account_voucher, self).unlink(cr, uid, ids, context=context)
- # TODO: may be we can remove this method if not used anyware
def onchange_payment(self, cr, uid, ids, pay_now, journal_id, partner_id, ttype='sale'):
res = {}
if not partner_id:
@@ -699,9 +729,9 @@ class account_voucher(osv.osv):
# TODO: Make this logic available.
# -for sale, purchase we have but for the payment and receipt we do not have as based on the bank/cash journal we can not know its payment or receipt
if voucher_brw.type in ('purchase', 'payment'):
- credit = currency_obj.compute(cr, uid, current_currency, company_currency, voucher_brw.amount, context=context)
+ credit = voucher_brw.amount / voucher_brw.payment_rate
elif voucher_brw.type in ('sale', 'receipt'):
- debit = currency_obj.compute(cr, uid, current_currency, company_currency, voucher_brw.amount, context=context)
+ debit = voucher_brw.amount / voucher_brw.payment_rate
if debit < 0: credit = -debit; debit = 0.0
if credit < 0: debit = -credit; credit = 0.0
sign = debit - credit < 0 and -1 or 1
@@ -826,10 +856,10 @@ class account_voucher(osv.osv):
continue
#we check if the voucher line is fully paid or not and create a move line to balance the payment and initial invoice if needed
if line.amount == line.amount_unreconciled:
- amount = currency_obj.compute(cr, uid, current_currency, company_currency, line.untax_amount or line.amount, context=context)
+ amount = (line.untax_amount or line.amount) / voucher_brw.payment_rate
amount_residual = line.move_line_id.amount_residual - amount #residual amount in company currency
else:
- amount = currency_obj.compute(cr, uid, current_currency, company_currency, line.untax_amount or line.amount, context=context)
+ amount = (line.untax_amount or line.amount) / voucher_brw.payment_rate
amount_residual = 0.0
move_line = {
'journal_id': voucher_brw.journal_id.id,
@@ -979,9 +1009,9 @@ class account_voucher(osv.osv):
line_total = move_line_brw.debit - move_line_brw.credit
rec_list_ids = []
if voucher.type == 'sale':
- line_total = line_total - currency_pool.compute(cr, uid, current_currency, company_currency, voucher.tax_amount, context=context)
+ line_total = line_total - (voucher.tax_amount / voucher.payment_rate)
elif voucher.type == 'purchase':
- line_total = line_total + currency_pool.compute(cr, uid, current_currency, company_currency, voucher.tax_amount, context=context)
+ line_total = line_total + (voucher.tax_amount / voucher.payment_rate)
#create one move line per voucher line where amount is not 0.0
line_total, rec_list_ids = self.voucher_move_line_create(cr, uid, voucher.id, line_total, move_id, company_currency, current_currency, context)
@@ -1181,17 +1211,10 @@ class account_bank_statement_line(osv.osv):
def _amount_reconciled(self, cursor, user, ids, name, args, context=None):
if not ids:
return {}
-
res = {}
-# company_currency_id = False
for line in self.browse(cursor, user, ids, context=context):
-# if not company_currency_id:
-# company_currency_id = line.company_id.id
if line.voucher_id:
res[line.id] = line.voucher_id.amount#
-# res_currency_obj.compute(cursor, user,
-# company_currency_id, line.statement_id.currency.id,
-# line.voucher_id.amount, context=context)
else:
res[line.id] = 0.0
return res
@@ -1212,7 +1235,6 @@ class account_bank_statement_line(osv.osv):
'amount_reconciled': fields.function(_amount_reconciled,
string='Amount reconciled', type='float'),
'voucher_id': fields.many2one('account.voucher', 'Payment'),
-
}
def unlink(self, cr, uid, ids, context=None):
diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml
index 0ddc868cb45..c1c7f076c9f 100644
--- a/addons/account_voucher/voucher_payment_receipt_view.xml
+++ b/addons/account_voucher/voucher_payment_receipt_view.xml
@@ -75,13 +75,13 @@