From 28c4e5530f062cc7c618c67810220e5126330d5e Mon Sep 17 00:00:00 2001 From: Stuart Longland Date: Fri, 23 Mar 2012 15:21:46 +1000 Subject: [PATCH 001/356] faces: Fix 24-hour and end-at-midnight timespans In cases where a working day either: - Spans 24 hours or - ends at midnight the time span calculation code incorrectly calculates the time of that day, either stating that the day is 0 minutes long, or worse, is negative. The following patch addresses this. Non-working days are specified using the Python 'None', or 'False' values, rather than specifying the same start and end time, as the latter will now be interpreted as a 24-hour period. bzr revid: me@vk4msl.yi.org-20120323052146-vosvz50lg12n7e1i --- addons/resource/faces/pcalendar.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/resource/faces/pcalendar.py b/addons/resource/faces/pcalendar.py index c82c49d4816..4b023911b1e 100644 --- a/addons/resource/faces/pcalendar.py +++ b/addons/resource/faces/pcalendar.py @@ -895,7 +895,16 @@ class Calendar(object): def _recalc_working_time(self): def slot_sum_time(day): slots = self.working_times.get(day, DEFAULT_WORKING_DAYS[day]) - return sum(map(lambda slot: slot[1] - slot[0], slots)) + def time_diff(times): + (start, end) = times + if end == start: + return 24*60 # 24 hours + + diff = end - start + if end < start: + diff += (24*60) + return diff + return sum(map(time_diff, slots)) self.day_times = map(slot_sum_time, range(0, 7)) self.week_time = sum(self.day_times) From 5c4dba40f74f09d5ff0856fb9904f61ff792656e Mon Sep 17 00:00:00 2001 From: Stuart Longland Date: Fri, 23 Mar 2012 15:22:50 +1000 Subject: [PATCH 002/356] resource: Convert working hours to UTC Faces assumes that all times are given in the same timezone. OpenERP uses UTC internally, and uses UTC when communicating task and project start/end times to faces. It unfortunately gives the working hours in local time. The following converts the time zone to UTC, assuming that the working hours are in the time zone of the currently logged-in user. (This will have to be fixed to convert each resources' calendar from the resource's local time zone to UTC.) bzr revid: me@vk4msl.yi.org-20120323052250-m03bth2dy755hw1p --- addons/resource/resource.py | 145 ++++++++++++++++++++++++------------ 1 file changed, 99 insertions(+), 46 deletions(-) diff --git a/addons/resource/resource.py b/addons/resource/resource.py index fb3d8c0980e..b3bfcea9664 100644 --- a/addons/resource/resource.py +++ b/addons/resource/resource.py @@ -19,7 +19,7 @@ # ############################################################################## -from datetime import datetime, timedelta +from datetime import datetime, timedelta, time, date import math from faces import * from osv import fields, osv @@ -28,6 +28,7 @@ from tools.translate import _ from itertools import groupby from operator import itemgetter +import pytz class resource_calendar(osv.osv): _name = "resource.calendar" @@ -279,8 +280,9 @@ def convert_timeformat(time_string): hour_part = split_list[0] mins_part = split_list[1] round_mins = int(round(float(mins_part) * 60,-2)) - converted_string = hour_part + ':' + str(round_mins)[0:2] - return converted_string + return time(int(hour_part), round_mins) + #converted_string = hour_part + ':' + str(round_mins)[0:2] + #return converted_string class resource_resource(osv.osv): _name = "resource.resource" @@ -366,51 +368,102 @@ class resource_resource(osv.osv): Change the format of working calendar from 'Openerp' format to bring it into 'Faces' format. @param calendar_id : working calendar of the project """ + tz = pytz.utc + if context and ('tz' in context): + tz = pytz.timezone(context['tz']) + + wktime_local = None + week_days = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'] if not calendar_id: - # Calendar is not specified: working days: 24/7 - return [('fri', '8:0-12:0','13:0-17:0'), ('thu', '8:0-12:0','13:0-17:0'), ('wed', '8:0-12:0','13:0-17:0'), - ('mon', '8:0-12:0','13:0-17:0'), ('tue', '8:0-12:0','13:0-17:0')] - resource_attendance_pool = self.pool.get('resource.calendar.attendance') - time_range = "8:00-8:00" - non_working = "" - week_days = {"0": "mon", "1": "tue", "2": "wed","3": "thu", "4": "fri", "5": "sat", "6": "sun"} - wk_days = {} - wk_time = {} - wktime_list = [] + # Calendar is not specified: working days: some sane default + wktime_local = [ + (0, time(8,0), time(12,0)), + (0, time(13,0), time(17,0)), + (1, time(8,0), time(12,0)), + (1, time(13,0), time(17,0)), + (2, time(8,0), time(12,0)), + (2, time(13,0), time(17,0)), + (3, time(8,0), time(12,0)), + (3, time(13,0), time(17,0)), + (4, time(8,0), time(12,0)), + (4, time(13,0), time(17,0)), + ] + #return [('fri', '8:0-12:0','13:0-17:0'), ('thu', '8:0-12:0','13:0-17:0'), ('wed', '8:0-12:0','13:0-17:0'), + # ('mon', '8:0-12:0','13:0-17:0'), ('tue', '8:0-12:0','13:0-17:0')] + else: + resource_attendance_pool = self.pool.get('resource.calendar.attendance') + non_working = "" + wktime_local = [] + + week_ids = resource_attendance_pool.search(cr, uid, [('calendar_id', '=', calendar_id)], context=context) + weeks = resource_attendance_pool.read(cr, uid, week_ids, ['dayofweek', 'hour_from', 'hour_to'], context=context) + # Convert time formats into appropriate format required + # and create lists inside wktime_local. + for week in weeks: + res_str = "" + day = None + if week['dayofweek']: + day = int(week['dayofweek']) + else: + raise osv.except_osv(_('Configuration Error!'),_('Make sure the Working time has been configured with proper week days!')) + hour_from = convert_timeformat(week['hour_from']) + hour_to = convert_timeformat(week['hour_to']) + wktime_local.append((day, hour_from, hour_to)) + + # We now have working hours _in local time_. Non-working days are an + # empty list, while working days are a list of tuples, consisting of a + # start time and an end time. We will convert these to UTC for time + # calculation purposes. + + # We need to get this into a dict + # which will be in the following format: + # { 'day': [(time(9,0), time(17,0)), ...], ... } + wktime_utc = {} + + # NOTE: This may break with regards to DST! + for (day, start, end) in wktime_local: + # Convert start time to UTC + start_dt_local = datetime.combine(date.today(), start.replace(tzinfo=tz)) + start_dt_utc = start_dt_local.astimezone(pytz.utc) + start_dt_day = (day + (start_dt_utc.date() - start_dt_local.date()).days) % 7 + + # Convert end time to UTC + end_dt_local = datetime.combine(date.today(), end.replace(tzinfo=tz)) + end_dt_utc = end_dt_local.astimezone(pytz.utc) + end_dt_day = (day + (end_dt_utc.date() - end_dt_local.date()).days) % 7 + + # Are start and end still on the same day? + if start_dt_day == end_dt_day: + day_name = week_days[start_dt_day] + if day_name not in wktime_utc: + wktime_utc[day_name] = [] + wktime_utc[day_name].append((start_dt_utc.time(), end_dt_utc.time())) + else: + day_start_name = week_days[start_dt_day] + if day_start_name not in wktime_utc: + wktime_utc[day_start_name] = [] + # We go until midnight that day + wktime_utc[day_start_name].append((start_dt_utc.time(), time(0,0))) + + day_end_name = week_days[end_dt_day] + if day_end_name not in wktime_utc: + wktime_utc[day_end_name] = [] + # Then resume from midnight that day + wktime_utc[day_end_name].append((time(0,0), end_dt_utc.time())) + + # Now having gotten a list of times together, generate the final output wktime_cal = [] - week_ids = resource_attendance_pool.search(cr, uid, [('calendar_id', '=', calendar_id)], context=context) - weeks = resource_attendance_pool.read(cr, uid, week_ids, ['dayofweek', 'hour_from', 'hour_to'], context=context) - # Convert time formats into appropriate format required - # and create a list like [('mon', '8:00-12:00'), ('mon', '13:00-18:00')] - for week in weeks: - res_str = "" - day = None - if week_days.get(week['dayofweek'],False): - day = week_days[week['dayofweek']] - wk_days[week['dayofweek']] = week_days[week['dayofweek']] - else: - raise osv.except_osv(_('Configuration Error!'),_('Make sure the Working time has been configured with proper week days!')) - hour_from_str = convert_timeformat(week['hour_from']) - hour_to_str = convert_timeformat(week['hour_to']) - res_str = hour_from_str + '-' + hour_to_str - wktime_list.append((day, res_str)) - # Convert into format like [('mon', '8:00-12:00', '13:00-18:00')] - for item in wktime_list: - if wk_time.has_key(item[0]): - wk_time[item[0]].append(item[1]) - else: - wk_time[item[0]] = [item[0]] - wk_time[item[0]].append(item[1]) - for k,v in wk_time.items(): - wktime_cal.append(tuple(v)) - # Add for the non-working days like: [('sat, sun', '8:00-8:00')] - for k, v in wk_days.items(): - if week_days.has_key(k): - week_days.pop(k) - for v in week_days.itervalues(): - non_working += v + ',' - if non_working: - wktime_cal.append((non_working[:-1], time_range)) + for day, times in wktime_utc.iteritems(): + # Sort the times + times.sort() + wktime = ['{0}-{1}'.format(s.strftime('%H:%M'), e.strftime('%H:%M')) for (s, e) in times] + wktime.insert(0, day) + wktime_cal.append(tuple(wktime)) + # Finally, add in non-working days + for day in week_days: + if day not in wktime_utc: + wktime_cal.append((day, None)) + return wktime_cal resource_resource() From 42ffccfa96a71a8abacaa86b45e2f9bfcb78ab6a Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 11 Jul 2012 13:14:34 +0200 Subject: [PATCH 003/356] Add a "Supplier Payment Term" on res.partner Add payment term on purchase.order bzr revid: alexis@via.ecp.fr-20120711111434-ih20ohy81bynn1wd --- addons/account/account.py | 7 ++++++- addons/account/account_invoice.py | 6 ++++-- addons/account/account_move_line.py | 15 +++++++++++---- addons/account/demo/account_demo.xml | 16 ++++++++++++++++ addons/account/partner.py | 11 +++++++++-- addons/account/partner_view.xml | 3 ++- addons/base_vat/base_vat_view.xml | 2 +- addons/purchase/purchase.py | 19 +++++++++++++------ addons/purchase/purchase_view.xml | 1 + addons/purchase/stock.py | 3 +++ .../purchase/wizard/purchase_line_invoice.py | 6 +----- addons/stock/stock.py | 4 +++- 12 files changed, 70 insertions(+), 23 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index caf1d68c45d..132bee96bce 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2281,8 +2281,13 @@ class account_model(osv.osv): if not line.partner_id: raise osv.except_osv(_('Error !'), _("Maturity date of entry line generated by model line '%s' of model '%s' is based on partner payment term!" \ "\nPlease define partner on it!")%(line.name, model.name)) - if line.partner_id.property_payment_term: + + payment_term_id = False + if model.journal_id.type in ('purchase', 'purchase_refund') and line.partner_id.property_supplier_payment_term: + payment_term_id = line.partner_id.property_supplier_payment_term.id + elif line.partner_id.property_payment_term: payment_term_id = line.partner_id.property_payment_term.id + if payment_term_id: pterm_list = pt_obj.compute(cr, uid, payment_term_id, value=1, date_ref=date_maturity) if pterm_list: pterm_list = [l[0] for l in pterm_list] diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index c6011979f8d..3965050a5a2 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -216,7 +216,7 @@ class account_invoice(osv.osv): 'date_invoice': fields.date('Invoice Date', readonly=True, states={'draft':[('readonly',False)]}, select=True, help="Keep empty to use the current date"), 'date_due': fields.date('Due Date', states={'paid':[('readonly',True)], 'open':[('readonly',True)], 'close':[('readonly',True)]}, select=True, help="If you use payment terms, the due date will be computed automatically at the generation "\ - "of accounting entries. If you keep the payment term and the due date empty, it means direct payment. The payment term may compute several due dates, for example 50% now, 50% in one month."), + "of accounting entries. If you want to force a due date, make sure that the payment term is not set on the invoice. If you keep the payment term and the due date empty, it means direct payment."), 'partner_id': fields.many2one('res.partner', 'Partner', change_default=True, readonly=True, required=True, states={'draft':[('readonly',False)]}), 'payment_term': fields.many2one('account.payment.term', 'Payment Term',readonly=True, states={'draft':[('readonly',False)]}, help="If you use payment terms, the due date will be computed automatically at the generation "\ @@ -468,10 +468,11 @@ class account_invoice(osv.osv): if type in ('out_invoice', 'out_refund'): acc_id = p.property_account_receivable.id + partner_payment_term = p.property_payment_term and p.property_payment_term.id or False else: acc_id = p.property_account_payable.id + partner_payment_term = p.property_supplier_payment_term and p.property_supplier_payment_term.id or False fiscal_position = p.property_account_position and p.property_account_position.id or False - partner_payment_term = p.property_payment_term and p.property_payment_term.id or False if p.bank_ids: bank_id = p.bank_ids[0].id @@ -733,6 +734,7 @@ class account_invoice(osv.osv): def action_date_assign(self, cr, uid, ids, *args): for inv in self.browse(cr, uid, ids): res = self.onchange_payment_term_date_invoice(cr, uid, inv.id, inv.payment_term.id, inv.date_invoice) + print "action_date_assign res=", res if res and res['value']: self.write(cr, uid, [inv.id], res['value']) return True diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 95b53b51339..00aa1d9a64d 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -652,17 +652,24 @@ class account_move_line(osv.osv): return {'value':val} if not date: date = datetime.now().strftime('%Y-%m-%d') + jt = False + if journal: + jt = journal_obj.browse(cr, uid, journal).type part = partner_obj.browse(cr, uid, partner_id) - if part.property_payment_term: - res = payment_term_obj.compute(cr, uid, part.property_payment_term.id, 100, date) + payment_term_id = False + if jt and jt in ('purchase', 'purchase_refund') and part.property_supplier_payment_term: + payment_term_id = part.property_supplier_payment_term.id + elif jt and part.property_payment_term: + payment_term_id = part.property_payment_term.id + if payment_term_id: + res = payment_term_obj.compute(cr, uid, payment_term_id, 100, date) if res: val['date_maturity'] = res[0][0] if not account_id: id1 = part.property_account_payable.id id2 = part.property_account_receivable.id - if journal: - jt = journal_obj.browse(cr, uid, journal).type + if jt: if jt in ('sale', 'purchase_refund'): val['account_id'] = fiscal_pos_obj.map_account(cr, uid, part and part.property_account_position or False, id2) elif jt in ('purchase', 'sale_refund'): diff --git a/addons/account/demo/account_demo.xml b/addons/account/demo/account_demo.xml index 0dff40ca19f..2cae1eb81a1 100644 --- a/addons/account/demo/account_demo.xml +++ b/addons/account/demo/account_demo.xml @@ -131,5 +131,21 @@ + + + + + + + + + + + + + + + + diff --git a/addons/account/partner.py b/addons/account/partner.py index 36fd88183f2..67f20b3f618 100644 --- a/addons/account/partner.py +++ b/addons/account/partner.py @@ -180,9 +180,16 @@ class res_partner(osv.osv): 'account.payment.term', type='many2one', relation='account.payment.term', - string ='Payment Term', + string ='Customer Payment Term', view_load=True, - help="This payment term will be used instead of the default one for the current partner"), + help="This payment term will be used instead of the default one for sale orders and customer invoices"), + 'property_supplier_payment_term': fields.property( + 'account.payment.term', + type='many2one', + relation='account.payment.term', + string ='Supplier Payment Term', + view_load=True, + help="This payment term will be used instead of the default one for purchase orders and supplier invoices"), 'ref_companies': fields.one2many('res.company', 'partner_id', 'Companies that refers to partner'), 'last_reconciliation_date': fields.datetime('Latest Reconciliation Date', help='Date on which the partner accounting entries were reconciled last time') diff --git a/addons/account/partner_view.xml b/addons/account/partner_view.xml index ec3dcba3b84..8f4f4f6f654 100644 --- a/addons/account/partner_view.xml +++ b/addons/account/partner_view.xml @@ -79,11 +79,12 @@ - + + diff --git a/addons/base_vat/base_vat_view.xml b/addons/base_vat/base_vat_view.xml index 1d7f06eb571..346bdd02d4f 100644 --- a/addons/base_vat/base_vat_view.xml +++ b/addons/base_vat/base_vat_view.xml @@ -7,7 +7,7 @@ res.partner - +
-You can write a query in order to create Consistency Test and you will get the result of the test 
-in PDF format which can be accessed by Menu Reporting -> Accounting Tests, then select the test 
-and print the report from Print button in header area.
+Code should always return a result value. If result is an empty list, it means that
+the test is succesful. Otherwise it will print what is inside result.
+Code must be python with correct indentation (if needed).
+Here is a list of function that you can use in your test :
+ - group(lst, col) : 
+ - reconciled_inv() : return the list of all reconciled invoices
+ - get_parent(acc_id) : get parent analytical account
+ - now() : return current datetime
 
-You can also use the following functions:
-
-get_parent(acc_id) : return parent id of analytic account(acc_id)
-reconciled_inv() : returns ids of records which are reconciled
-    
 Example: 
 sql = 'select id, name, ref, date from account_move_line where account_id in 
 (select id from account_account where type = 'view')'

From 6fa5b85564173b466d91671c25606816c98ce784 Mon Sep 17 00:00:00 2001
From: Antonin Bourguignon 
Date: Tue, 27 Nov 2012 15:26:28 +0100
Subject: [PATCH 116/356] [IMP] add documentation

bzr revid: abo@openerp.com-20121127142628-ngmkhjyytrqyy9c0
---
 addons/crm/crm_lead.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py
index bf54f412d12..51bfa37d10b 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -733,6 +733,18 @@ class crm_lead(base_stage, format_address, osv.osv):
         return partner_ids
 
     def allocate_salesman(self, cr, uid, ids, user_ids, team_id=False, context=None):
+        """
+        Assign salesmen and salesteam to a batch of leads.  If there are more
+        leads than salesmen, these salesmen will be assigned in round-robin.
+        E.g.: 4 salesmen (S1, S2, S3, S4) for 6 leads (L1, L2, ... L6).  They
+        will be assigned as followed: L1 - S1, L2 - S2, L3 - S3, L4 - S4,
+        L5 - S1, L6 - S2.
+
+        :param list ids: leads/opportunities ids to process
+        :param list user_ids: salesmen to assign
+        :param int team_id: salesteam to assign
+        :return bool
+        """
         index = 0
         for lead_id in ids:
             value = {}
@@ -747,7 +759,7 @@ class crm_lead(base_stage, format_address, osv.osv):
 
     def schedule_phonecall(self, cr, uid, ids, schedule_time, call_summary, desc, phone, contact_name, user_id=False, section_id=False, categ_id=False, action='schedule', context=None):
         """
-        action :('schedule','Schedule a call'), ('log','Log a call')
+        :param string action: ('schedule','Schedule a call'), ('log','Log a call')
         """
         phonecall = self.pool.get('crm.phonecall')
         model_data = self.pool.get('ir.model.data')

From 34aa66449ced4ea133ea960e8fdb40ef9cee49b0 Mon Sep 17 00:00:00 2001
From: Antonin Bourguignon 
Date: Tue, 27 Nov 2012 17:49:40 +0100
Subject: [PATCH 117/356] [IMP] indentation

bzr revid: abo@openerp.com-20121127164940-g31ywi5abnfslyfl
---
 addons/crm/crm_lead.py | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py
index 51bfa37d10b..b0ea30f58b4 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -637,17 +637,17 @@ class crm_lead(base_stage, format_address, osv.osv):
         stage_id = stage_ids and stage_ids[0] or False
 
         return {
-                'planned_revenue': lead.planned_revenue,
-                'probability': lead.probability,
-                'name': lead.name,
-                'partner_id': customer and customer.id or False,
-                'user_id': (lead.user_id and lead.user_id.id),
-                'type': 'opportunity',
-                'stage_id': stage_id or False,
-                'date_action': time.strftime('%Y-%m-%d %H:%M:%S'),
-                'date_open': time.strftime('%Y-%m-%d %H:%M:%S'),
-                'email_from': customer and customer.email or lead.email_from,
-                'phone': customer and customer.phone or lead.phone,
+            'planned_revenue': lead.planned_revenue,
+            'probability': lead.probability,
+            'name': lead.name,
+            'partner_id': customer and customer.id or False,
+            'user_id': (lead.user_id and lead.user_id.id),
+            'type': 'opportunity',
+            'stage_id': stage_id or False,
+            'date_action': time.strftime('%Y-%m-%d %H:%M:%S'),
+            'date_open': time.strftime('%Y-%m-%d %H:%M:%S'),
+            'email_from': customer and customer.email or lead.email_from,
+            'phone': customer and customer.phone or lead.phone,
         }
 
     def convert_opportunity(self, cr, uid, ids, partner_id, user_ids=False, section_id=False, context=None):

From 26492d98d542859fab450818d1b33a5a5906b0cd Mon Sep 17 00:00:00 2001
From: Antonin Bourguignon 
Date: Tue, 27 Nov 2012 17:54:01 +0100
Subject: [PATCH 118/356] [IMP] properly cycle through the salesmen
 (round-robin) while converting leads into opps with salesmen assignation

bzr revid: abo@openerp.com-20121127165401-s8fgs553gr2amj3u
---
 addons/crm/crm_lead.py                        | 10 +++++++---
 addons/crm/test/process/merge_opportunity.yml |  7 +++----
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py
index b0ea30f58b4..75eaf753009 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -732,7 +732,7 @@ class crm_lead(base_stage, format_address, osv.osv):
             partner_ids[lead.id] = partner_id
         return partner_ids
 
-    def allocate_salesman(self, cr, uid, ids, user_ids, team_id=False, context=None):
+    def allocate_salesman(self, cr, uid, ids, user_ids=None, team_id=False, context=None):
         """
         Assign salesmen and salesteam to a batch of leads.  If there are more
         leads than salesmen, these salesmen will be assigned in round-robin.
@@ -745,14 +745,18 @@ class crm_lead(base_stage, format_address, osv.osv):
         :param int team_id: salesteam to assign
         :return bool
         """
+        if user_ids is None:
+            user_ids = []
         index = 0
+
         for lead_id in ids:
             value = {}
             if team_id:
                 value['section_id'] = team_id
-            if index < len(user_ids):
+            if user_ids:
                 value['user_id'] = user_ids[index]
-                index += 1
+                # Cycle through user_ids
+                index = index+1 if (index < len(user_ids)-1) else 0
             if value:
                 self.write(cr, uid, [lead_id], value, context=context)
         return True
diff --git a/addons/crm/test/process/merge_opportunity.yml b/addons/crm/test/process/merge_opportunity.yml
index 040a5c6e078..285c74d382b 100644
--- a/addons/crm/test/process/merge_opportunity.yml
+++ b/addons/crm/test/process/merge_opportunity.yml
@@ -15,7 +15,6 @@
 -
   !python {model: crm.lead}: |
     merge_id = self.search(cr, uid, [('partner_id','=', ref("base.res_partner_2"))])
-    assert merge_id, 'Fail to create Merge opportunity'
-    merge_data = self.browse(cr, uid, merge_id)[0]
-    assert merge_data.type == 'opportunity', 'Merged opportunity type didn\'t change'
-    assert merge_data.partner_id.id == ref("base.res_partner_2"), 'Partner missmatch'
\ No newline at end of file
+    assert merge_id, 'Fail to create merge opportunity wizard'
+    merge_result = self.browse(cr, uid, merge_id)[0]
+    assert merge_result.partner_id.id == ref("base.res_partner_2"), 'Partner missmatch'
\ No newline at end of file

From 3f626523ac7576ce5711d3274dd223996a3df07e Mon Sep 17 00:00:00 2001
From: "Khushboo Bhatt (Open ERP)" 
Date: Wed, 28 Nov 2012 11:06:58 +0530
Subject: [PATCH 119/356] [IMP]improve code for merge lead/opportunity message

bzr revid: kbh@tinyerp.com-20121128053658-kiosagyvz7s78x4s
---
 addons/crm/crm_lead.py | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py
index 824c509a0fd..5d73a14b692 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -457,7 +457,6 @@ class crm_lead(base_stage, format_address, osv.osv):
 
     def _mail_body(self, cr, uid, lead, fields, title=False, context=None):
         body = []
-        str = ""
         if title:
             body.append("%s\n" % (title))
         for field_name in fields:
@@ -465,7 +464,7 @@ class crm_lead(base_stage, format_address, osv.osv):
             if field_info is None:
                 continue
             field = field_info.column
-            value = None
+            value = None or ''
 
             if field._type == 'selection':
                 if hasattr(field.selection, '__call__'):
@@ -473,20 +472,18 @@ class crm_lead(base_stage, format_address, osv.osv):
                 else:
                     key = field.selection
                 value = dict(key).get(lead[field_name], lead[field_name])
-                body.append("%s: %s" % (field.string, value or ''))
             elif field._type == 'many2one':
                 if lead[field_name]:
                     value = lead[field_name].name_get()[0][1]
-                    body.append("%s: %s" % (field.string, value or ''))
             elif field._type == 'many2many':
                 if lead[field_name]:
                     for val in lead[field_name]:
                         field_value = val.name_get()[0][1]
-                        str += field_value + ","
-                    body.append("%s: %s" % (field.string, str or ''))
+                        value += field_value + ","
             else:
                 value = lead[field_name]
-                body.append("%s: %s" % (field.string, value or ''))
+
+            body.append("%s: %s" % (field.string, value or ''))
         return "\n".join(body + ['---'])
 
     def _merge_notification(self, cr, uid, opportunity_id, opportunities, context=None):

From 2a5e4e9308c903b5ad997e2e1ebdaccd70bec995 Mon Sep 17 00:00:00 2001
From: "Khushboo Bhatt (Open ERP)" 
Date: Wed, 28 Nov 2012 11:23:37 +0530
Subject: [PATCH 120/356] [IMP]improve code

bzr revid: kbh@tinyerp.com-20121128055337-0s5cz2gkaou7unj0
---
 addons/crm/crm_lead.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py
index 5d73a14b692..c66cf23c040 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -464,7 +464,7 @@ class crm_lead(base_stage, format_address, osv.osv):
             if field_info is None:
                 continue
             field = field_info.column
-            value = None or ''
+            value = ''
 
             if field._type == 'selection':
                 if hasattr(field.selection, '__call__'):

From 05573bb9359198d877059306a12699634d0050a8 Mon Sep 17 00:00:00 2001
From: "Nimesh (Open ERP)" 
Date: Wed, 28 Nov 2012 15:04:48 +0530
Subject: [PATCH 121/356] [IMP] improve onchge.

bzr revid: nco@tinyerp.com-20121128093448-i70yati7mdcr5o1f
---
 addons/account_asset/account_asset.py       | 2 +-
 addons/account_asset/account_asset_view.xml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/addons/account_asset/account_asset.py b/addons/account_asset/account_asset.py
index 70cc2c46bfe..3190801764b 100644
--- a/addons/account_asset/account_asset.py
+++ b/addons/account_asset/account_asset.py
@@ -223,7 +223,7 @@ class account_asset_asset(osv.osv):
                 val['currency_id'] = company.currency_id.id
         return {'value': val}
     
-    def onchange_purchase_salvage_value(self, cr, uid, ids, purchase_value, salvage_value=0.0, context=None):
+    def onchange_purchase_salvage_value(self, cr, uid, ids, purchase_value, salvage_value, context=None):
         val = {}
         for asset in self.browse(cr, uid, ids, context=context):
             if purchase_value:
diff --git a/addons/account_asset/account_asset_view.xml b/addons/account_asset/account_asset_view.xml
index 63b9260b1b2..c4cb17bded3 100644
--- a/addons/account_asset/account_asset_view.xml
+++ b/addons/account_asset/account_asset_view.xml
@@ -108,7 +108,7 @@
                         
                             
                                 
-                                    
+                                    
                                     
                                     
                                     

From fbb4e61d718d6039d6c4ce625ed7c98cde859444 Mon Sep 17 00:00:00 2001
From: "Jalpesh Patel (OpenERP)" 
Date: Wed, 28 Nov 2012 17:44:01 +0530
Subject: [PATCH 122/356] [FIX]fix problem of POS Receipt missing space

bzr revid: pja@tinyerp.com-20121128121401-99mszzxiio5ewd3q
---
 addons/point_of_sale/static/src/xml/pos.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml
index 33935b85d12..41a061e78b4 100644
--- a/addons/point_of_sale/static/src/xml/pos.xml
+++ b/addons/point_of_sale/static/src/xml/pos.xml
@@ -563,7 +563,7 @@
         
+ Date.CultureInfo.formatPatterns.longTime)"/>


Phone:
From 707d973463d5ffe1c5d7684f0ec5cca8f459d496 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Thu, 29 Nov 2012 10:17:47 +0530 Subject: [PATCH 123/356] [FIX]: Remove note field form po order_lines in report bzr revid: atp@tinyerp.com-20121129044747-czqo776lkt2f1jol --- addons/purchase/report/request_quotation.rml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/purchase/report/request_quotation.rml b/addons/purchase/report/request_quotation.rml index c1500c48710..11c69a1946c 100644 --- a/addons/purchase/report/request_quotation.rml +++ b/addons/purchase/report/request_quotation.rml @@ -32,7 +32,6 @@ - @@ -167,4 +166,4 @@ [[ user.signature or '' ]] - + \ No newline at end of file From 4f0d88eae708f21ebe37c7ba1611ac38bbe6f586 Mon Sep 17 00:00:00 2001 From: "Randhir Mayatra (OpenERP)" Date: Thu, 29 Nov 2012 11:01:12 +0530 Subject: [PATCH 124/356] [IMP] improve the code bzr revid: rma@tinyerp.com-20121129053112-fiq8k4w56crv3q4x --- addons/pad/static/src/xml/pad.xml | 2 +- addons/project/project_view.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/pad/static/src/xml/pad.xml b/addons/pad/static/src/xml/pad.xml index eaa519dc04b..bd3e296f9b3 100644 --- a/addons/pad/static/src/xml/pad.xml +++ b/addons/pad/static/src/xml/pad.xml @@ -8,7 +8,7 @@

- You must configure the etherpad through the menu Setting > Companies > Companies, in the configuration tab of your company. + You must configure the etherpad through the menu Settings > Companies > Companies, in the configuration tab of your company.

diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index d79689fde3f..f54fb20ea20 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -423,7 +423,7 @@
- + From fef66bb5d551b7674a55a2e394f9a9bc35611e16 Mon Sep 17 00:00:00 2001 From: "Jalpesh Patel (OpenERP)" Date: Thu, 29 Nov 2012 11:27:43 +0530 Subject: [PATCH 125/356] [Fix]fix problem of number always skip when create new sales 0rder bzr revid: pja@tinyerp.com-20121129055743-yskji2sxhl0w20x4 --- addons/sale/sale.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 18947d5d7b4..6dbc237dfec 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -242,7 +242,7 @@ class sale_order(osv.osv): 'order_policy': 'manual', 'state': 'draft', 'user_id': lambda obj, cr, uid, context: uid, - 'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'sale.order'), + 'name': lambda obj, cr, uid, context: '/', 'invoice_quantity': 'order', 'partner_invoice_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['invoice'])['invoice'], 'partner_shipping_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['delivery'])['delivery'], @@ -321,6 +321,8 @@ class sale_order(osv.osv): return {'value': val} def create(self, cr, uid, vals, context=None): + if vals.get('name','/')=='/': + vals['name'] = self.pool.get('ir.sequence').get(cr, uid, 'sale.order') or '/' order = super(sale_order, self).create(cr, uid, vals, context=context) if order: self.create_send_note(cr, uid, [order], context=context) From 6fbe94a932f0858727d8cb38560da4ef25a80233 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Thu, 29 Nov 2012 13:03:35 +0530 Subject: [PATCH 126/356] [FIX]: Open sale order line in open formview bzr revid: atp@tinyerp.com-20121129073335-7jkb0m4f8wvy7tvh --- addons/event_sale/event_sale_view.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/event_sale/event_sale_view.xml b/addons/event_sale/event_sale_view.xml index 78af1ffe585..21189968738 100644 --- a/addons/event_sale/event_sale_view.xml +++ b/addons/event_sale/event_sale_view.xml @@ -28,5 +28,11 @@ + + + + + + From 616cbc4b9bb49eaf7d2c731c655b5f90158469f4 Mon Sep 17 00:00:00 2001 From: "Khushboo Bhatt (Open ERP)" Date: Thu, 29 Nov 2012 14:22:06 +0530 Subject: [PATCH 127/356] [REM]sale:removed unnecessary header bzr revid: kbh@tinyerp.com-20121129085206-5a1g7x3dhf15ffzv --- addons/sale/wizard/sale_line_invoice.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/addons/sale/wizard/sale_line_invoice.xml b/addons/sale/wizard/sale_line_invoice.xml index 6144ff489f4..720586e638c 100644 --- a/addons/sale/wizard/sale_line_invoice.xml +++ b/addons/sale/wizard/sale_line_invoice.xml @@ -6,9 +6,6 @@ sale.order.line.make.invoice -
- -

All items in these order lines will be invoiced. You can also invoice a percentage of the sale order or a fixed price (for advances) directly from the sale order form if you prefer. From 5de572c0051440e924418f96fefa14f4d6882c7c Mon Sep 17 00:00:00 2001 From: Tejas Tank Date: Thu, 29 Nov 2012 15:55:43 +0500 Subject: [PATCH 128/356] [IMP] Opportunity, Image show only if sales person linked. bzr revid: tta@openerp.com-20121129105543-or20pf7ul2mztmuo --- addons/crm/crm_lead_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 8b977cfe293..fdbd7cbc987 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -333,7 +333,7 @@

7 7 - +