Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] Add ImportError into sync_project_demo.py fix pre-commit issues #1

Merged
merged 1 commit into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions alipay/data/module_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
<odoo>
<record model="ir.module.category" id="module_category_miniprogram_management">
<field name="name">Mini-program</field>
<field
name="description"
>Helps you manage your Alipay and main operations: create orders, payment, etc...</field>
<field name="description">
Helps you manage your Alipay and main operations: create orders, payment,
etc...
</field>
<field name="sequence">60</field>
</record>
</odoo>
4 changes: 2 additions & 2 deletions alipay/models/alipay_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class AlipayOrder(models.Model):
"""Records with order information and payment status.

Can be used for different types of Payments. See description of trade_type field. """
Can be used for different types of Payments. See description of trade_type field."""

_name = "alipay.order"
_description = "Unified Order"
Expand Down Expand Up @@ -77,7 +77,7 @@ def _compute_refund_fee(self):
)

def _body(self):
""" Example of result:
"""Example of result:

{"goods_detail": [
{
Expand Down
7 changes: 5 additions & 2 deletions alipay/models/alipay_refund.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class AlipayRefund(models.Model):
"""Records with refund information and payment status.

Can be used for different types of Payments. See description of trade_type field. """
Can be used for different types of Payments. See description of trade_type field."""

_name = "alipay.refund"
_description = "Unified Refund"
Expand Down Expand Up @@ -68,7 +68,10 @@ def action_confirm(self):
else:
alipay = self.env["ir.config_parameter"].get_alipay_pay_object()
result_raw = alipay.refund.apply(
record.total_fee, self.refund_fee, self.name, out_trade_no=record.name,
record.total_fee,
self.refund_fee,
self.name,
out_trade_no=record.name,
)

vals = {
Expand Down
5 changes: 4 additions & 1 deletion alipay/models/ir_config_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ def get_alipay_object(self):
notify_url = self.sudo().get_param("alipay.notify_url")
if not notify_url:
base = self.sudo().get_param("web.base.url")
notify_url = "{base}{path}".format(base=base, path=ALIPAY_NOTIFY_URL,)
notify_url = "{base}{path}".format(
base=base,
path=ALIPAY_NOTIFY_URL,
)

options["app_notify_url"] = notify_url

Expand Down
4 changes: 3 additions & 1 deletion alipay/tests/test_alipay.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def setUp(self):
self.requests_mock.start()
self.addCleanup(self.requests_mock.stop)

context = dict(app_private_key_string=DUMMY_RSA_KEY,)
context = dict(
app_private_key_string=DUMMY_RSA_KEY,
)

self.Config = self.env["ir.config_parameter"].with_context(context)
self.Order = self.env["alipay.order"].with_context(context)
Expand Down
4 changes: 2 additions & 2 deletions base_automation_webhook/data/base_automation_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<field name="name">Base Automation: test rule on create</field>
<field name="state">code</field>
<field name="code">
log("code is executed")
log("code is executed")
# don't make actual request, but just check the package is available
make_request
</field>
</field>
<field name="trigger">on_create</field>
<field name="model_id" ref="base.model_res_partner" />
</record>
Expand Down
6 changes: 4 additions & 2 deletions ir_attachment_s3/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ def content_image(
)
if image_variant_attachment:
w, h = SIZES_MAP[field]
resized_attachment = image_variant_attachment._get_or_create_resized_in_cache(
w, h, field=field
resized_attachment = (
image_variant_attachment._get_or_create_resized_in_cache(
w, h, field=field
)
)
attachment = resized_attachment.resized_attachment_id

Expand Down
6 changes: 3 additions & 3 deletions ir_attachment_s3/views/res_config_settings_views.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field
name="name"
>res.config.settings.view.form.inherit.ir_attachment_s3</field>
<field name="name">
res.config.settings.view.form.inherit.ir_attachment_s3
</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="11" />
<field name="inherit_id" ref="base.res_config_settings_view_form" />
Expand Down
6 changes: 3 additions & 3 deletions ir_attachment_url/demo/ir_attachment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<record id="test_url_attachment" model="ir.attachment">
<field name="name">test_attachment</field>
<field name="type">url</field>
<field
name="url"
>https://en.wikipedia.org/wiki/Iceland#/media/File:Gullfoss,_an_iconic_waterfall_of_Iceland.jpg</field>
<field name="url">
https://en.wikipedia.org/wiki/Iceland#/media/File:Gullfoss,_an_iconic_waterfall_of_Iceland.jpg
</field>
</record>
</odoo>
16 changes: 8 additions & 8 deletions ir_attachment_url/models/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def updated_image_resize_image_big(
filetype=None,
avoid_if_small=True,
):
""" copy-pasted from odoo/tools/image.py::image_resize_image_big
because we rewrite image_resize_image function.
"""copy-pasted from odoo/tools/image.py::image_resize_image_big
because we rewrite image_resize_image function.
"""
return updated_image_resize_image(
base64_source, size, encoding, filetype, avoid_if_small
Expand All @@ -87,8 +87,8 @@ def updated_image_resize_image_medium(
filetype=None,
avoid_if_small=False,
):
""" copy-pasted from odoo/tools/image.py::image_resize_image_medium
because we rewrite image_resize_image function.
"""copy-pasted from odoo/tools/image.py::image_resize_image_medium
because we rewrite image_resize_image function.
"""
return updated_image_resize_image(
base64_source, size, encoding, filetype, avoid_if_small
Expand All @@ -98,8 +98,8 @@ def updated_image_resize_image_medium(
def updated_image_resize_image_small(
base64_source, size=(64, 64), encoding="base64", filetype=None, avoid_if_small=False
):
""" copy-pasted from odoo/tools/image.py::image_resize_image_small
because we rewrite image_resize_image function.
"""copy-pasted from odoo/tools/image.py::image_resize_image_small
because we rewrite image_resize_image function.
"""
return updated_image_resize_image(
base64_source, size, encoding, filetype, avoid_if_small
Expand All @@ -118,8 +118,8 @@ def updated_image_get_resized_images(
avoid_resize_medium=False,
avoid_resize_small=False,
):
""" copy-pasted from odoo/tools/image.py::image_get_resized_images
because we rewrite image_resize_image function.
"""copy-pasted from odoo/tools/image.py::image_get_resized_images
because we rewrite image_resize_image function.
"""
return_dict = dict()
if isinstance(base64_source, tools.pycompat.text_type):
Expand Down
2 changes: 1 addition & 1 deletion ir_attachment_url/models/ir_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def binary_content(
access_token=None,
env=None,
): # pylint: disable=redefined-builtin
""" Get file, attachment or downloadable content
"""Get file, attachment or downloadable content

If the ``xmlid`` and ``id`` parameter is omitted, fetches the default value for the
binary field (via ``default_get``), otherwise fetches the field for
Expand Down
20 changes: 9 additions & 11 deletions ir_attachment_url/static/src/js/ir_attachment_url.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
odoo.define("ir_attachment_url", function(require) {
"use strict";

odoo.define("ir_attachment_url", function (require) {
var core = require("web.core");
var QWeb = core.qweb;
var FieldBinaryImage = require("web.field_registry").get("image");
Expand All @@ -11,25 +9,25 @@ odoo.define("ir_attachment_url", function(require) {
"click .o_link_address_button": "on_link_address",
}),

init: function(parent, name, record) {
init: function (parent, name, record) {
this._super.apply(this, arguments);
this.url_clicked = false;
this.is_url = false;
},

on_link_address: function() {
on_link_address: function () {
var self = this;
this.$el.children(".img-responsive").remove();
this.$el.children(".input_url").remove();
this.$el.children(".o_form_image_controls").addClass("media_url_controls");
this.$el.prepend($(QWeb.render("AttachmentURL", {widget: this})));
this.$(".input_url input").on("change", function() {
this.$el.prepend($(QWeb.render("AttachmentURL", { widget: this })));
this.$(".input_url input").on("change", function () {
var input_val = $(this).val();
self._setValue(input_val);
});
},

is_url_valid: function(value) {
is_url_valid: function (value) {
if (value || (this.$input && this.$input.is("input"))) {
var u = new RegExp(
"^(http[s]?:\\/\\/(www\\.)?|ftp:\\/\\/(www\\.)?|www\\.){1}([0-9A-Za-z-\\.@:%_~#=]+)+((\\.[a-zA-Z]{2,3})+)(/(.)*)?(\\?(.)*)?"
Expand All @@ -39,7 +37,7 @@ odoo.define("ir_attachment_url", function(require) {
return true;
},

_render: function() {
_render: function () {
if (!this.is_url_valid(this.value)) {
return this._super();
}
Expand All @@ -61,14 +59,14 @@ odoo.define("ir_attachment_url", function(require) {
});
this.$("> img").remove();
this.$el.prepend($img);
$img.on("error", function() {
$img.on("error", function () {
self.on_clear();
$img.attr("src", self.placeholder);
self.do_warn(_t("Image"), _t("Could not display the selected image."));
});
},

isSet: function() {
isSet: function () {
return true;
},
});
Expand Down
8 changes: 4 additions & 4 deletions ir_attachment_url/views/ir_attachment_res_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
class="oe_form_configuration"
>
<header>
<button
<button
string="Apply"
type="object"
name="execute"
class="oe_highlight"
/>
or
<button
or
<button
string="Cancel"
type="object"
name="cancel"
class="oe_link"
/>
</header>
</header>
<div>
<group string="ir.attachment settings">
<field name="ir_attachment_url_storage" />
Expand Down
10 changes: 6 additions & 4 deletions odoo_backup_sh/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ def set_values(self):

@api.onchange("odoo_backup_sh_amazon_access_key_id")
def switch_to_private_s3(self):
if self.odoo_backup_sh_amazon_access_key_id and self.odoo_backup_sh_amazon_access_key_id != self.env[
"ir.config_parameter"
].get_param(
"odoo_backup_sh.aws_access_key_id"
if (
self.odoo_backup_sh_amazon_access_key_id
and self.odoo_backup_sh_amazon_access_key_id
!= self.env["ir.config_parameter"].get_param(
"odoo_backup_sh.aws_access_key_id"
)
):
# when Access Key is changed to new non-empty value
self.odoo_backup_sh_odoo_oauth_uid = ""
Expand Down
Loading