Somesh Khare(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-576582-skh into 
lp:openobject-addons/6.0.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-576582-skh/+merge/113697

Hello Sir,

[FIX]: Duplicating a partner also duplicates invoice lines and analytic account.

Steps to reproduce:
1. Create a Invoice with the Invoice lines for any partner. eg: "Asustek"
2. Open the Analytic Account from Accounting/Configuration/Analytic 
Accounting/Analytic Accounts search "Asustek"
3. Goto Sales > Address Book >Customers, Open "Asustek" Now Duplicate partner.

Now Open the invoice and see that you have Invoice lines duplicated in the 
invoice you created and also the Analytic Account duplicated.

This branch fixes this issue.

Kindly review the branch and please share your views in it. 

Thanks & Regards
Somesh Khare 
OpenERP Support

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-576582-skh/+merge/113697
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-576582-skh.
=== modified file 'account/account_analytic_line.py'
--- account/account_analytic_line.py	2012-03-20 09:47:23 +0000
+++ account/account_analytic_line.py	2012-07-06 07:28:20 +0000
@@ -152,6 +152,15 @@
         'contract_ids': fields.one2many('account.analytic.account', \
                                                     'partner_id', 'Contracts', readonly=True),
     }
+    def copy(self, cr, uid, id, default=None, context=None):
+        if default is None:
+            default = {}
+            
+        if context is None:
+            context = {}
+            
+        default.update({'contract_ids' : []})
+        return super(res_partner, self).copy(cr, uid, id, default, context)    
 
 res_partner()
 

=== modified file 'account/invoice.py'
--- account/invoice.py	2012-03-16 16:47:19 +0000
+++ account/invoice.py	2012-07-06 07:28:20 +0000
@@ -1596,6 +1596,16 @@
         'invoice_ids': fields.one2many('account.invoice.line', 'partner_id', 'Invoices', readonly=True),
     }
 
+    def copy(self, cr, uid, id, default=None, context=None):
+        if default is None:
+            default = {}
+            
+        if context is None:
+            context = {}
+            
+        default.update({'invoice_ids' : []})
+        return super(res_partner, self).copy(cr, uid, id, default, context)
+
 res_partner()
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to