Merge lp:~unifield-team/unifield-wm/us_404 into lp:unifield-wm

Proposed by jftempo
Status: Needs review
Proposed branch: lp:~unifield-team/unifield-wm/us_404
Merge into: lp:unifield-wm
Diff against target: 88 lines (+37/-2)
4 files modified
msf_instance/add_instance.py (+27/-1)
msf_profile/data/patches.xml (+4/-0)
msf_profile/msf_profile.py (+5/-0)
register_accounting/report/cash_inventory.rml (+1/-1)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/us_404
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+263881@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

2543. By Stephane Codazzi <email address hidden>

US_404: Deduplicate cashbox line

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'msf_instance/add_instance.py'
--- msf_instance/add_instance.py 2015-04-02 15:09:28 +0000
+++ msf_instance/add_instance.py 2015-07-06 10:22:07 +0000
@@ -417,6 +417,22 @@
417 'instance_id': fields.many2one('msf.instance', 'Proprietary Instance'),417 'instance_id': fields.many2one('msf.instance', 'Proprietary Instance'),
418 }418 }
419419
420 #us-404: Remove all duplicated lines
421 def remove_duplicates(self, cr, uid, context=None):
422 domain = [('starting_id', '>', 0)]
423 ids = self.search(cr, uid, domain, order="id DESC", context=context)
424 objs = self.browse(cr, uid, ids, context=context)
425 unlink_ids = []
426 for obj in objs:
427 if obj.id not in unlink_ids:
428 duplicate_domain = [('starting_id', '=', obj.starting_id),
429 ('pieces', '=', obj.pieces),
430 ('id', '<', obj.id)]
431 duplicate_ids = self.search(cr, uid, duplicate_domain,
432 context=context)
433 unlink_ids = unlink_ids + duplicate_ids
434 return self.unlink(cr, uid, unlink_ids, context=context)
435
420 def create(self, cr, uid, vals, context=None):436 def create(self, cr, uid, vals, context=None):
421 if 'starting_id' in vals:437 if 'starting_id' in vals:
422 register = self.pool.get('account.bank.statement').read(cr, uid, vals['starting_id'], ['instance_id'], context=context)438 register = self.pool.get('account.bank.statement').read(cr, uid, vals['starting_id'], ['instance_id'], context=context)
@@ -424,7 +440,17 @@
424 elif 'ending_id' in vals:440 elif 'ending_id' in vals:
425 register = self.pool.get('account.bank.statement').read(cr, uid, vals['ending_id'], ['instance_id'], context=context)441 register = self.pool.get('account.bank.statement').read(cr, uid, vals['ending_id'], ['instance_id'], context=context)
426 vals['instance_id'] = register.get('instance_id')[0]442 vals['instance_id'] = register.get('instance_id')[0]
427 return super(account_cashbox_line, self).create(cr, uid, vals, context=context)443 # US-404: If line already exist with the same starting_id and piece
444 ids = None
445 if 'starting_id' in vals and 'pieces' in vals:
446 domain = [('starting_id', '=', vals['starting_id']),
447 ('pieces', '=', vals['pieces'])]
448 ids = self.search(cr, uid, domain, context=context)
449 if ids:
450 return self.write(cr, uid, ids[0], vals, context=context)
451 else:
452 return super(account_cashbox_line, self).create(cr, uid, vals,
453 context=context)
428454
429 def write(self, cr, uid, ids, vals, context=None):455 def write(self, cr, uid, ids, vals, context=None):
430 if 'starting_id' in vals:456 if 'starting_id' in vals:
431457
=== modified file 'msf_profile/data/patches.xml'
--- msf_profile/data/patches.xml 2015-05-22 14:25:13 +0000
+++ msf_profile/data/patches.xml 2015-07-06 10:22:07 +0000
@@ -6,5 +6,9 @@
6 <field name="method">update_us_133</field>6 <field name="method">update_us_133</field>
7 </record>7 </record>
88
9 <record id="us_404_patch" model="patch.scripts">
10 <field name="method">update_us_404</field>
11 </record>
12
9 </data>13 </data>
10</openerp>14</openerp>
1115
=== modified file 'msf_profile/msf_profile.py'
--- msf_profile/msf_profile.py 2015-05-27 10:34:50 +0000
+++ msf_profile/msf_profile.py 2015-07-06 10:22:07 +0000
@@ -51,6 +51,11 @@
51 getattr(model_obj, method)(cr, uid, *a, **b)51 getattr(model_obj, method)(cr, uid, *a, **b)
52 self.write(cr, uid, [ps['id']], {'run': True})52 self.write(cr, uid, [ps['id']], {'run': True})
5353
54 def update_us_404(self, cr, uid, *a, **b):
55 obj = self.pool.get('account.cashbox.line')
56 print "starting patch"
57 obj.remove_duplicates(cr, uid, context={})
58
54 def update_us_133(self, cr, uid, *a, **b):59 def update_us_133(self, cr, uid, *a, **b):
55 p_obj = self.pool.get('res.partner')60 p_obj = self.pool.get('res.partner')
56 po_obj = self.pool.get('purchase.order')61 po_obj = self.pool.get('purchase.order')
5762
=== modified file 'register_accounting/report/cash_inventory.rml'
--- register_accounting/report/cash_inventory.rml 2014-10-03 12:40:50 +0000
+++ register_accounting/report/cash_inventory.rml 2015-07-06 10:22:07 +0000
@@ -399,7 +399,7 @@
399 <font color="white"> </font>399 <font color="white"> </font>
400 </para>400 </para>
401401
402 <blockTable style="Table100"> 402 <blockTable style="Table100">
403 <tr>403 <tr>
404 <td>404 <td>
405 <para style="P7">Comments:</para>405 <para style="P7">Comments:</para>

Subscribers

People subscribed via source and target branches