Skip to content

Commit

Permalink
[FIX] l10n_ke_edi_oscu: Fix pylint test + some style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
antoine162 committed May 13, 2024
1 parent 6aaaf6d commit 65c4b87
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion addons/l10n_ke_edi_oscu/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def _l10n_ke_call_etims(self, urlext, content):
print(response.text)
except (ValueError, requests.exceptions.ConnectionError, requests.exceptions.MissingSchema, requests.exceptions.Timeout, requests.exceptions.HTTPError) as e:
_logger.exception("Exception occurred!")
return {'code': 'CON', 'message':_('Connection Error: \n') + str(e)}, {}, "connection_error"
return {'code': 'CON', 'message': _('Connection Error: \n') + str(e)}, {}, "connection_error"

try:
response_dict = response.json()
Expand Down
11 changes: 4 additions & 7 deletions addons/l10n_ke_edi_oscu/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def assertJsonDictEquals(self, json_test, json_expected):
if isinstance(val_expected, str) and val_expected == '___ignore___':
continue

self.assertTrue(isinstance(val, type(val_expected)), "Type of %s not equal: %s != %s" % (key, val, val_expected))
self.assertTrue(isinstance(val, type(val_expected)), "Type of %s not equal: %s != %s" % (key, val, val_expected))

if isinstance(val, dict):
self.assertJsonDictEquals(val, val_expected)
Expand Down Expand Up @@ -204,26 +204,23 @@ def create_reversal(self, invoice, is_modify=False):

@contextlib.contextmanager
def set_invoice_number(self, invoice):
global last_invoice
if not self.is_live_test:
yield
return
else:
if not invoice.move_type.startswith('out_'):
raise Exception('`set_invoice_number` is only needed for out_invoice / out_refund!')
try:
last_invoice += 1
last_invoice['out_'] += 1
sequence = invoice.company_id._l10n_ke_get_invoice_sequence(invoice.move_type)
sequence.number_next_actual = last_invoice
yield
finally:
if not invoice.l10n_ke_oscu_receipt_number:
last_invoice -= 1
last_invoice['out_'] -= 1
else:
with file_open('l10n_ke_edi_oscu/tests/common.py', 'a') as test_file:
test_file.write(f'last_invoice = {last_invoice}\n')


last_invoice = 320
last_invoice = 321
last_invoice = 322
last_invoice = {'out_': 322}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class L10nKeEdiCustomsImport(models.Model):
purchase_id = fields.Many2one('purchase.order', "Purchase Order", check_company=True)
partner_id = fields.Many2one('res.partner', 'Partner', check_company=True)


@api.depends('uom_code_id')
def _compute_uom_id(self):
for customs_imp in self:
Expand Down
2 changes: 1 addition & 1 deletion addons/l10n_ke_edi_oscu_stock/models/purchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _l10n_ke_calculate_imports_per_line(self, already_approved=False):
for line in lines_same_product:
if not qty_product_uom:
continue
if line.product_uom_qty - qty_imports[line] >= qty_product_uom or line == lines_same_product[-1]: #TODO: float_compare // line.product_uom_qty already in product UoM
if line.product_uom_qty - qty_imports[line] >= qty_product_uom or line == lines_same_product[-1]: # TODO: float_compare // line.product_uom_qty already in product UoM
qty_imports[line] += qty_product_uom
qty_product_uom = 0
else:
Expand Down

0 comments on commit 65c4b87

Please sign in to comment.