Priyesh (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-18224-pso into 
lp:openobject-addons/6.0.

Requested reviews:
  Vo Minh Thu (OpenERP) (vmt-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-18224-pso/+merge/79932

Hello,

I have fixed the issue of Moves, being posted, without any Move lines.

Kindly share your views.

Thanks,
Priyesh
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-18224-pso/+merge/79932
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-18224-pso.
=== modified file 'account/account.py'
--- account/account.py	2011-10-10 08:50:07 +0000
+++ account/account.py	2011-10-20 09:22:24 +0000
@@ -1276,8 +1276,7 @@
                     if not l[0]:
                         l[2]['period_id'] = default_period
                 context['period_id'] = default_period
-
-        if 'line_id' in vals:
+        if 'line_id' in vals and vals.get('line_id', False):
             c = context.copy()
             c['novalidate'] = True
             result = super(account_move, self).create(cr, uid, vals, c)
@@ -1423,7 +1422,8 @@
         for move in self.browse(cr, uid, ids, context):
             # Unlink old analytic lines on move_lines
             if not move.line_id:
-                raise osv.except_osv(_('No Move Lines !'), _('Please create some move lines.'))
+                if 'voucher_cancel' not in context and 'invoice_cancel' not in context:
+                    raise osv.except_osv(_('No Move Lines !'), _('Please create some move lines.'))
             for obj_line in move.line_id:
                 for obj in obj_line.analytic_lines:
                     obj_analytic_line.unlink(cr,uid,obj.id)

=== modified file 'account/invoice.py'
--- account/invoice.py	2011-09-27 12:34:47 +0000
+++ account/invoice.py	2011-10-20 09:22:24 +0000
@@ -1021,6 +1021,7 @@
             # delete the move this invoice was pointing to
             # Note that the corresponding move_lines and move_reconciles
             # will be automatically deleted too
+            context.update({'invoice_cancel': 'cancel'})
             account_move_obj.unlink(cr, uid, move_ids, context=context)
         self._log_event(cr, uid, ids, -1.0, 'Cancel Invoice')
         return True

=== modified file 'account_voucher/account_voucher.py'
--- account_voucher/account_voucher.py	2011-09-27 12:34:47 +0000
+++ account_voucher/account_voucher.py	2011-10-20 09:22:24 +0000
@@ -594,7 +594,8 @@
 
             if voucher.move_id:
                 move_pool.button_cancel(cr, uid, [voucher.move_id.id])
-                move_pool.unlink(cr, uid, [voucher.move_id.id])
+                context.update({'voucher_cancel': 'cancel'})
+                move_pool.unlink(cr, uid, [voucher.move_id.id], context=context)
         res = {
             'state':'cancel',
             'move_id':False,

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : openerp-dev-gtk@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to