Permalink
Browse files

Merge branch '11.0' of https://github.com/it-projects-llc/misc-addons

…into 11.0-autostaging_base-porting_2
  • Loading branch information...
Ommo73 committed Feb 1, 2019
2 parents 2b914d3 + df79343 commit c081e03b8e9f659f419b21d22c1cc5bc64a600d1
@@ -75,7 +75,7 @@
<field name="name">sale.order.line.tree</field>
<field name="model">sale.order.line</field>
<field name="arch" type="xml">
<tree string="Booking Tree" colors="red:overlap">
<tree colors="red:overlap">
<field name="order_id"/>
<field name="product_id"/>
<field name="name"/>
@@ -5,7 +5,7 @@
<field name="name">Update Rates service</field>
<field name="model">currency.rate.update.service</field>
<field name="arch" type="xml">
<tree string="Rates">
<tree>
<field name="service"/>
<field name="currency_to_update"/>

@@ -6,7 +6,7 @@
<field name="name">sale.order.line.tree</field>
<field name="model">sale.order.line</field>
<field name="arch" type="xml">
<tree string="Sales Orders Lines">
<tree>
<field name="sequence" widget="handle"/>
<field name="state" invisible="1"/>
<field name="th_weight" invisible="1"/>
@@ -23,14 +23,14 @@
<notebook invisible="1">
<page string="Invoiced">
<field name="invoiced_line_ids" mode="tree" nolabel="1">
<tree string="Invoiced lines" editable="False" create="0" delete="false">
<tree editable="False" create="0" delete="false">
<field name="write_date"/>
</tree>
</field>
</page>
<page string="Draft">
<field name="draft_line_ids" mode="tree" nolabel="1">
<tree string="Draft lines" editable="False" create="0" delete="false">
<tree editable="False" create="0" delete="false">
<field name="write_date"/>
</tree>
</field>
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
import logging
@@ -22,6 +21,9 @@ def content_image(self, xmlid=None, model='ir.attachment', id=None, field='datas

res = super(BinaryExtended, self).content_image(xmlid, model, id, field, filename_field, unique, filename, mimetype, download, width, height)

# TODO: if model=="product.product" and field in ('image', 'image_small', 'image_medium')
# we need to make similar trick, because those fields are computed resizes of image_variant
# with sizes 64*64, 128*128, 1024*1024
if not (res.status_code == 301 and (width or height)):
return res

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2016-2018 Ildar Nasyrov <https://it-projects.info/team/iledarn>
# Copyright 2016-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
import base64
@@ -3,7 +3,7 @@
"summary": """Use attachment URL and upload data to external storage""",
"category": "Tools",
"images": [],
"version": "11.0.1.1.7",
"version": "11.0.1.1.8",
"application": False,

"author": "IT-Projects LLC, Ildar Nasyrov",
@@ -1,3 +1,9 @@
`1.1.8`
-------

- **Fix** When a link to a picture that does not have an extension is written in a binary field, its mimetype is not determined, which leads to an "binascii.Error: decoding with base64 codec failed (Error: Incorrect padding)"
- **Improvement:** The `index_content` field is filled for attachments when a link to a file is written in a binary field.

`1.1.7`
-------

@@ -1,8 +1,33 @@
# Copyright 2017 Dinar Gabbasov <https://www.it-projects.info/team/GabbasovDinar>
# Copyright 2018 Rafis Bikbov <https://www.it-projects.info/team/RafiZz>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo import fields
import mimetypes
import requests

from odoo.tools.mimetypes import guess_mimetype
from . import image


def get_mimetype_and_optional_content_by_url(url):
mimetype = mimetypes.guess_type(url)[0]
content = None

# head request for content-type header getting
if not mimetype:
with requests.head(url) as r:
mimetype = getattr(r, 'headers', {}).get('Content-Type')

index_content = mimetype and mimetype.split('/')[0]
if not mimetype or index_content == 'text':
with requests.get(url) as r:
content = getattr(r, 'content')
if not mimetype and content:
mimetype = guess_mimetype(content)

return mimetype, content


class Binary(fields.Binary):

def write(self, records, value, create=False):
@@ -20,13 +45,18 @@ def write(self, records, value, create=False):
if value and image.is_url(value):
with records.env.norecompute():
if value:
mimetype, content = get_mimetype_and_optional_content_by_url(value)
index_content = records.env['ir.attachment']._index(content, None, mimetype)

# update the existing attachments
atts.write({
'url': value,
'mimetype': mimetypes.guess_type(value)[0],
'mimetype': mimetype,
'datas': None,
'type': 'url',
'index_content': index_content,
})

# create the missing attachments
for record in (records - records.browse(atts.mapped('res_id'))):
atts.create({
@@ -36,6 +66,8 @@ def write(self, records, value, create=False):
'res_id': record.id,
'type': 'url',
'url': value,
'mimetype': mimetype,
'index_content': index_content,
})
else:
atts.unlink()
@@ -1,3 +1,6 @@
# Copyright 2017 Dinar Gabbasov <https://www.it-projects.info/team/GabbasovDinar>
# Copyright 2018 Rafis Bikbov <https://www.it-projects.info/team/RafiZz>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo import tools
import re

@@ -51,7 +51,7 @@
<field name="name">pitch.tree</field>
<field name="model">pitch_booking.pitch</field>
<field name="arch" type="xml">
<tree string="Pitches">
<tree>
<field name="name"/>
<field name="venue_id"/>
</tree>
@@ -78,7 +78,7 @@
<field name="name">venue.tree</field>
<field name="model">pitch_booking.venue</field>
<field name="arch" type="xml">
<tree string="Venues">
<tree>
<field name="name"/>
</tree>
</field>
@@ -68,7 +68,7 @@
<field name="name">project_tags.project_tag.tree</field>
<field name="model">project_tags.project_tag</field>
<field name="arch" type="xml">
<tree string="project_tag"
<tree
>
<field name="name"
/>
@@ -8,7 +8,7 @@
<field name="priority" eval="999"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='timesheet_ids']/tree" position="replace">
<tree editable="bottom" string="Timesheet Activities" default_order="date">
<tree editable="bottom" default_order="date">
<field name="name" attrs="{'readonly': [('status', '=', 'nonactive')]}"/>
<field name="status" invisible="1"/>
<field name="user_current" invisible="1"/>
@@ -105,7 +105,7 @@
<field name="name">timelog</field>
<field name="model">project.timelog</field>
<field name="arch" type="xml">
<tree string="My timelog" create="false" edit="true" >
<tree create="false" edit="true" >
<field name="work_id" string="Subtask"/>
<field name="start_datetime" />
<field name="end_datetime" />
@@ -120,7 +120,7 @@
<field name="name">timelog</field>
<field name="model">project.timelog</field>
<field name="arch" type="xml">
<tree string="Timelog" create="false" edit="true" >
<tree create="false" edit="true" >
<field name="user_id" string="User"/>
<field name="work_id" sting="Subtask"/>
<field name="start_datetime" />
@@ -218,7 +218,7 @@
<field name="name">account.analytic.line.ext.tree</field>
<field name="model">account.analytic.line</field>
<field name="arch" type="xml">
<tree string="Project Task Work">
<tree>
<field name="user_id" invisible="1"/>
<field name="name" readonly="1"/>
<field name="account_id" readonly="1"/>
@@ -32,7 +32,7 @@
<field name="model">res.users.signature</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Signatures">
<tree>
<field name="name"/>
<field name="comment"/>
</tree>
@@ -6,7 +6,7 @@
<field name="name">sendandlog.tree</field>
<field name="model">sms_sg.sendandlog</field>
<field name="arch" type="xml">
<tree string="Course Tree">
<tree>
<field name="msg"/>
<field name="phone"/>
<field name="response_content"/>
@@ -15,7 +15,7 @@ Removes references to odoo.com:
2. Replaces "Odoo" in page title
3. Replaces "Odoo" in help message for empty list.

Some list views has word Odoo when search return empty result. E.g. search random string at menu ``[[ Settings ]] >> Users & Copanies >> Companies`` that return empty result -- it has Odoo word
Some list views has word Odoo when search return empty result. E.g. search random string at menu ``[[ Settings ]] >> Users & Companies >> Companies`` that return empty result -- it has Odoo word

Create and manage the companies that will be managed by **Odoo** from here. Shops or subsidiaries can be created and maintained from here.

@@ -24,7 +24,7 @@ Removes references to odoo.com:
6. *(feature is not required in 11.0+ versions)*
7. Replaces "Odoo" in Dialog Box

E.g. try to remove Administrator via menu ``[[ Settings ]] >> Users & Copanies >> Users``. It will show warning
E.g. try to remove Administrator via menu ``[[ Settings ]] >> Users & Companies >> Users``. It will show warning

You can not remove the admin user as it is used internally for resources created by **Odoo** (updates, module installation, ...)

@@ -26,11 +26,15 @@ def test_01_remove_developer_mode_menu_elements(self):
console.log('page is loading');
return;
}
setTimeout(function(){
// request ..../res.users/is_admin may take some time
// TODO: add a way to check that it's a time to check result (variable on loading in web_debranding/static/src/js/user_menu.js ?)
if ($('li a[data-menu="debug"]').length > 0 || $('li a[data-menu="debugassets"]').length > 0) {
console.log('error', 'Developer mode menu elements are displayed for not admin user');
console.log('error', 'Developer mode menu elements are displayed for non-admin user');
} else {
console.log('ok');
}
}, 1000);
}, 1000);
})
"""
@@ -15,7 +15,7 @@
<field name="name">web_iframe_pages.page.tree</field>
<field name="model">web_iframe_pages.page</field>
<field name="arch" type="xml">
<tree string="IFrame" editable="top">
<tree editable="top">
<field name="menu_id_parent_id" context="{'default_iframe_pages_group':True}"/>
<field name="menu_id_name"/>
<field name="link"/>
@@ -6,7 +6,7 @@
"category": "Hidden",
# "live_test_url": "",
"images": [],
"version": "11.0.3.0.1",
"version": "11.0.3.0.2",
"application": False,

"author": "IT-Projects LLC, Ivan Yelizariev",
@@ -1,3 +1,7 @@
`3.0.2`
-------
- **Fix:** Error related to incorrect SQL request

`3.0.1`
-------
- **Fix:** Incorrect website priority after odoo updates https://github.com/odoo/odoo/commit/b6d32de31e0e18a506ae06dc27561d1d078f3ab1
@@ -108,10 +108,11 @@ def get_multi(self, name, model, ids):
# It has the same idea and structure, but sql request and set record value method are changed
if not ids:
return {}
website_id = self._context.get('website_id', None)
# it's important, that website_id cannot be False -- otherwise, an error is raised on SQL request
website_id = self._get_website_id() or None
field = self.env[model]._fields[name]
field_id = self.env['ir.model.fields']._get(model, name).id
company_id = self._context.get('force_company') or self.env['res.company']._company_default_get(model, field_id).id
company_id = self._context.get('force_company') or self.env['res.company']._company_default_get(model, field_id).id or None

if field.type == 'many2one':
comodel = self.env[field.comodel_name]

0 comments on commit c081e03

Please sign in to comment.