profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/moylop260/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Moises Lopez - https://www.vauxoo.com/ moylop260 Vauxoo México http://www.vauxoo.com

Pull request review commentOCA/l10n-iran

add l10_ir_base

+<?xml version="1.0" encoding="utf-8"?>+<odoo>+    <data>+        <record id="accoutn_group_action" model="ir.actions.act_window">+            <field name="name">گروه حساب</field>+            <field name="res_model">account.group</field>+            <field name="view_mode">tree,form</field>+            <field name="search_view_id" ref="account.view_account_group_search"/>+            <field name="view_id" ref="account.view_account_group_tree"/>+            <field name="help" type="html">+                <p class="o_view_nocontent_smiling_face">+                یک گروه حساب جدید تعریف کنید+                </p><p>+                گروه حساب مشخص کردن سطح کل و گروه سیستم کدینگ است++                </p>+            </field>+        </record>++        <menuitem id="accoutn_group_menu" sequence="1"

typo

        <menuitem id="account_group_menu" sequence="1"
saeed-raeisi

comment created time in 12 hours

Pull request review commentOCA/l10n-iran

add l10_ir_base

+from datetime import date, datetime, timedelta+from odoo.api import model+import jdatetime as jd+++from babel.dates import format_datetime, format_date+from odoo import models, api, _, fields+from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF+from odoo.tools.misc import formatLang, format_date as odoo_format_date, get_lang+import random++class account_journal(models.Model):+    _inherit = "account.journal"++    def get_bar_graph_datas(self):+        data = []+        today = fields.Datetime.now(self)+        data.append({'label': _('Due'), 'value':0.0, 'type': 'past'})+        day_of_week = int(format_datetime(today, 'e', locale=get_lang(self.env).code))+        first_day_of_week = today + timedelta(days=-day_of_week+1)+        for i in range(-1,4):+            if i==0:+                label = _('This Week')+            elif i==3:+                label = _('Not Due')+            else:+                start_week = first_day_of_week + timedelta(days=i*7)+                end_week = start_week + timedelta(days=6)+                if start_week.month == end_week.month:+                    # label = str(start_week.day) + '-' + str(end_week.day) + ' ' + format_date(end_week, 'MMM', locale=get_lang(self.env).code)+                    start_week = jd.date.fromgregorian(day=start_week.day,month=start_week.month,year=start_week.year,locale='fa_IR')+                    end_week = jd.date.fromgregorian(day=end_week.day,month=end_week.month,year=end_week.year,locale='fa_IR')+                    label = str(start_week.day) + '-' + str(end_week.day) + ' ' + end_week.strftime("%b")+                else:+                    +                    # label = format_date(start_week, 'd MMM', locale=get_lang(self.env).code) + '-' + format_date(end_week, 'd MMM', locale=get_lang(self.env).code)+                    label = jd.date.fromgregorian(day=start_week.day,month=start_week.month,year=start_week.year,locale='fa_IR').strftime("%d %b") + '-' + jd.date.fromgregorian(day=end_week.day,month=end_week.month,year=end_week.year,locale='fa_IR').strftime("%d %b")+            data.append({'label':label,'value':0.0, 'type': 'past' if i<0 else 'future'})++        # Build SQL query to find amount aggregated by week+        (select_sql_clause, query_args) = self._get_bar_graph_select_query()+        query = ''+        start_date = (first_day_of_week + timedelta(days=-7))+        for i in range(0,6):+            if i == 0:+                query += "("+select_sql_clause+" and invoice_date_due < '"+start_date.strftime(DF)+"')"
                query += "("+select_sql_clause+" and invoice_date_due < '"+fields.Datetime.fromstring(start_date)+"')"
saeed-raeisi

comment created time in 12 hours

Pull request review commentOCA/l10n-iran

add l10_ir_base

+from odoo import models,api++import logging+import pytz+import babel.dates+from odoo.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT, get_lang+from odoo.osv import expression++import jdatetime as jd++_logger = logging.getLogger(__name__)++def display_format_changer(df):+        return {+        'hh:00 dd MMM': '%d %b %H',+        'dd MMM yyyy': '%d %b %Y',+        "'W'w YYYY": '%A %Y',+        'MMMM yyyy': '%b %Y',+        'QQQ yyyy': '%b %Y',+        'yyyy': '%Y',+    }.get(df, '%d %b %Y') +    ++class BaseModelExtend(models.AbstractModel):+    _inherit = 'base'+    @api.model+    def _read_group_format_result(self, data, annotated_groupbys, groupby, domain):+        sections = []+        for gb in annotated_groupbys:+            ftype = gb['type']+            value = data[gb['groupby']]++            # full domain for this groupby spec+            d = None+            if value:+                if ftype == 'many2one':+                    value = value[0]+                elif ftype in ('date', 'datetime'):+                    locale = get_lang(self.env).code+                    fmt = DEFAULT_SERVER_DATETIME_FORMAT if ftype == 'datetime' else DEFAULT_SERVER_DATE_FORMAT+                    tzinfo = None+                    range_start = value+                    range_end = value + gb['interval']+                    # value from postgres is in local tz (so range is+                    # considered in local tz e.g. "day" is [00:00, 00:00[+                    # local rather than UTC which could be [11:00, 11:00]+                    # local) but domain and raw value should be in UTC+                    if gb['tz_convert']:

what about using fields.Datetime methods to use the tz transformation of the user

saeed-raeisi

comment created time in 12 hours

Pull request review commentOCA/l10n-iran

add l10_ir_base

+<?xml version="1.0" encoding="utf-8"?>+<odoo>+    <data>+        <record id="accoutn_group_action" model="ir.actions.act_window">+            <field name="name">گروه حساب</field>+            <field name="res_model">account.group</field>+            <field name="view_mode">tree,form</field>+            <field name="search_view_id" ref="account.view_account_group_search"/>+            <field name="view_id" ref="account.view_account_group_tree"/>+            <field name="help" type="html">+                <p class="o_view_nocontent_smiling_face">

if you are re-defining this action/menu to translate strings better using i18n

or why it was redefined?

saeed-raeisi

comment created time in 12 hours

Pull request review commentOCA/l10n-iran

add l10_ir_base

++from odoo import fields, models+++class AccountGroup(models.Model):+    _inherit = 'account.group'

useless code

saeed-raeisi

comment created time in 12 hours

Pull request review commentOCA/l10n-iran

add l10_ir_base

+On the employee form view you will have 3 fields,+one for personnel_code,+second for iran_iD_number,+last for father_name.

this module is not adding these fields

and we have partner_firstname module to add part of this

saeed-raeisi

comment created time in 12 hours

Pull request review commentOCA/l10n-iran

add l10_ir_base

+<!--

use the readme from template example in maintainers-tools

saeed-raeisi

comment created time in 12 hours

Pull request review commentOCA/l10n-iran

add l10_ir_base

+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).++{+    "name": "Iran - Base",+    "version": "14.0.3.0.0",+    "author": "saeed Raeisi, "+    "Fawan",+    "maintainer": "Saeed Raeisi",+    "website": "https://fadoo.ir",+    "license": "AGPL-3",+    "category": "بومی سازی ایران/Technical",+    "summary": "بومی سازی ایران ",+    "depends": ["base","account"],+    "data": [],+        'external_dependencies': {

extra identation

saeed-raeisi

comment created time in 12 hours

Pull request review commentOCA/l10n-iran

add l10_ir_base

+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).+from . import models

newline for all files

saeed-raeisi

comment created time in 12 hours

Pull request review commentOCA/l10n-iran

add l10_ir_base

+<?xml version="1.0" encoding="utf-8"?>+<odoo>+    <data>+        <record id="accoutn_group_action" model="ir.actions.act_window">+            <field name="name">گروه حساب</field>

use English language in the code but i18n/ir.po

saeed-raeisi

comment created time in 12 hours

PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent

delete branch vauxoo-dev/server-tools

delete branch : 8.0-Freeze-Unicode-Version-CarmenMiranda

delete time in 10 days

push eventVauxoo/server-tools

Carmen Miranda - https://www.vauxoo.com/

commit sha 141e0fc6a805110b789332d0d3a0daa58fb4f2f8

[FIX] Freeze Unicode python version (#161) Since the new version is not compatible with py2.7 which is the python used in this Odoo version.

view details

push time in 10 days

PR merged Vauxoo/server-tools

[FIX] Freeze Unicode python version

Since the new version is not compatible with py2.7 which is the python used in this Odoo version.

+1 -1

2 comments

1 changed file

CarmenMiranda

pr closed time in 10 days

Pull request review commentVauxoo/odoo

[IMP] core: mitigate possible deadlock computing fields

 def recompute(self):                     continue                 vals = rec._convert_to_write(vals)                 updates[frozendict(vals)].add(rec.id)+            st_timeout = recs.env['ir.config_parameter'].sudo().get_param('compute_statement_timeout')

I preferred don't use default in order to disable entirely the SET queries

I mean, removing the parameter the method will "yield" early with 0 extra queries executed to SET PSQL parameters

In order to use the original way of Odoo

moylop260

comment created time in 10 days

PullRequestReviewEvent

push eventvauxoo-dev/odoo

Moises Lopez - https://www.vauxoo.com/

commit sha 421fafe26597e4928ebf4f7cf91c9c1be06d5914

[IMP] core: mitigate possible deadlock computing fields If we have computed fields depending on model A But model A have compute fields depending on model B too The possibility to reproduce a deadlock is very high This change set a timeout in order to avoid locking a record for 14h (real locking time from live production databases) We could use `lock_timeout` PG parameter but it will stop the next queries to locked one but the sentence locking will not stop it so the raises will increase Using `statement_timeout` will stop any sentence spending more than that time including the `SELECT` ones not only `UPDATE` For this reason the parameter is set only in `_write` method in order to reduce a possible stop for a large `SELECT` and only stop `UPDATE` sentences

view details

push time in 10 days

pull request commentVauxoo/odoo

[IMP] core: mitigate possible deadlock computing fields

For record

Using a demo database with -i sale,purchase,sale_management,account,sale_subscription Executing ./odoo-bin shell -d DB --no-http --logfile=/tmp/odoo.log --log-level=debug_sql

And running line by line the following code

env['ir.config_parameter'].sudo().set_param('psql_statement_timeout', '1ms')
env.cr.execute("SHOW statement_timeout")
print(env.cr.fetchone()[0])
# 0
sale = env['sale.order'].browse(1)
sale.write({'state': 'draft'})
# QueryCanceled: canceling statement due to statement timeout
sale.write({'state': 'draft'})
# QueryCanceled: canceling statement due to statement timeout
sale.write({'state': 'draft'})
# QueryCanceled: canceling statement due to statement timeout
env.cr.execute("SHOW statement_timeout")
print(env.cr.fetchone()[0])
# 0
env['ir.config_parameter'].sudo().set_param('psql_statement_timeout', '1min')
sale.write({'state': 'draft'})
# True
env.cr.rollback()

The queries executed for sale.write({'state': 'draft'}) with 1ms

SELECT id FROM "sale_order_line" WHERE "order_id" in (1)
UPDATE "sale_order" SET "state"='draft',"write_uid"=1,"write_date"=(now() at time zone 'UTC') WHERE id IN (1)
SELECT id FROM "sale_order_line" WHERE "order_id" in (1)
SELECT "sale_order"."id" as "id","sale_order"."partner_shipping_id" as "partner_shipping_id","sale_order"."amount_total" as "amount_total","sale_order"."payment_term_id" as "payment_term_id","sale_order"."origin" as "origin","sale_order"."access_token" as "access_token","sale_order"."pricelist_id" as "pricelist_id","sale_order"."require_signature" as "require_signature","sale_order"."currency_rate" as "currency_rate","sale_order"."fiscal_position_id" as "fiscal_position_id","sale_order"."signed_by" as "signed_by","sale_order"."message_main_attachment_id" as "message_main_attachment_id","sale_order"."note" as "note","sale_order"."write_date" as "write_date","sale_order"."client_order_ref" as "client_order_ref","sale_order"."require_payment" as "require_payment","sale_order"."user_id" as "user_id","sale_order"."company_id" as "company_id","sale_order"."amount_untaxed" as "amount_untaxed","sale_order"."reference" as "reference","sale_order"."commitment_date" as "commitment_date","sale_order"."analytic_account_id" as "analytic_account_id","sale_order"."partner_id" as "partner_id","sale_order"."team_id" as "team_id","sale_order"."create_uid" as "create_uid","sale_order"."date_order" as "date_order","sale_order"."state" as "state","sale_order"."create_date" as "create_date","sale_order"."partner_invoice_id" as "partner_invoice_id","sale_order"."sale_order_template_id" as "sale_order_template_id","sale_order"."validity_date" as "validity_date","sale_order"."amount_tax" as "amount_tax","sale_order"."write_uid" as "write_uid","sale_order"."confirmation_date" as "confirmation_date","sale_order"."name" as "name" FROM "sale_order" WHERE "sale_order".id IN (1)
SHOW statement_timeout
SAVEPOINT "4ad9b9ca164411ec8aed1e003a34d891"
SET SESSION statement_timeout='1ms'
RELEASE SAVEPOINT "4ad9b9ca164411ec8aed1e003a34d891"
SAVEPOINT "4ad9e8d2164411ec8aed1e003a34d891"
UPDATE "sale_order_line" SET "state"='draft',"write_uid"=1,"write_date"=(now() at time zone 'UTC') WHERE id IN (1, 2, 3)
-- bad query: UPDATE "sale_order_line" SET "state"='draft',"write_uid"=1,"write_date"=(now() at time zone 'UTC') WHERE id IN (1, 2, 3)
-- ERROR: canceling statement due to statement timeout
-- CONTEXT:  SQL statement "SELECT 1 FROM ONLY "public"."product_product" x WHERE "id" OPERATOR(pg_catalog.=) $1 FOR KEY SHARE OF x"
ROLLBACK TO SAVEPOINT "4ad9e8d2164411ec8aed1e003a34d891"
SET SESSION statement_timeout='0'

The queries executed for sale.write({'state': 'draft'}) with 1min

SELECT id FROM "sale_order_line" WHERE "order_id" in (1) 
UPDATE "sale_order" SET "state"='draft',"write_uid"=1,"write_date"=(now() at time zone 'UTC') WHERE id IN (1) 
SELECT id FROM "sale_order_line" WHERE "order_id" in (1) 
SELECT "sale_order"."id" as "id","sale_order"."partner_shipping_id" as "partner_shipping_id","sale_order"."amount_total" as "amount_total","sale_order"."payment_term_id" as "payment_term_id","sale_order"."origin" as "origin","sale_order"."access_token" as "access_token","sale_order"."pricelist_id" as "pricelist_id","sale_order"."require_signature" as "require_signature","sale_order"."currency_rate" as "currency_rate","sale_order"."fiscal_position_id" as "fiscal_position_id","sale_order"."signed_by" as "signed_by","sale_order"."message_main_attachment_id" as "message_main_attachment_id","sale_order"."note" as "note","sale_order"."write_date" as "write_date","sale_order"."client_order_ref" as "client_order_ref","sale_order"."require_payment" as "require_payment","sale_order"."user_id" as "user_id","sale_order"."company_id" as "company_id","sale_order"."amount_untaxed" as "amount_untaxed","sale_order"."reference" as "reference","sale_order"."commitment_date" as "commitment_date","sale_order"."analytic_account_id" as "analytic_account_id","sale_order"."partner_id" as "partner_id","sale_order"."team_id" as "team_id","sale_order"."create_uid" as "create_uid","sale_order"."date_order" as "date_order","sale_order"."state" as "state","sale_order"."create_date" as "create_date","sale_order"."partner_invoice_id" as "partner_invoice_id","sale_order"."sale_order_template_id" as "sale_order_template_id","sale_order"."validity_date" as "validity_date","sale_order"."amount_tax" as "amount_tax","sale_order"."write_uid" as "write_uid","sale_order"."confirmation_date" as "confirmation_date","sale_order"."name" as "name" FROM "sale_order" WHERE "sale_order".id IN (1) 
SHOW statement_timeout 
SAVEPOINT "06fd6b42164511ec81851e003a34d891" 
SET SESSION statement_timeout='1min' 
RELEASE SAVEPOINT "06fd6b42164511ec81851e003a34d891" 
SAVEPOINT "06fd8960164511ec81851e003a34d891" 
UPDATE "sale_order_line" SET "state"='draft',"write_uid"=1,"write_date"=(now() at time zone 'UTC') WHERE id IN (1, 2, 3) 
RELEASE SAVEPOINT "06fd8960164511ec81851e003a34d891" 
SET SESSION statement_timeout='0' 
SHOW statement_timeout 
SAVEPOINT "06fe0e08164511ec81851e003a34d891" 
SET SESSION statement_timeout='1min' 
RELEASE SAVEPOINT "06fe0e08164511ec81851e003a34d891" 
SAVEPOINT "06fe325c164511ec81851e003a34d891" 
UPDATE "sale_order_line" SET "qty_delivered_method"='manual',"write_uid"=1,"write_date"=(now() at time zone 'UTC') WHERE id IN (1, 2, 3) 
RELEASE SAVEPOINT "06fe325c164511ec81851e003a34d891" 
SET SESSION statement_timeout='0' 
SELECT "sale_order_line"."id" as "id","sale_order_line"."order_id" as "order_id","sale_order_line"."price_unit" as "price_unit","sale_order_line"."currency_id" as "currency_id","sale_order_line"."state" as "state","sale_order_line"."create_date" as "create_date","sale_order_line"."price_reduce_taxexcl" as "price_reduce_taxexcl","sale_order_line"."is_expense" as "is_expense","sale_order_line"."product_id" as "product_id","sale_order_line"."qty_delivered_manual" as "qty_delivered_manual","sale_order_line"."price_subtotal" as "price_subtotal","sale_order_line"."company_id" as "company_id","sale_order_line"."display_type" as "display_type","sale_order_line"."create_uid" as "create_uid","sale_order_line"."write_date" as "write_date","sale_order_line"."discount" as "discount","sale_order_line"."is_downpayment" as "is_downpayment","sale_order_line"."price_tax" as "price_tax","sale_order_line"."product_uom" as "product_uom","sale_order_line"."write_uid" as "write_uid","sale_order_line"."order_partner_id" as "order_partner_id","sale_order_line"."customer_lead" as "customer_lead","sale_order_line"."price_total" as "price_total","sale_order_line"."qty_invoiced" as "qty_invoiced","sale_order_line"."name" as "name","sale_order_line"."product_uom_qty" as "product_uom_qty","sale_order_line"."qty_delivered_method" as "qty_delivered_method","sale_order_line"."price_reduce" as "price_reduce","sale_order_line"."untaxed_amount_invoiced" as "untaxed_amount_invoiced","sale_order_line"."salesman_id" as "salesman_id","sale_order_line"."sequence" as "sequence","sale_order_line"."price_reduce_taxinc" as "price_reduce_taxinc" FROM "sale_order_line" WHERE "sale_order_line".id IN (1, 2, 3) 
SHOW statement_timeout 
SAVEPOINT "06ff8878164511ec81851e003a34d891" 
SET SESSION statement_timeout='1min' 
RELEASE SAVEPOINT "06ff8878164511ec81851e003a34d891" 
SAVEPOINT "06ffa9b6164511ec81851e003a34d891" 
UPDATE "sale_order_line" SET "qty_delivered"='0.000',"write_uid"=1,"write_date"=(now() at time zone 'UTC') WHERE id IN (1, 2, 3) 
RELEASE SAVEPOINT "06ffa9b6164511ec81851e003a34d891" 
SET SESSION statement_timeout='0' 
SHOW statement_timeout 
SAVEPOINT "070049de164511ec81851e003a34d891" 
SET SESSION statement_timeout='1min' 
RELEASE SAVEPOINT "070049de164511ec81851e003a34d891" 
SAVEPOINT "07007350164511ec81851e003a34d891" 
UPDATE "sale_order_line" SET "qty_to_invoice"='0.000',"write_uid"=1,"write_date"=(now() at time zone 'UTC') WHERE id IN (1, 2, 3) 
RELEASE SAVEPOINT "07007350164511ec81851e003a34d891" 
SET SESSION statement_timeout='0' 
SHOW statement_timeout 
SAVEPOINT "070138bc164511ec81851e003a34d891" 
SET SESSION statement_timeout='1min' 
RELEASE SAVEPOINT "070138bc164511ec81851e003a34d891" 
SAVEPOINT "0701842a164511ec81851e003a34d891" 
SELECT DISTINCT "order_id" FROM "sale_order_line" WHERE "id" IN (1, 2, 3) 
SELECT "sale_order".id FROM "sale_order" WHERE ("sale_order"."id" in (1)) ORDER BY "sale_order"."id"   
UPDATE "sale_order_line" SET "invoice_status"='no',"write_uid"=1,"write_date"=(now() at time zone 'UTC') WHERE id IN (1, 2, 3) 
SELECT DISTINCT "order_id" FROM "sale_order_line" WHERE "id" IN (1, 2, 3) 
SELECT "sale_order".id FROM "sale_order" WHERE ("sale_order"."id" in (1)) ORDER BY "sale_order"."id"   
RELEASE SAVEPOINT "0701842a164511ec81851e003a34d891" 
SET SESSION statement_timeout='0' 
            SELECT min("sale_order_line".id) AS id, count("sale_order_line".id) AS "__count" , "sale_order_line"."order_id" as "order_id" ,"sale_order_line"."invoice_status" as "invoice_status" 
            FROM "sale_order_line" LEFT JOIN "sale_order" as "sale_order_line__order_id" ON ("sale_order_line"."order_id" = "sale_order_line__order_id"."id")
            WHERE (("sale_order_line"."order_id" in (1))  AND  "sale_order_line"."product_id" IS NOT NULL)
            GROUP BY "sale_order_line"."order_id","sale_order_line"."invoice_status","sale_order_line__order_id"."date_order","sale_order_line__order_id"."id"
            ORDER BY  "sale_order_line__order_id"."date_order" DESC,"sale_order_line__order_id"."id" DESC ,"invoice_status"
SELECT "account_invoice".id FROM "account_invoice" WHERE ((("account_invoice"."origin"::text like '%SO001%')  AND  ("account_invoice"."company_id" = 1))  AND  ("account_invoice"."type" in ('out_invoice','out_refund'))) ORDER BY "account_invoice"."date_invoice" DESC,"account_invoice"."number" DESC,"account_invoice"."id" DESC  
SHOW statement_timeout 
SAVEPOINT "0705b266164511ec81851e003a34d891" 
SET SESSION statement_timeout='1min' 
RELEASE SAVEPOINT "0705b266164511ec81851e003a34d891" 
SAVEPOINT "0705df0c164511ec81851e003a34d891" 
UPDATE "sale_order" SET "invoice_status"='no',"write_uid"=1,"write_date"=(now() at time zone 'UTC') WHERE id IN (1) 
RELEASE SAVEPOINT "0705df0c164511ec81851e003a34d891" 
SET SESSION statement_timeout='0' 
SHOW statement_timeout 
SAVEPOINT "0709e32c164511ec81851e003a34d891" 
SET SESSION statement_timeout='1min' 
RELEASE SAVEPOINT "0709e32c164511ec81851e003a34d891" 
SAVEPOINT "070a0398164511ec81851e003a34d891" 
UPDATE "sale_order_line" SET "untaxed_amount_to_invoice"='0.00',"write_uid"=1,"write_date"=(now() at time zone 'UTC') WHERE id IN (1, 2, 3) 
RELEASE SAVEPOINT "070a0398164511ec81851e003a34d891" 
SET SESSION statement_timeout='0' 
moylop260

comment created time in 10 days

push eventvauxoo-dev/odoo

Moises Lopez - https://www.vauxoo.com/

commit sha ba5a14d7cc5a4d8c8d6f44268e617656f44b4a59

[IMP] core: mitigate possible deadlock computing fields If we have computed fields depending on model A But model A have compute fields depending on model B too The possibility to reproduce a deadlock is very high This change set a timeout in order to avoid locking a record for 14h (real locking time from live production databases) We could use `lock_timeout` PG parameter but it will stop the next queries to locked one but the sentence locking will not stop it so the raises will increase Using `statement_timeout` will stop any sentence spending more than that time including the `SELECT` ones not only `UPDATE` For this reason the parameter is set only in `_write` method in order to reduce a possible stop for a large `SELECT` and only stop `UPDATE` sentences

view details

push time in 10 days

push eventvauxoo-dev/odoo

Moises Lopez - https://www.vauxoo.com/

commit sha 26901073447cdf80bacf4dd43b7fbbd894aaf306

[IMP] core: mitigate possible deadlock computing fields If we have computed fields depending on model A But model A have compute fields depending on model B too The possibility to reproduce a deadlock is very high This change set a timeout in order to avoid locking a record for 14h (real locking time from live production databases) We could use `lock_timeout` PG parameter but it will stop the next queries to locked one but the sentence locking will not stop it so the raises will increase Using `statement_timeout` will stop any sentence spending more than that time including the `SELECT` ones not only `UPDATE` For this reason the parameter is set only in `_write` method in order to reduce a possible stop for a large `SELECT` and only stop `UPDATE` sentences

view details

push time in 10 days

PR opened Vauxoo/odoo

[IMP] core: mitigate possible deadlock computing fields PATCH

If we have computed fields depending on model A But model A have compute fields depending on model B too The possibility to reproduce a deadlock is very high

This change set a timeout in order to avoid locking a record for 14h (real locking time from live production databases)

We could use lock_timeout PG parameter but it will stop the next queries to locked one but the sentence locking will not stop it so the raises will increase

Using statement_timeout will stop any sentence spending more than that time including the SELECT ones not only UPDATE For this reason the parameter is set only in _write method in order to reduce a possible stop for a large SELECT and only stop UPDATE sentences

+21 -1

0 comment

1 changed file

pr created time in 10 days

create barnchvauxoo-dev/odoo

branch : 12.0-compute-timeout-lock-moy

created branch time in 10 days

PullRequestReviewEvent

Pull request review commentodoo/odoo

[FIX] test_lint: Fix some false results

 def _allowable(self, node):         return (isinstance(node, astroid.Attribute)             and isinstance(node.expr, astroid.Name)             and node.attrname.startswith('_')+            # cr.execute('SELECT * FROM %s' % 'table') is OK since that is a constant+            or isinstance(node, astroid.Const)         )      def _check_concatenation(self, node):         if isinstance(node, astroid.BinOp) and node.op in ('%', '+'):+            if (isinstance(node.left, astroid.BinOp) and self._check_concatenation(node.left)):

@xmo-odoo I just have detected this case

cr.execute('SELECT ' + operator + ' FROM table' + 'WHERE')

The representation tree is:

node.repr_tree()
BinOp(
op='+',
left=BinOp(
    op='+',
    left=BinOp(
        op='+',
        left=Const(value='SELECT '),
        right=Name(name='operator')),
    right=Const(value=' FROM table')),
right=Const(value='WHERE'))

Notice that left node is another BinOp node So, it need to be considered recursively

moylop260

comment created time in 11 days

push eventvauxoo-dev/pylint-odoo

Moisés López

commit sha 2cb506c0e8de56b30ff9c2c19b58d6796d2a811e

[REF] sql-injection: No sql-injection using constants The following examples should not be considered as sql-injection: self.env.cr.execute("SELECT * FROM %s" % 'table_constant') self.env.cr.execute("SELECT * FROM {}".format('table_constant')) self.env.cr.execute("SELECT * FROM %(table_variable)s" % {'table_variable': 'table_constant'}) Since that the constant is not possible to inject * [FIX] sql-injection: AttributeError: 'NoneType' object has no attribute 'parent' Using the following code: queries = [ "SELECT id FROM res_partner", "SELECT id FROM res_users", ] for query in queries: self.env.cr.execute(query) The check sql-injection shows the following error: - AttributeError: 'NoneType' object has no attribute 'parent' So, Now it is validating if it is not None * [FIX] sql-injection: Fix false positive using BinOp "+" Considering the following valid case: cr.execute('SELECT ' + operator + ' FROM table' + 'WHERE') The representation tree is: node.repr_tree() BinOp( op='+', left=BinOp( op='+', left=BinOp( op='+', left=Const(value='SELECT '), right=Name(name='operator')), right=Const(value=' FROM table')), right=Const(value='WHERE')) Notice that left node is another BinOp node So, it need to be considered recursively

view details

push time in 11 days

push eventvauxoo-dev/odoo

Moises Lopez - https://www.vauxoo.com/

commit sha f1b3c89ab0ab86ae01119b900b2d16571665f8f1

[FIX] test_lint: Fix some false results * [FIX] test_lint: Consider variables for sql-injection Using the following code: ```python var = 'SELECT name FROM account WHERE id IN {}' values = (1, 2, 3) self._cr.execute(var.format(values)) ``` It has a risky sql injection ignored before of this change And allow psycopg2.SQL way mapping the variables declaration * [FIX] sql-injection: AttributeError: 'NoneType' object has no attribute 'parent' Using the following code: queries = [ "SELECT id FROM res_partner", "SELECT id FROM res_users", ] for query in queries: self.env.cr.execute(query) The check sql-injection shows the following error: - AttributeError: 'NoneType' object has no attribute 'parent' So, Now it is validating if it is not None * [REF] sql-injection: Using better naming for node_ofc -> node_assign * [FIX] sql-injection: Fix false positive using BinOp "+" Considering the following valid case: cr.execute('SELECT ' + operator + ' FROM table' + 'WHERE') The representation tree is: node.repr_tree() BinOp( op='+', left=BinOp( op='+', left=BinOp( op='+', left=Const(value='SELECT '), right=Name(name='operator')), right=Const(value=' FROM table')), right=Const(value='WHERE')) Notice that left node is another BinOp node So, it need to be considered recursively

view details

push time in 11 days

push eventvauxoo-dev/odoo

Nathan Marotte (nama)

commit sha e4f5c0d13fb5b04c4a334758c26e442efbb247d4

[FIX] account : resequencing showed a ghost state change draft -> posted Issue: When resequencing an account_move, the chatter showed the resequencing but also a ghost change of state from draft to posted Steps to reproduce : 1) Create an invoice and post it 2) Look up the journal entry for the invoice and resequence it to some arbitrary other name 3) Check the chatter for that invoice, it shows a change from draft to posted Why is that a bug: The state isn't changed so it shouldn't be logged Side-Note: I don't understand why in the code until this commit we had to force change the state to draft to change the name of the move, when I tested, we can change the name of a posted move without any issue opw-2581248 closes odoo/odoo#75620 Signed-off-by: William André (wan) <wan@odoo.com>

view details

Swapnesh Shah

commit sha 5919fbb8a4a3bdf4e7122dadf419a131bad8d1f8

[FIX] account: use current date as fallback to convert currency Description of the issue/feature this PR addresses: Fixes #76177 Current behavior before PR: Before this commit, There will be tracback on adding new Journal Item if there is not date on Journal Entry. Desired behavior after PR is merged: Now we use current date to as fallback to convert currency. closes odoo/odoo#76178 Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>

view details

Florent de Labarre

commit sha c9f12f619318578a7a707c354fe715e3f9b5b73c

[FIX] mail: handle wrong Final-Recipient header in incoming emails Some emails are wrongly formatted mainly due to old servers. If Final-Recipient header is void or wrongly encoded it currently crashes. This fix ensure there is no crash, even if bounce detection could be incomplete. Task-2641572 PR odoo/odoo#76159 Closes odoo/odoo#75618 Co-Authored-By: Thibault Delavallee <tde@odoo.com>

view details

Florent de Labarre

commit sha 7cce75bce2749dd86815ea9091b6c278c627055c

[FIX] mail: handle parsing of void body in incoming emails When body does not contain any tag or content parsing currently fails with an ``lxml.etree.ParserError``. To avoid that we can improve condition about void body: stripping void characters allows to avoid that traceback. Task-2641572 PR odoo#76159 Closes odoo#75625 Part-of: odoo/odoo#76159 Co-authored-by: Thibault Delavallee <tde@odoo.com>

view details

Jinal Patel

commit sha e8f558aac50f3ad628e9060d1ed212ae4321aa61

[FIX] mail: fix ACLs issue with mail composer in new mode As create_uid has no value on mail.compose.message model when being in onchange or new mode, 'Mail Compose Message Rule' record rule may crash. In this commit we fix that issue by adding a value for create_uid. An unit test is added to ensure it effectively fixes the use case. Steps to reproduce this warning: 1. Create automated action for the 'mail.compose.message' model 2. Try to open 'Email compose Wizard' Warning: "Due to security restrictions, you are not allowed to modify 'Email composition wizard' (mail.compose.message) records. Records: mail.compose.message,NewId_0x7f8e99762310 (id=NewId_0x7f8e99762310) User: USERNAME (id=2) This restriction is due to the following rules: Contact your administrator to request access if necessary." Task-2641572 opw-2628005 PR odoo#76159 Closes#75369 Part-of: odoo/odoo#76159 Co-authored-by: Thibault Delavallee <tde@odoo.com>

view details

Jairo Llopis

commit sha e6499b3bc9108d7c916c335973ad27339649a561

[FW][IMP] test_mail: test models with type do not mess with attachment types Purpose of this commit is to highlight an issue that may happens easily with `crm` that is made generic here within `test_mail`. `crm` alters the context when creating a new record adding in this case `default_type` to it][1]. The returned record contains that altered context. his results in other records created from it trying to assign that same default value for `type`. This is a very common name for fields, and happens to exist in `ir.attachment` too. If you create an alias for incoming leads in your DB with default values `{"type": "lead"}` (something very common) and then an email comes to that alias that contains an inlined base64 image, the attachment creation process would simply fail. Obtained error is ``ValueError: Wrong value for ir.attachment.type: 'lead'`` . [1]: https://github.com/odoo/odoo/blob/272602193f5647f7f2270ed6ec68777625a139dd/addons/crm/models/crm_lead.py#L310-L311 X-original-commit: 890a91f56c7fc2b2f254589a7dc0c0413dd3818e Part-of: odoo/odoo#76159 Co-authored-by: Thibault Delavallee <tde@odoo.com>

view details

Florent de Labarre

commit sha fe13606ccfb841428577f1086e6d66ebfb73041c

[FIX] mail: prevent useless write when pinning a channel When having an active livechat, we could end up with a lot of query errors like ``` 2021-08-30 [...] "POST /web/dataset/call_kw/mail.channel/channel_get HTTP/1.0" 200 - 104 0.151 0.075 2021-08-30 [...] ERROR production odoo.sql_db: bad query: UPDATE "mail_channel_partner" SET "write_uid"=2,"write_date"=(now() at time zone 'UTC') WHERE id IN (365007) ERROR: ERROR: Could not serialize access due to concurrent update ``` Avoiding unnecessary writes helps reducing concurrent updates. Task-2641572 PR odoo#76159 Closes odoo#75745 Part-of: odoo/odoo#76159

view details

Raf Ven

commit sha 417ead3465c3eb356bb529227db64ba9a75f63fa

[IMP] base: merge activities of merged partners When merging partners through the ``base.partner.merge.automatic.wizard`` wizard, messages and followers are merged. However activities are not probably because its underlying model is "newer" then messages and followers. This commits fixes that behavior. Task-2641572 PR odoo#76159 Closes #71654 Part-of: odoo/odoo#76159 Co-authored-by: Thibault Delavallee <tde@odoo.com>

view details

Odoo's Mergebot

commit sha bd82b057be4a94e75af87cc294af3225a19a23fc

[MERGE] mail: provide fixes for gateway, composer and partner merge Merge fixes coming notably from community reporting. Containing [FIX] mail: handle wrong Final-Recipient header in incoming emails [FIX] mail: handle parsing of void body in incoming emails [FIX] mail: fix ACLs issue with mail composer in new mode [FW][IMP] test_mail: test models with type do not mess with attachmen… [FIX] mail: prevent useless write when pinning a channel [IMP] base: merge activities of merged partners See sub commits for more details Task-2641572 closes odoo/odoo#76159 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>

view details

Florent de Labarre

commit sha b09408c023b0a4eb38aaa3349de4c9c01c0d299c

[FIX] point_of_sale: pos is launched with all companies - Activate multicompany - In the company switcher select all company - Launch a pos session --> Issue all rpc request are make in all companies (len(self.env.companies) != 1). It create some error with taxes, fiscale position, ... closes odoo/odoo#76393 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>

view details

Goffin Simon

commit sha 181d69056ae00f9eeff4cd6c8ae7bbcdc7b14599

[FIX] snailmail: Updating country in snailmail.letter.missing.required.fields Steps to reproduce the bug: - Open a customer invoice I for a customer C - Remove the country from the address of C - Click on button Print & send on I - Set the country of C with CTR - Click on Update and send Bug: The country of C was not saved. opw:2633425 closes odoo/odoo#76023 Signed-off-by: Simon Goffin (sig) <sig@openerp.com>

view details

Siddarth Gajjar

commit sha 550d7145e7759f97f3f4d101c27f3b55d03efd4f

[FIX] website: prevent error on edit mode save for restricted editor - Before this commit, When user with restricted rights tries to edit frontend page and without changing anything click on save button generate traceback due to invalid return type. - After this commit, On hitting save button on restrict mode resolve the traceback by changing function return type to promise. task-2379101 closes odoo/odoo#66357 Signed-off-by: Romain Derie (rde) <rde@odoo.com>

view details

Moises Lopez - https://www.vauxoo.com/

commit sha dd56aeb2a74743c97e1a89b76ec7c825e600f372

[FIX] test_lint: Fix some false results * [FIX] test_lint: Consider variables for sql-injection Using the following code: ```python var = 'SELECT name FROM account WHERE id IN {}' values = (1, 2, 3) self._cr.execute(var.format(values)) ``` It has a risky sql injection ignored before of this change And allow psycopg2.SQL way mapping the variables declaration * [FIX] sql-injection: AttributeError: 'NoneType' object has no attribute 'parent' Using the following code: queries = [ "SELECT id FROM res_partner", "SELECT id FROM res_users", ] for query in queries: self.env.cr.execute(query) The check sql-injection shows the following error: - AttributeError: 'NoneType' object has no attribute 'parent' So, Now it is validating if it is not None * [REF] sql-injection: Using better naming for node_ofc -> node_assign * [FIX] sql-injection: Fix false positive using BinOp "+" Considering the following valid case: cr.execute('SELECT ' + operator + ' FROM table' + 'WHERE') The representation tree is: node.repr_tree() BinOp( op='+', left=BinOp( op='+', left=BinOp( op='+', left=Const(value='SELECT '), right=Name(name='operator')), right=Const(value=' FROM table')), right=Const(value='WHERE')) Notice that left node is another BinOp node So, it need to be considered recursively ...

view details

push time in 11 days

push eventvauxoo-dev/pylint-odoo

Moisés López

commit sha 41306a0fcdb286f9efb4c50a41b42c74b910f688

[REF] sql-injection: No sql-injection using constants The following examples should not be considered as sql-injection: self.env.cr.execute("SELECT * FROM %s" % 'table_constant') self.env.cr.execute("SELECT * FROM {}".format('table_constant')) self.env.cr.execute("SELECT * FROM %(table_variable)s" % {'table_variable': 'table_constant'}) Since that the constant is not possible to inject

view details

push time in 11 days