Skip to content

Commit

Permalink
[REF] l10n_ve_withholding_islr: Migrated to v8 copy functions
Browse files Browse the repository at this point in the history
  • Loading branch information
suniagajose committed Dec 17, 2015
1 parent f79f091 commit 8c9cf85
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
9 changes: 4 additions & 5 deletions l10n_ve_withholding_islr/model/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,21 +221,20 @@ def _create_islr_wh_doc(self, cr, uid, ids, context=None):

return islr_wh_doc_id

def copy(self, cr, uid, ids, default=None, context=None):
@api.multi
def copy(self, default=None):
""" Inicializes the fields islr_wh_doc and status
when the line is duplicated
"""
# NOTE: use ids argument instead of id for fix the pylint error W0622.
# Redefining built-in 'id'
default = default or {}
context = context or {}
default = default.copy()
default.update({'islr_wh_doc': 0,
'status': 'no_pro',
})
context.update({'new_key': True})
return super(AccountInvoice, self).copy(cr, uid, ids, default,
context)
self = self.with_context(new_key=True)
return super(AccountInvoice, self).copy(default)

def _refund_cleanup_lines(self, cr, uid, lines, context=None):
""" Initializes the fields of the lines of a refund invoice
Expand Down
7 changes: 4 additions & 3 deletions l10n_ve_withholding_islr/model/islr_wh_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
##############################################################################
import time

from openerp import api
from openerp.addons import decimal_precision as dp
from openerp.osv import fields, osv
from openerp.tools.translate import _
Expand Down Expand Up @@ -829,7 +830,8 @@ def _fnct_get_wh_income_id(self, cr, uid, ids, name, args, context=None):
" Invoice"),
}

def copy(self, cr, uid, ids, default=None, context=None):
@api.multi
def copy(self, default=None):
""" Initialized id by duplicating
"""
# NOTE: use ids argument instead of id for fix the pylint error W0622.
Expand All @@ -839,8 +841,7 @@ def copy(self, cr, uid, ids, default=None, context=None):
default = default.copy()
default.update({'islr_wh_doc_id': 0})

return super(AccountInvoice, self).copy(cr, uid, ids, default,
context)
return super(AccountInvoice, self).copy(default)


class IslrWhDocInvoices(osv.osv):
Expand Down
7 changes: 4 additions & 3 deletions l10n_ve_withholding_islr/model/islr_xml_wh.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import time
from xml.etree.ElementTree import Element, SubElement, tostring

from openerp import api
from openerp.addons import decimal_precision as dp
from openerp.osv import fields, osv
from openerp.tools.translate import _
Expand Down Expand Up @@ -112,7 +113,8 @@ def _get_company(self, cr, uid, context=None):
help='User Creating Document'),
}

def copy(self, cr, uid, ids, default=None, context=None):
@api.multi
def copy(self, default=None):
""" Initialized id by duplicating
"""
if default is None:
Expand All @@ -124,8 +126,7 @@ def copy(self, cr, uid, ids, default=None, context=None):
'employee_xml_ids': [],
})

return super(IslrXmlWhDoc, self).copy(cr, uid, ids, default,
context)
return super(IslrXmlWhDoc, self).copy(default)

def period_return(self, cr, uid, context=None):
""" Return current period
Expand Down
6 changes: 4 additions & 2 deletions l10n_ve_withholding_islr/model/partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
##############################################################################
from openerp import api
from openerp.osv import fields, osv


Expand All @@ -46,7 +47,8 @@ class ResPartner(osv.osv):
help='Values to be used when computing Rate 2'),
}

def copy(self, cr, uid, ids, default=None, context=None):
@api.multi
def copy(self, default=None):
""" Initialized id by duplicating
"""
# NOTE: use ids argument instead of id for fix the pylint error W0622.
Expand All @@ -61,4 +63,4 @@ def copy(self, cr, uid, ids, default=None, context=None):
'islr_wh_historical_data_ids': [],
})

return super(ResPartner, self).copy(cr, uid, ids, default, context)
return super(ResPartner, self).copy(default)

0 comments on commit 8c9cf85

Please sign in to comment.