Merge lp:~openerp-dev/openobject-addons/ksa-addons2 into lp:~openerp-dev/openobject-addons/trunk-dev-addons2

Proposed by Kirti Savalia(OpenERP)
Status: Merged
Merged at revision: 4015
Proposed branch: lp:~openerp-dev/openobject-addons/ksa-addons2
Merge into: lp:~openerp-dev/openobject-addons/trunk-dev-addons2
Diff against target: 432 lines (+82/-55)
16 files modified
base_synchro/wizard/base_synchro.py (+8/-8)
base_synchro/wizard/base_synchro_view.xml (+1/-0)
hr/hr.py (+6/-6)
hr/security/hr_security.xml (+1/-1)
hr_holidays/hr_holidays_view.xml (+2/-2)
hr_timesheet/wizard/hr_timesheet_print_employee.py (+3/-1)
hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py (+3/-0)
hr_timesheet_sheet/hr_timesheet_sheet.py (+1/-1)
mrp/mrp_view.xml (+2/-0)
mrp/wizard/mrp_product_produce.py (+2/-2)
product/product.py (+11/-5)
product/product_view.xml (+1/-1)
project_scrum/wizard/project_scrum_backlog_create_task.py (+3/-0)
project_scrum/wizard/project_scrum_backlog_sprint.py (+3/-0)
purchase_requisition/wizard/purchase_requisition_partner.py (+5/-1)
stock/wizard/stock_inventory_line_split.py (+30/-27)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/ksa-addons2
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+49799@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'base_synchro/wizard/base_synchro.py'
2--- base_synchro/wizard/base_synchro.py 2011-01-14 00:11:01 +0000
3+++ base_synchro/wizard/base_synchro.py 2011-02-17 07:20:39 +0000
4@@ -38,7 +38,7 @@
5 self.rpc = xmlrpclib.ServerProxy(local_url)
6 self.ressource = ressource
7 def __getattr__(self, name):
8- return lambda cr, uid, *args, **kwargs: self.rpc.execute(self.server.server_db, self.uid, self.server.password, self.ressource, name, *args, **kwargs)
9+ return lambda cr, uid, *args, **kwargs: self.rpc.execute(self.server.server_db, self.uid, self.server.password, self.ressource, name, *args)
10
11 class RPCProxy(object):
12 def __init__(self, server):
13@@ -79,6 +79,7 @@
14 eval(object.domain),
15 {'action':'d'}
16 )
17+
18 if object.action in ('u','b'):
19 ids += pool2.get('base.synchro.obj').get_ids(cr, uid,
20 object.model_id.model,
21@@ -102,7 +103,7 @@
22 if object.model_id.model=='crm.case.history':
23 fields = ['email','description','log_id']
24 value = pool_src.get(object.model_id.model).read(cr, uid, [id], fields)[0]
25- value = self.data_transform(cr, uid, pool_src, pool_dest, object.model_id.model, value, action)
26+ value = self.data_transform(cr, uid, pool_src, pool_dest, object.model_id.model, value, action, context=context)
27 id2 = self.get_id(cr, uid, object.id, id, action, context)
28 #
29 # Transform value
30@@ -110,7 +111,6 @@
31 #tid=pool_dest.get(object.model_id.model).name_search(cr, uid, value['name'],[],'=',)
32 if not (iii%50):
33 print 'Record', iii
34-
35 # Filter fields to not sync
36 for field in object.avoid_ids:
37 if field.name in value:
38@@ -133,7 +133,7 @@
39 })
40 self.report_total+=1
41 self.report_create+=1
42- self.meta = {}
43+ self.meta = {}
44 return True
45
46 def get_id(self, cr, uid, object_id, id, action, context=None):
47@@ -216,16 +216,16 @@
48 start_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
49 syn_obj = self.browse(cr, uid, ids, context=context)[0]
50 pool = pooler.get_pool(cr.dbname)
51- server = pool.get('base.synchro.server').browse(cr, uid, ids, context=context)[0]
52+ server = pool.get('base.synchro.server').browse(cr, uid, syn_obj.server_url.id, context=context)
53 for object in server.obj_ids:
54 dt = time.strftime('%Y-%m-%d %H:%M:%S')
55- self.synchronize(cr, uid, server, object, context)
56+ self.synchronize(cr, uid, server, object, context=context)
57 if object.action=='b':
58 time.sleep(1)
59 dt = time.strftime('%Y-%m-%d %H:%M:%S')
60 self.pool.get('base.synchro.obj').write(cr, uid, [object.id], {'synchronize_date': dt})
61 end_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
62- if 'user_id' in syn_obj.user_id:
63+ if syn_obj.user_id:
64 request = pooler.get_pool(cr.dbname).get('res.request')
65 if not self.report:
66 self.report.append('No exception.')
67@@ -244,7 +244,7 @@
68 request.create(cr, uid, {
69 'name' : "Synchronization report",
70 'act_from' : uid,
71- 'act_to' : syn_obj.user_id,
72+ 'act_to' : syn_obj.user_id.id,
73 'body': summary,
74 })
75 return True
76
77=== modified file 'base_synchro/wizard/base_synchro_view.xml'
78--- base_synchro/wizard/base_synchro_view.xml 2011-01-14 00:11:01 +0000
79+++ base_synchro/wizard/base_synchro_view.xml 2011-02-17 07:20:39 +0000
80@@ -25,6 +25,7 @@
81 <field name="res_model">base.synchro</field>
82 <field name="view_type">form</field>
83 <field name="view_mode">form</field>
84+ <field name="view_id" ref="view_base_synchro"/>
85 <field name="target">new</field>
86 </record>
87
88
89=== modified file 'hr/hr.py'
90--- hr/hr.py 2011-01-17 18:02:22 +0000
91+++ hr/hr.py 2011-02-17 07:20:39 +0000
92@@ -204,15 +204,15 @@
93 level -= 1
94 return True
95
96- def _check_department_id(self, cr, uid, ids, context=None):
97- for emp in self.browse(cr, uid, ids, context=context):
98- if emp.department_id.manager_id and emp.id == emp.department_id.manager_id.id:
99- return False
100- return True
101+# def _check_department_id(self, cr, uid, ids, context=None):
102+# for emp in self.browse(cr, uid, ids, context=context):
103+# if emp.department_id.manager_id and emp.id == emp.department_id.manager_id.id:
104+# return False
105+# return True
106
107 _constraints = [
108 (_check_recursion, 'Error ! You cannot create recursive Hierarchy of Employees.', ['parent_id']),
109- (_check_department_id, 'Error ! You cannot select a department for which the employee is the manager.', ['department_id']),
110+# (_check_department_id, 'Error ! You cannot select a department for which the employee is the manager.', ['department_id']),
111 ]
112
113 hr_employee()
114
115=== modified file 'hr/security/hr_security.xml'
116--- hr/security/hr_security.xml 2011-01-14 00:11:01 +0000
117+++ hr/security/hr_security.xml 2011-02-17 07:20:39 +0000
118@@ -7,7 +7,7 @@
119 </record>
120
121 <record id="base.group_hr_user" model="res.groups">
122- <field name="name">Human Resources / User</field>
123+ <field name="name">Human Resources / Officer</field>
124 </record>
125 </data>
126 </openerp>
127
128=== modified file 'hr_holidays/hr_holidays_view.xml'
129--- hr_holidays/hr_holidays_view.xml 2011-01-21 06:59:40 +0000
130+++ hr_holidays/hr_holidays_view.xml 2011-02-17 07:20:39 +0000
131@@ -94,7 +94,7 @@
132 <field name="state" colspan="2"/>
133 <group colspan="2" col="6">
134 <button string="Refuse" name="refuse" states="confirm,validate,validate1" type="workflow" icon="gtk-no" groups="base.group_hr_user,base.group_hr_manager"/>
135- <button string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-yes"/>
136+ <button string="Submit to Manager" name="confirm" states="draft" type="workflow" icon="gtk-yes"/>
137 <button string="Approve" name="validate" states="confirm" type="workflow" icon="gtk-apply" groups="base.group_hr_user"/>
138 <button string="Approved" name="second_validate" states="validate1" type="workflow" icon="gtk-apply" groups="base.group_hr_user"/>
139 <button string="Set to Draft" name="set_to_draft" states="refuse" type="object" icon="gtk-convert" groups="base.group_hr_user"/>
140@@ -414,7 +414,7 @@
141 </record>
142
143 <menuitem sequence="3" id="hr.menu_open_view_attendance_reason_config" parent="hr.menu_hr_configuration" name="Holidays"/>
144-
145+
146 <menuitem name="Leave Type"
147 action="open_view_holiday_status"
148 id="menu_open_view_holiday_status"
149
150=== modified file 'hr_timesheet/wizard/hr_timesheet_print_employee.py'
151--- hr_timesheet/wizard/hr_timesheet_print_employee.py 2011-02-15 13:27:07 +0000
152+++ hr_timesheet/wizard/hr_timesheet_print_employee.py 2011-02-17 07:20:39 +0000
153@@ -31,7 +31,7 @@
154 'Month', required=True),
155 'year': fields.integer('Year', required=True),
156 'employee_id': fields.many2one('hr.employee', 'Employee', required=True)
157-
158+
159 }
160
161 def _get_user(self, cr, uid, context=None):
162@@ -50,6 +50,8 @@
163
164 def print_report(self, cr, uid, ids, context=None):
165 data = self.read(cr, uid, ids, context=context)[0]
166+ if isinstance(data['employee_id'], tuple):
167+ data['employee_id'] = data['employee_id'][0]
168 datas = {
169 'ids': [],
170 'model': 'hr.employee',
171
172=== modified file 'hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py'
173--- hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py 2011-02-15 13:27:07 +0000
174+++ hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py 2011-02-17 07:20:39 +0000
175@@ -59,6 +59,9 @@
176 res = mod_obj.read(cr, uid, result, ['res_id'], context=context)
177
178 data = self.read(cr, uid, ids, [], context=context)[0]
179+ if isinstance(data['balance_product'], tuple):
180+ data['balance_product'] = data['balance_product'][0]
181+
182 account_ids = 'active_ids' in context and context['active_ids'] or []
183
184 for account in analytic_account_obj.browse(cr, uid, account_ids, context=context):
185
186=== modified file 'hr_timesheet_sheet/hr_timesheet_sheet.py'
187--- hr_timesheet_sheet/hr_timesheet_sheet.py 2011-01-17 11:20:56 +0000
188+++ hr_timesheet_sheet/hr_timesheet_sheet.py 2011-02-17 07:20:39 +0000
189@@ -269,7 +269,7 @@
190 'draft': [('readonly', False)],
191 'new': [('readonly', False)]}
192 ),
193- 'attendances_ids' : one2many_mod2('hr.attendance', 'sheet_id', 'Attendances', readonly=True,),
194+ 'attendances_ids' : one2many_mod2('hr.attendance', 'sheet_id', 'Attendances', readonly=True, states={'draft':[('readonly',False)],'new':[('readonly',False)]}),
195 'state' : fields.selection([
196 ('new', 'New'),
197 ('draft','Draft'),
198
199=== modified file 'mrp/mrp_view.xml'
200--- mrp/mrp_view.xml 2011-01-17 08:00:48 +0000
201+++ mrp/mrp_view.xml 2011-02-17 07:20:39 +0000
202@@ -406,6 +406,8 @@
203 <field name="date_stop"/>
204 <field name="product_rounding"/>
205 <field name="product_efficiency" groups="base.group_extended"/>
206+ <separator string="Properties" colspan="4"/>
207+ <newline/>
208 <field colspan="4" name="property_ids" nolabel="2" groups="base.group_extended"/>
209 </page>
210 </notebook>
211
212=== modified file 'mrp/wizard/mrp_product_produce.py'
213--- mrp/wizard/mrp_product_produce.py 2011-02-15 13:27:07 +0000
214+++ mrp/wizard/mrp_product_produce.py 2011-02-17 07:20:39 +0000
215@@ -70,10 +70,10 @@
216 context = {}
217 prod_obj = self.pool.get('mrp.production')
218 move_ids = context.get('active_ids', [])
219- for data in self.read(cr, uid, ids, context=context):
220+ for data in self.browse(cr, uid, ids, context=context):
221 for move_id in move_ids:
222 prod_obj.action_produce(cr, uid, move_id,
223- data['product_qty'], data['mode'], context=context)
224+ data.product_qty, data.mode, context=context)
225 return {}
226
227 mrp_product_produce()
228
229=== modified file 'product/product.py'
230--- product/product.py 2011-02-14 04:47:46 +0000
231+++ product/product.py 2011-02-17 07:20:39 +0000
232@@ -482,7 +482,7 @@
233 'pricelist_id': fields.dummy(string='Pricelist', relation='product.pricelist', type='many2one'),
234 'name_template': fields.related('product_tmpl_id', 'name', string="Name", type='char', size=128, store=True),
235 }
236-
237+
238 def unlink(self, cr, uid, ids, context=None):
239 unlink_ids = []
240 unlink_product_tmpl_ids = []
241@@ -715,10 +715,16 @@
242 result[supplier_info.id]['qty'] = qty
243 return result
244
245- def _get_uom_id(self, cr, uid, *args):
246- cr.execute('select id from product_uom order by id limit 1')
247- res = cr.fetchone()
248- return res and res[0] or False
249+ def _get_uom_id(self, cr, uid, context=None):
250+ if context is None:
251+ context = {}
252+ uom_id = context.get('uom_id', False)
253+ if uom_id:
254+ return uom_id
255+ else:
256+ cr.execute('select id from product_uom order by id limit 1')
257+ res = cr.fetchone()
258+ return res and res[0] or False
259
260 _columns = {
261 'name' : fields.many2one('res.partner', 'Supplier', required=True,domain = [('supplier','=',True)], ondelete='cascade', help="Supplier of this product"),
262
263=== modified file 'product/product_view.xml'
264--- product/product_view.xml 2011-01-17 08:00:48 +0000
265+++ product/product_view.xml 2011-02-17 07:20:39 +0000
266@@ -150,7 +150,7 @@
267
268 </page>
269 <page string="Suppliers">
270- <field colspan="4" name="seller_ids" nolabel="1"/>
271+ <field colspan="4" name="seller_ids" nolabel="1" context="{'uom_id': uom_id}"/>
272 </page>
273 <page string="Descriptions">
274 <separator string="Description"/>
275
276=== modified file 'project_scrum/wizard/project_scrum_backlog_create_task.py'
277--- project_scrum/wizard/project_scrum_backlog_create_task.py 2011-02-15 13:27:07 +0000
278+++ project_scrum/wizard/project_scrum_backlog_create_task.py 2011-02-17 07:20:39 +0000
279@@ -35,6 +35,9 @@
280 ids_task = []
281
282 data = self.read(cr, uid, ids, [], context=context)[0]
283+ if isinstance(data['user_id'], tuple):
284+ data['user_id'] = data['user_id'][0]
285+
286 backlogs = backlog_id.browse(cr, uid, context['active_ids'], context=context)
287 result = mod_obj._get_id(cr, uid, 'project', 'view_task_search_form')
288 id = mod_obj.read(cr, uid, result, ['res_id'])
289
290=== modified file 'project_scrum/wizard/project_scrum_backlog_sprint.py'
291--- project_scrum/wizard/project_scrum_backlog_sprint.py 2011-02-15 13:27:07 +0000
292+++ project_scrum/wizard/project_scrum_backlog_sprint.py 2011-02-17 07:20:39 +0000
293@@ -42,6 +42,9 @@
294 if context is None:
295 context = {}
296 data = self.read(cr, uid, ids, [], context=context)[0]
297+ if isinstance(data['sprint_id'], tuple):
298+ data['sprint_id'] = data['sprint_id'][0]
299+
300 for backlog in backlog_obj.browse(cr, uid, context['active_ids'], context=context):
301 backlog_ids.append(backlog.id)
302 if data['convert_to_task']:
303
304=== modified file 'purchase_requisition/wizard/purchase_requisition_partner.py'
305--- purchase_requisition/wizard/purchase_requisition_partner.py 2011-02-15 13:27:07 +0000
306+++ purchase_requisition/wizard/purchase_requisition_partner.py 2011-02-17 07:20:39 +0000
307@@ -67,7 +67,11 @@
308 context = {}
309 record_ids = context and context.get('active_ids', False)
310 if record_ids:
311- data = self.read(cr, uid, ids)
312+ data = self.read(cr, uid, ids,context=context)
313+ for m2o_field in ['partner_id','partner_address_id']:
314+ if isinstance(data[0][m2o_field], tuple):
315+ data[0][m2o_field] = data[0][m2o_field][0]
316+
317 company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id
318 order_obj = self.pool.get('purchase.order')
319 order_line_obj = self.pool.get('purchase.order.line')
320
321=== modified file 'stock/wizard/stock_inventory_line_split.py'
322--- stock/wizard/stock_inventory_line_split.py 2011-01-14 00:11:01 +0000
323+++ stock/wizard/stock_inventory_line_split.py 2011-02-17 07:20:39 +0000
324@@ -29,65 +29,68 @@
325 _name = "stock.inventory.line.split"
326 _description = "Split inventory lines"
327
328-
329+
330 def default_get(self, cr, uid, fields, context=None):
331- """ To check the availability of production lot.
332+ """ To check the availability of production lot.
333 @param self: The object pointer.
334 @param cr: A database cursor
335 @param uid: ID of the user currently logged in
336- @param fields: List of fields for which we want default values
337- @param context: A standard dictionary
338- @return: A dictionary which of fields with values.
339- """
340+ @param fields: List of fields for which we want default values
341+ @param context: A standard dictionary
342+ @return: A dictionary which of fields with values.
343+ """
344 if context is None:
345 context = {}
346 record_id = context and context.get('active_id',False)
347 res = {}
348- line = self.pool.get('stock.inventory.line').browse(cr, uid, record_id, context=context)
349+ line = self.pool.get('stock.inventory.line').browse(cr, uid, record_id, context=context)
350 if 'product_id' in fields:
351 res.update({'product_id':line.product_id.id})
352 if 'product_uom' in fields:
353 res.update({'product_uom': line.product_uom.id})
354 if 'qty' in fields:
355- res.update({'qty': line.product_qty})
356+ res.update({'qty': line.product_qty})
357 return res
358-
359+
360 def split(self, cr, uid, ids, line_ids, context=None):
361 """ To split stock inventory lines according to production lot.
362 @param self: The object pointer.
363 @param cr: A database cursor
364 @param uid: ID of the user currently logged in
365- @param ids: the ID or list of IDs if we want more than one
366+ @param ids: the ID or list of IDs if we want more than one
367 @param line_ids: the ID or list of IDs of inventory lines we want to split
368- @param context: A standard dictionary
369- @return:
370- """
371+ @param context: A standard dictionary
372+ @return:
373+ """
374 prodlot_obj = self.pool.get('stock.production.lot')
375 ir_sequence_obj = self.pool.get('ir.sequence')
376 line_obj = self.pool.get('stock.inventory.line')
377- new_line = []
378+ new_line = []
379 for data in self.browse(cr, uid, ids, context=context):
380 for inv_line in line_obj.browse(cr, uid, line_ids, context=context):
381 line_qty = inv_line.product_qty
382- quantity_rest = inv_line.product_qty
383- new_line = []
384+ quantity_rest = inv_line.product_qty
385+ new_line = []
386 if data.use_exist:
387 lines = [l for l in data.line_exist_ids if l]
388 else:
389- lines = [l for l in data.line_ids if l]
390+ lines = [l for l in data.line_ids if l]
391 for line in lines:
392 quantity = line.quantity
393 if quantity <= 0 or line_qty == 0:
394 continue
395- quantity_rest -= quantity
396- if quantity_rest <= 0:
397+ quantity_rest -= quantity
398+ if quantity_rest < 0:
399 quantity_rest = quantity
400 break
401 default_val = {
402- 'product_qty': quantity,
403+ 'product_qty': quantity,
404 }
405- current_line = line_obj.copy(cr, uid, inv_line.id, default_val)
406- new_line.append(current_line)
407+ if quantity_rest > 0:
408+ current_line = line_obj.copy(cr, uid, inv_line.id, default_val)
409+ new_line.append(current_line)
410+ if quantity_rest == 0:
411+ current_line = inv_line.id
412 prodlot_id = False
413 if data.use_exist:
414 prodlot_id = line.prodlot_id.id
415@@ -97,13 +100,13 @@
416 'product_id': inv_line.product_id.id},
417 context=context)
418 line_obj.write(cr, uid, [current_line], {'prod_lot_id': prodlot_id})
419- prodlot = prodlot_obj.browse(cr, uid, prodlot_id)
420-
421+ prodlot = prodlot_obj.browse(cr, uid, prodlot_id)
422+
423 update_val = {}
424- if quantity_rest > 0:
425- update_val['product_qty'] = quantity_rest
426+ if quantity_rest > 0:
427+ update_val['product_qty'] = quantity_rest
428 line_obj.write(cr, uid, [inv_line.id], update_val)
429-
430+
431 return new_line
432 stock_inventory_line_split()
433

Subscribers

People subscribed via source and target branches