Skip to content

Commit

Permalink
[FIX] All files are refactored in OCA standards
Browse files Browse the repository at this point in the history
  • Loading branch information
yibudak committed Jan 6, 2025
1 parent 04d96dc commit c8e633f
Show file tree
Hide file tree
Showing 255 changed files with 3,199 additions and 2,376 deletions.
12 changes: 0 additions & 12 deletions .flake8

This file was deleted.

3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ exclude: |
# Files and folders generated by bots, to avoid loops
^setup/|/static/description/index\.html$|
# We don't want to mess with tool-generated files
.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|
# TODO: Remove js exlusion when all js files are prettier compliant
.js$|.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|
# Maybe reactivate this when all README files include prettier ignore tags?
^README\.md$|
# Library files can have extraneous formatting (even minimized)
Expand Down
5 changes: 1 addition & 4 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ score=n

[ODOOLINT]
readme-template-url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
manifest-required-authors=Odoo Community Association (OCA)
manifest-required-authors=Altinkaya Enclosures
manifest-required-keys=license
manifest-deprecated-keys=description,active
license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
Expand Down Expand Up @@ -41,7 +41,6 @@ enable=anomalous-backslash-in-string,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
manifest-required-author,
manifest-required-key,
manifest-version-format,
method-compute,
Expand Down Expand Up @@ -81,7 +80,6 @@ enable=anomalous-backslash-in-string,
invalid-commit,
manifest-maintainers-list,
missing-newline-extrafiles,
missing-readme,
missing-return,
odoo-addons-relative-import,
old-api7-method-defined,
Expand All @@ -108,7 +106,6 @@ enable=anomalous-backslash-in-string,
invalid-commit,
missing-manifest-dependency,
missing-newline-extrafiles,
missing-readme,
no-utf8-coding-comment,
odoo-addons-relative-import,
old-api7-method-defined,
Expand Down
3 changes: 1 addition & 2 deletions .pylintrc-mandatory
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ score=n

[ODOOLINT]
readme-template-url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
manifest-required-authors=Odoo Community Association (OCA)
manifest-required-authors=Altinkaya Enclosures
manifest-required-keys=license
manifest-deprecated-keys=description,active
license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
Expand Down Expand Up @@ -73,7 +73,6 @@ enable=anomalous-backslash-in-string,
invalid-commit,
manifest-maintainers-list,
missing-newline-extrafiles,
missing-readme,
missing-return,
odoo-addons-relative-import,
old-api7-method-defined,
Expand Down
30 changes: 30 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

target-version = "py312"
fix = true

[lint]
extend-select = [
"B",
"C90",
"E501", # line too long (default 88)
"I", # isort
"UP", # pyupgrade
]
exclude = ["setup/*"]

[format]
exclude = ["setup/*"]

[lint.per-file-ignores]
"__init__.py" = ["F401", "I001"] # ignore unused and unsorted imports in __init__.py
"__manifest__.py" = ["B018"] # useless expression

[lint.isort]
section-order = ["future", "standard-library", "third-party", "odoo", "odoo-addons", "first-party", "local-folder"]

[lint.isort.sections]
"odoo" = ["odoo"]
"odoo-addons" = ["odoo.addons"]

[lint.mccabe]
max-complexity = 16
6 changes: 3 additions & 3 deletions account_statement_import_online_finekra/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Online Bank Statements: Finekra",
"version": "12.0.1.1.0",
"version": "16.0.1.1.0",
"category": "Account",
"website": "https://github.com/odoo-turkey/integration",
"author": "Yiğit Budak, Odoo Turkey Localization Group",
"website": "https://github.com/altinkaya-opensource/odoo-addons",
"author": "Yiğit Budak, Odoo Turkey Localization Group, Altinkaya Enclosures",
"license": "AGPL-3",
"installable": True,
"depends": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Copyright 2024 Yiğit Budak (https://github.com/yibudak)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from odoo import models, api, fields
from odoo.tools import float_compare
import re

from odoo import api, fields, models
from odoo.tools import float_compare


class AccountBankStatementLine(models.Model):
_inherit = "account.bank.statement.line"
Expand All @@ -23,7 +24,7 @@ def create(self, vals):
:param vals:
:return:
"""
res = super(AccountBankStatementLine, self).create(vals)
res = super().create(vals)
order_ref_pattern = r"\b[A-Za-z]{2}\d{6,7}\b"
matched_refs = re.findall(order_ref_pattern, res.name)
if matched_refs:
Expand Down Expand Up @@ -55,7 +56,7 @@ def create(self, vals):
"counterpart_aml_dicts": [],
"new_aml_dicts": [
{
"account_id": commercial_partner.property_account_receivable_id.id,
"account_id": commercial_partner.property_account_receivable_id.id, # noqa
"analytic_tag_ids": [[6, None, []]],
"credit": res.amount,
"company_id": res.company_id.id,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2022 Yiğit Budak (https://github.com/yibudak)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from odoo import models, fields
from odoo import fields, models


class AccountJournal(models.Model):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Copyright 2022 Yiğit Budak (https://github.com/yibudak)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import requests
from datetime import datetime, timedelta

import uuid
import requests

from odoo import api, fields, models, _
from odoo import _, api, fields, models
from odoo.exceptions import UserError

FINEKRA_ENDPOINT = "https://test-api.finekra.com"
Expand Down Expand Up @@ -50,19 +49,22 @@ def _finekra_get_request(self, endpoint, data=None):
:return:
"""
headers = {
"Content-Type": "application/json;odata.metadata=minimal;odata.streaming=true",
"Authorization": "Bearer %s" % self.finekra_jwt_token,
"Content-Type": (
"application/json;odata.metadata=minimal;odata.streaming=true"
),
"Authorization": f"Bearer {self.finekra_jwt_token}",
}
response = requests.get(endpoint, params=data, headers=headers)

response = requests.get(endpoint, params=data, headers=headers, timeout=10)

if response.status_code == 200:
return response.json()
else:
for i in range(len(response.text)):
print(i)
print(response.text)
raise UserError(_(response))
raise UserError(
_(
"Finekra API returned an error: %(resp_content)d",
resp_content=response.content,
),
)

def _finekra_post_request(self, endpoint, data=None):
"""
Expand All @@ -72,10 +74,12 @@ def _finekra_post_request(self, endpoint, data=None):
:return:
"""
headers = {
"Content-Type": "application/json;odata.metadata=minimal;odata.streaming=true",
"Authorization": "Bearer %s" % self.finekra_jwt_token,
"Content-Type": (
"application/json;odata.metadata=minimal;odata.streaming=true"
),
"Authorization": f"Bearer {self.finekra_jwt_token}",
}
response = requests.post(endpoint, json=data, headers=headers)
response = requests.post(endpoint, json=data, headers=headers, timeout=10)

if response.status_code == 200:
return response.json()
Expand All @@ -85,7 +89,6 @@ def _finekra_post_request(self, endpoint, data=None):
def _finekra_get_auth(self):
self.ensure_one()
if self.finekra_email and self.finekra_password and self.finekra_tenant_code:

if (
not self.finekra_jwt_token
or self.finekra_token_interval < datetime.now()
Expand All @@ -97,7 +100,7 @@ def _finekra_get_auth(self):
"screenOption": 0,
}
resp = requests.post(
"%s/api/Auth/DealerLogin" % FINEKRA_ENDPOINT, json=vals
f"{FINEKRA_ENDPOINT}/api/Auth/DealerLogin", json=vals, timeout=10
).json()
if resp.get("success"):
self.write(
Expand All @@ -111,17 +114,12 @@ def _finekra_get_auth(self):
raise UserError(_("Please fill email, password and tenant code."))

def _finekra_get_transaction(self, account_id, date_since, date_until):
page_url = "%s/api/AccountTransaction" % FINEKRA_ENDPOINT
page_url = f"{FINEKRA_ENDPOINT}/api/AccountTransaction"

vals = {
"$filter": "TenantAccountId eq %s and"
" date(TransactionDateValue) le %s and"
" date(TransactionDateValue) ge %s"
% (
account_id,
date_until.strftime("%Y-%m-%d"),
date_since.strftime("%Y-%m-%d"),
)
"$filter": f"TenantAccountId eq {account_id} and"
f" date(TransactionDateValue) le {date_until.strftime('%Y-%m-%d')} and"
f" date(TransactionDateValue) ge {date_since.strftime('%Y-%m-%d')}"
}

data = self._finekra_get_request(endpoint=page_url, data=vals)
Expand All @@ -136,7 +134,6 @@ def _finekra_date_from_string(self, date_str):
return dt

def _finekra_obtain_statement_data(self, date_since, date_until):
# currency_dict = {x.name: x.id for x in self.env['res.currency'].search([('active', '=', True)])}
self.ensure_one()
self._finekra_get_auth()
journal = self.journal_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
<record model="ir.ui.view" id="bank_statement_line_tree_finekra">
<field name="name">account.bank.statement.line.tree.finekra</field>
<field name="model">account.bank.statement.line</field>
<field name="inherit_id" ref="account_statement_base.account_bank_statement_line_tree"/>
<field
name="inherit_id"
ref="account_statement_base.account_bank_statement_line_tree"
/>
<field name="arch" type="xml">
<field name="ref" position="after">
<field name="order_ids"/>
<field name="order_ids" />
</field>
</field>
</record>
</odoo>
</odoo>
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<record model="ir.ui.view" id="view_account_journal_form_finekra">
<field name="name">account.journal.form</field>
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="inherit_id" ref="account.view_account_journal_form" />
<field name="arch" type="xml">
<group name="online_bank_statements" position="inside">
<field name="finekra_account_id"/>
<field name="finekra_account_id" />
</group>
</field>
</record>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@
<record model="ir.ui.view" id="online_bank_statement_provider_form_finekra">
<field name="name">online.bank.statement.provider.form.finekra</field>
<field name="model">online.bank.statement.provider</field>
<field
name="inherit_id"
ref="account_statement_import_online.online_bank_statement_provider_form"
/>
<field
name="inherit_id"
ref="account_statement_import_online.online_bank_statement_provider_form"
/>
<field name="arch" type="xml">
<!-- < page idi groupa çevirdim -->
<xpath expr="//group[@name='configuration']" position="inside">
<group name="finekra" attrs="{'invisible':[('service','!=','finekra')]}">
<field name="finekra_email"/>
<field name="finekra_password"/>
<field name="finekra_tenant_code"/>
<group
name="finekra"
attrs="{'invisible':[('service','!=','finekra')]}"
>
<field name="finekra_email" />
<field name="finekra_password" />
<field name="finekra_tenant_code" />
</group>
</xpath>
</field>
Expand Down
5 changes: 2 additions & 3 deletions advanced_faceted_search/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
{
"name": "Advanced Faceted Search",
"summary": "Website advanced faceted search extension.",
"description": "This module extends Odoo's faceted search.",
"development_status": "Beta",
"version": "16.0.1.0.1",
"author": "Yiğit Budak",
"author": "Yiğit Budak, Altinkaya Enclosures",
"license": "AGPL-3",
"website": "https://github.com/yibudak",
"website": "https://github.com/altinkaya-opensource/odoo-addons",
"category": "Extensions",
"depends": ["website_sale", "altinkaya_ecommerce"],
"data": [
Expand Down
2 changes: 1 addition & 1 deletion advanced_faceted_search/models/product_attribute_value.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright 2023 Yiğit Budak (https://github.com/yibudak)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from odoo import models, fields
from odoo import models


class ProductAttributesValue(models.Model):
Expand Down
2 changes: 1 addition & 1 deletion advanced_faceted_search/models/product_public_category.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright 2023 Yiğit Budak (https://github.com/yibudak)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from odoo import models, fields
from odoo import fields, models


class ProductPublicCategory(models.Model):
Expand Down
Loading

0 comments on commit c8e633f

Please sign in to comment.