Skip to content

Commit

Permalink
[FIX] Some fixes related to v8 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
suniagajose committed Dec 17, 2015
1 parent 0fb92a0 commit b466302
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 34 deletions.
10 changes: 4 additions & 6 deletions l10n_ve_fiscal_book/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,13 @@ def _get_doc(self, cr, uid, ids, name, args, context=None):
ret.update({i: ''})
if invs:
for inv in invs:
if (inv.type == "in_invoice" or
inv.type == "out_invoice") and inv.parent_id:
if inv.type in ['in_invoice', 'out_invoice'] and inv.parent_id:
doc_type = "ND"
elif (inv.type == "in_invoice" or
inv.type == "in_refund") and inv.expedient:
elif inv.type in ['in_invoice', 'in_refund'] and inv.expedient:
doc_type = "E"
elif inv.type == 'in_refund' or inv.type == 'out_refund':
elif inv.type in ['in_refund', 'out_refund']:
doc_type = "NC"
elif inv.type == "in_invoice" or inv.type == "out_invoice":
elif inv.type in ['in_invoice', 'out_invoice']:
doc_type = "F"
ret.update({inv.id: doc_type})
return ret
Expand Down
13 changes: 7 additions & 6 deletions l10n_ve_fiscal_requirements/model/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###############################################################################

from openerp import api
from openerp.osv import fields, osv
from openerp.tools.translate import _

Expand Down Expand Up @@ -137,16 +138,17 @@ def _get_loc_req(self, cr, uid, context=None):
['Control Number (nro_ctrl)', 'Reference (reference)']),
]

def copy(self, cr, uid, ids, default=None, context=None):
@api.multi
def copy(self, default=None):
""" Allows you to duplicate a record,
child_ids, nro_ctrl and reference fields are
cleaned, because they must be unique
"""
# NOTE: Use argument name ids instead of id for fix the pylint error
# W0621 Redefining buil-in 'id'
if context is None:
context = {}
default = default or {}
if default is None:
default = {}
default = default.copy()
default.update({
'nro_ctrl': None,
'supplier_invoice_number': None,
Expand All @@ -161,8 +163,7 @@ def copy(self, cr, uid, ids, default=None, context=None):
# loc_req':False,
'z_report': '',
})
return super(AccountInvoice, self).copy(cr, uid, ids, default,
context)
return super(AccountInvoice, self).copy(default)

def write(self, cr, uid, ids, vals, context=None):
context = context or {}
Expand Down
4 changes: 2 additions & 2 deletions l10n_ve_imex/model/customs_form_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _get_company(self, cr, uid, context=None):
'res.company', string='Company', required=True, readonly=True,
default=lambda s: s._get_company(), ondelete='restrict'),
'journal_id': fields.many2one(
'account.journal', 'Journal',required=True,
'account.journal', 'Journal', required=True,
ondelete='restrict'),
}

Expand Down Expand Up @@ -120,7 +120,6 @@ def name_get(self, cr, uid, ids, context=None):
item.code, item.ref, item.name)))
return res


def _get_company(self, cr, uid, context=None):
company_obj = self.pool.get('res.company')
return company_obj._company_default_get(
Expand All @@ -145,6 +144,7 @@ def _get_company(self, cr, uid, context=None):
'res.company', string='Company', required=True, readonly=True,
ondelete='restrict',
default=lambda s: s._get_company()),
}

_sql_constraints = [
('code_uniq', 'UNIQUE(code,company_id)',
Expand Down
6 changes: 2 additions & 4 deletions l10n_ve_split_invoice/model/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,9 @@ def execute(self, cr, uid, ids, context=None):

_columns = {
'name': fields.integer(
'Max Invoice Lines', required=True,
'Max Invoice Lines', required=True, default=50,
help='Select the maximum number of lines in your customer'
' invoices'),
}
_defaults = {
'name': 50,
}

SplitInvoiceConfig()
6 changes: 1 addition & 5 deletions l10n_ve_split_invoice/model/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,8 @@ class ResCompany(osv.osv):

_columns = {
'lines_invoice': fields.integer(
'Invoice Lines', required=False,
'Invoice Lines', required=False, default=50,
help="Number of lines per invoice"),
}

_defaults = {
'lines_invoice': 50,
}

ResCompany()
17 changes: 8 additions & 9 deletions l10n_ve_vat_write_off/model/l10n_ve_vat_write_off.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@
class VatWriteOff(osv.osv):
_description = ''
_name = 'vat.write.off'

def _get_company(self, cr, uid, context=None):
user = self.pool.get('res.users').browse(cr, uid, uid)
return user.company_id.id

_columns = {
'company_id': fields.many2one(
'res.company', 'Company',
default=lambda s: s._get_company(),
help='Company', required=True),
'period_id': fields.many2one(
'account.period', 'Period',
Expand Down Expand Up @@ -104,7 +110,8 @@ class VatWriteOff(osv.osv):
's_tax_amount': fields.related(
'sale_fb_id', 'tax_amount', type="float", readonly=True,
store=True),
'start_date': fields.date(string='Start date'),
'start_date': fields.date(string='Start date',
default=fields.date.today),

'vat': fields.related('company_id',
'partner_id',
Expand All @@ -113,12 +120,4 @@ class VatWriteOff(osv.osv):
string='TIN',
readonly=True,
store=True),


}
_defaults = {
'state': 'draft',
'company_id': lambda s, c, u, ctx:
s.pool.get('res.users').browse(c, u, u, context=ctx).company_id.id,
'start_date': fields.date.today,
}
4 changes: 2 additions & 2 deletions l10n_ve_withholding_iva/model/generate_txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ def _get_amount_total_base(self):
txt_ids = fields.One2many(
'txt.iva.line', 'txt_id', readonly=True,
states={'draft': [('readonly', False)]},
help=_('Txt field lines of ar required by SENIAT for'
' VAT withholding'))
help='Txt field lines of ar required by SENIAT for'
' VAT withholding')
amount_total_ret = fields.Float(
string='Withholding total amount', digits=dp.get_precision('Account'),
compute=_get_amount_total, readonly=True,
Expand Down

0 comments on commit b466302

Please sign in to comment.