From 0ab438b76eaf2cdf171c732bfe654eea6250292c Mon Sep 17 00:00:00 2001 From: cysnake4713 Date: Mon, 10 Aug 2015 13:48:16 +0200 Subject: [PATCH 01/14] [CLA] Matt Cai (cysnake4713) --- doc/cla/individual/cysnake4713.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 doc/cla/individual/cysnake4713.md diff --git a/doc/cla/individual/cysnake4713.md b/doc/cla/individual/cysnake4713.md new file mode 100644 index 00000000000..911c1b318e9 --- /dev/null +++ b/doc/cla/individual/cysnake4713.md @@ -0,0 +1,11 @@ +China, 2015-07-09 + +I hereby agree to the terms of the Odoo Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Matt Cai 蔡旸 cysnake4713@gmail.com https://github.com/cysnake4713 From 3cc7f9fc869bb2e6addae7c2690732c0bfd66c46 Mon Sep 17 00:00:00 2001 From: cysnake4713 Date: Mon, 10 Aug 2015 13:43:45 +0200 Subject: [PATCH 02/14] [FIX] l10n_cn: multiple fixes in charts of account MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Change account type 'Other Receivable(其他应收款)' close_method to unreconciled * Add new account type 'Other Payable(其他应付款)' to account template '2241 Other Accounts Payable'(其他应付款) . * Change Account template '1221 Other Account Receivable(其他应收款)''s type to receivable. * Rename Account template '1001 Cash (现金)' to '1001 Cash (库存现金)' to fit new accounting standard. * Fix double account template id 'small_business_chart1602' problem. * Several misused account template * add view account to small business account template Closes #7535 --- .../account_chart_small_business_template.xml | 219 ++++++++++-------- addons/l10n_cn/account_chart_template.xml | 12 +- addons/l10n_cn/account_chart_type.xml | 79 ++++++- 3 files changed, 210 insertions(+), 100 deletions(-) diff --git a/addons/l10n_cn/account_chart_small_business_template.xml b/addons/l10n_cn/account_chart_small_business_template.xml index 810191cccd5..6034baf9c71 100644 --- a/addons/l10n_cn/account_chart_small_business_template.xml +++ b/addons/l10n_cn/account_chart_small_business_template.xml @@ -4,7 +4,7 @@ - + - 会计科目 + 2011会计科目 0 view + + 资产类 + 1 + + view + + 1001 - + liquidity - 现金 + 库存现金 1002 - + view 银行存款 @@ -42,7 +49,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1012 - + other 其他货币资金 @@ -51,7 +58,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1101 - + other 短期投资 @@ -60,7 +67,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1121 - + other 应收票据 @@ -68,7 +75,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1122 - + receivable 应收账款 @@ -76,15 +83,15 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1123 - + payable 预付账款 - + 1131 - + other 应收股利 @@ -92,7 +99,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1132 - + other 应收利息 @@ -100,8 +107,8 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1221 - - other + + receivable 其他应收款 @@ -109,7 +116,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1401 - + other 材料采购 @@ -117,7 +124,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1402 - + other 在途物资 @@ -125,7 +132,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1403 - + other 原材料 @@ -133,7 +140,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1404 - + other 材料成本差异 @@ -141,7 +148,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1405 - + other 库存商品 @@ -150,7 +157,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1407 - + other 商品进销差价 @@ -158,7 +165,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1408 - + other 委托加工物资 @@ -167,7 +174,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1411 - + other 周转材料 @@ -176,7 +183,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1421 - + other 消耗性生物资产 @@ -185,7 +192,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1501 - + other 长期债券投资 @@ -194,7 +201,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1511 - + other 长期股权投资 @@ -203,7 +210,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1601 - + other 固定资产 @@ -211,7 +218,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1602 - + other 累计折旧 @@ -220,7 +227,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1604 - + other 在建工程 @@ -228,7 +235,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1605 - + other 工程物资 @@ -237,34 +244,34 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1606 - + other 固定资产清理 - + 1621 - + other 生产性生物资产 - + - + 1622 - + other 生产性生物资产累计折旧 - + 1701 - + other 无形资产 @@ -273,7 +280,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1702 - + other 累计摊销 @@ -282,7 +289,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1801 - + other 长期待摊费用 @@ -292,18 +299,25 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 1901 - + other 待处理财产损溢 - + - - + + + + 负债类 + 2 + + view + + 2001 - + other 短期借款 @@ -312,7 +326,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 2201 - + other 应付票据 @@ -320,7 +334,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 2202 - + payable 应付账款 @@ -328,7 +342,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 2203 - + receivable 预收账款 @@ -336,7 +350,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 2211 - + other 应付职工薪酬 @@ -344,7 +358,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 2221 - + other 应交税费 @@ -353,41 +367,41 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 2231 - + other 应付利息 - + 2232 - + other 应付利润 - + 2241 - + payable 其他应付款 - + 2401 - + other 递延收益 - + 2501 - + other 长期借款 @@ -396,7 +410,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 2701 - + other 长期应付款 @@ -404,10 +418,17 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html + + 所有者权益类 + 3 + + view + + 3001 - + other 实收资本 @@ -415,7 +436,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 3002 - + other 资本公积 @@ -423,7 +444,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 3101 - + other 盈余公积 @@ -431,71 +452,85 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 3103 - + other 本年利润 - + 3104 - + other 利润分配 + + 成本类 + 4 + + view + + 4001 - + other 生产成本 - + 4101 - + other 制造费用 - + 4301 - + other 研发支出 - + 4401 - + other 工程施工 - + 4403 - + other 机械作业 - + - + + + 损益类 + 5 + + view + + 5001 - + other 主营业务收入 @@ -503,16 +538,16 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 5051 - + other 其他业务收入 - + 5111 - + other 投资收益 @@ -520,7 +555,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 5301 - + other 营业外收入 @@ -529,7 +564,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 5401 - + other 主营业务成本 @@ -537,7 +572,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 5402 - + other 其他业务成本 @@ -546,7 +581,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 5403 - + other 营业税金及附加 @@ -554,7 +589,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 5601 - + other 销售费用 @@ -562,7 +597,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 5602 - + other 管理费用 @@ -570,7 +605,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 5603 - + other 财务费用 @@ -579,7 +614,7 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 5711 - + other 营业外支出 @@ -587,9 +622,9 @@ http://kjs.mof.gov.cn/zhengwuxinxi/zhengcefabu/201111/t20111107_605525.html 5801 - + other - 所得税 + 所得税费用 diff --git a/addons/l10n_cn/account_chart_template.xml b/addons/l10n_cn/account_chart_template.xml index a09ea67f0d0..ccb8ab62552 100644 --- a/addons/l10n_cn/account_chart_template.xml +++ b/addons/l10n_cn/account_chart_template.xml @@ -24,7 +24,7 @@ liquidity - 现金 + 库存现金 @@ -95,7 +95,7 @@ 1231 - other + receivable 其他应收款 @@ -571,6 +571,14 @@ 应付利息 + + 2241 + + + payable + 其他应付款 + + 2401 diff --git a/addons/l10n_cn/account_chart_type.xml b/addons/l10n_cn/account_chart_type.xml index 16f3f8ae0ac..d55a9fd5c4e 100644 --- a/addons/l10n_cn/account_chart_type.xml +++ b/addons/l10n_cn/account_chart_type.xml @@ -17,7 +17,7 @@ - 一、主营业务收入 + 一、营业收入 pl1 none income @@ -29,7 +29,7 @@ income - 减:主营业务成本 + 减:营业成本 pl3 none expense @@ -47,7 +47,7 @@ income - 减:营业费用 + 销售费用 pl11 none expense @@ -125,10 +125,16 @@ unreconciled asset + + 预付账款 + bs8 + unreconciled + asset + 其他应收款 bs7 - balance + unreconciled asset @@ -197,6 +203,12 @@ balance asset + + 生产性生物资产 + bs47 + balance + asset + 无形资产 bs51 @@ -209,6 +221,12 @@ balance asset + + 待处理财产损溢-无结转 + bs53 + none + asset + 递延税款借项 bs61 @@ -233,6 +251,12 @@ unreconciled liability + + 其他应付款 + bs73 + unreconciled + liability + 预收账款 bs71 @@ -240,11 +264,23 @@ liability - 应付工资 + 应付职工薪酬 bs72 balance liability + + 应付利息 + bs174 + balance + liability + + + 应付利润 + bs175 + balance + liability + 应付股利 bs74 @@ -281,6 +317,13 @@ balance liability + + 递延收益 + bs104 + balance + liability + + 实收资本 bs115 @@ -299,11 +342,35 @@ balance liability + + 本年利润 + bs120 + none + liability + 未分配利润 bs121 balance liability - + + + 成本类-余额结转 + cost + balance + none + + + 成本-无结转 + cost_no + none + none + + + 开发支出 + cost-dev + none + none + From 74b7b97209d1dbe32f374355a05bfa3e0714d07b Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Fri, 7 Aug 2015 16:01:36 +0200 Subject: [PATCH 03/14] [FIX] stock: let resupply from warehouse work If you set WH B to be resupplied from WH A, then the scheduler will generate a procurement with warehouse_id = B and location_id = B.stock. Running the procurement will find the resupply rule, and this will create another procurement with warehouse_id = A and location_id = transit location. However, without this patch, the resupply route is not part of the route_ids of warehouse A, and so the 2nd procurement goes in exception because if cannot find a rule (the search will force a rule linked to a route which is part of A.route_ids). Closes #7956 --- addons/stock/stock.py | 4 +-- addons/stock/tests/__init__.py | 1 + addons/stock/tests/test_resupply.py | 51 +++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 addons/stock/tests/test_resupply.py diff --git a/addons/stock/stock.py b/addons/stock/stock.py index bb0a9a7a061..6e23e5f629a 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -3039,7 +3039,7 @@ class stock_warehouse(osv.osv): 'crossdock_route_id': fields.many2one('stock.location.route', 'Crossdock Route'), 'reception_route_id': fields.many2one('stock.location.route', 'Receipt Route'), 'delivery_route_id': fields.many2one('stock.location.route', 'Delivery Route'), - 'resupply_from_wh': fields.boolean('Resupply From Other Warehouses'), + 'resupply_from_wh': fields.boolean('Resupply From Other Warehouses', help='Unused field'), 'resupply_wh_ids': fields.many2many('stock.warehouse', 'stock_wh_resupply_table', 'supplied_wh_id', 'supplier_wh_id', 'Resupply Warehouses'), 'resupply_route_ids': fields.one2many('stock.location.route', 'supplied_wh_id', 'Resupply Routes', help="Routes will be created for these resupply warehouses and you can select them on products and product categories"), @@ -3099,7 +3099,7 @@ class stock_warehouse(osv.osv): pull_obj.create(cr, uid, vals=pull_rule, context=context) #if the warehouse is also set as default resupply method, assign this route automatically to the warehouse if default_resupply_wh and default_resupply_wh.id == wh.id: - self.write(cr, uid, [warehouse.id], {'route_ids': [(4, inter_wh_route_id)]}, context=context) + self.write(cr, uid, [warehouse.id, wh.id], {'route_ids': [(4, inter_wh_route_id)]}, context=context) _defaults = { 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', context=c), diff --git a/addons/stock/tests/__init__.py b/addons/stock/tests/__init__.py index 4c20f7a769a..c372f3c8fb5 100644 --- a/addons/stock/tests/__init__.py +++ b/addons/stock/tests/__init__.py @@ -2,3 +2,4 @@ from . import test_stock_flow from . import test_owner_available +from . import test_resupply diff --git a/addons/stock/tests/test_resupply.py b/addons/stock/tests/test_resupply.py new file mode 100644 index 00000000000..79ecbf456b7 --- /dev/null +++ b/addons/stock/tests/test_resupply.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- + +from openerp.addons.stock.tests.common import TestStockCommon +from openerp.tools import mute_logger, float_round + + +class TestResupply(TestStockCommon): + def setUp(self): + super(TestResupply, self).setUp() + self.Warehouse = self.env['stock.warehouse'] + # create 2 WH, BIG and SMALL + # SMALL resupplies from BIG + self.bigwh = self.Warehouse.create({'name': 'BIG', 'code': 'B'}) + self.smallwh = self.Warehouse.create({'name': 'SMALL', 'code': 'S', + 'default_resupply_wh_id': self.bigwh.id, + 'resupply_wh_ids': [(6, 0, [self.bigwh.id])], + }) + # minimum stock rule for Product A on SMALL + Orderpoint = self.env['stock.warehouse.orderpoint'] + Orderpoint.create({'warehouse_id': self.smallwh.id, + 'location_id': self.smallwh.lot_stock_id.id, + 'product_id': self.productA.id, + 'product_min_qty': 100, + 'product_max_qty': 200, + 'product_uom': self.uom_unit.id, + }) + # create some stock on BIG + Wiz = self.env['stock.change.product.qty'] + wiz = Wiz.create({'product_id': self.productA.id, + 'new_quantity': 1000, + 'location_id': self.bigwh.lot_stock_id.id, + }) + wiz.change_product_qty() + + def test_resupply_from_wh(self): + sched = self.env['procurement.order'] + sched.run_scheduler() + # we generated 2 procurements for product A: one on small wh and the + # other one on the transit location + procs = sched.search([('product_id', '=', self.productA.id)]) + self.assertEqual(len(procs), 2) + proc1 = sched.search([('product_id', '=', self.productA.id), + ('warehouse_id', '=', self.smallwh.id)]) + self.assertEqual(proc1.state, 'running') + proc2 = sched.search([('product_id', '=', self.productA.id), + ('warehouse_id', '=', self.bigwh.id)]) + self.assertEqual(proc2.location_id.usage, 'transit') + self.assertNotEqual(proc2.state, 'exception') + proc2.run() + self.assertEqual(proc2.state, 'running') + self.assertTrue(proc2.rule_id) From 8f96a13855ddf271ae705da42e1ce1dec9db0b47 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 12 Aug 2015 11:19:42 +0200 Subject: [PATCH 04/14] [FIX] mrp_repair: typo correction "Fals" instead of "False" --- addons/mrp_repair/wizard/make_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp_repair/wizard/make_invoice.py b/addons/mrp_repair/wizard/make_invoice.py index a6e93aca064..5859e6b69a3 100644 --- a/addons/mrp_repair/wizard/make_invoice.py +++ b/addons/mrp_repair/wizard/make_invoice.py @@ -57,7 +57,7 @@ class make_invoice(osv.osv_memory): form_res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form') form_id = form_res and form_res[1] or False tree_res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_tree') - tree_id = tree_res and tree_res[1] or Fals + tree_id = tree_res and tree_res[1] or False return { 'domain': [('id','in', newinv.values())], From 528c15cc7bce92dbfb757133cf88a5997a30ac92 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 11 Aug 2015 15:04:48 +0200 Subject: [PATCH 05/14] [FIX] account_analytic_plans: creating an analytic distribution When creating an analytic distribution, the field "plan_id" must be required. opw:646788 --- addons/account_analytic_plans/account_analytic_plans_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_analytic_plans/account_analytic_plans_view.xml b/addons/account_analytic_plans/account_analytic_plans_view.xml index 42b17ae06c3..500d6a1a404 100644 --- a/addons/account_analytic_plans/account_analytic_plans_view.xml +++ b/addons/account_analytic_plans/account_analytic_plans_view.xml @@ -74,7 +74,7 @@ - + From 31ffd010b1297bd200f039dd0418c104a75e3553 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 12 Aug 2015 16:39:46 +0200 Subject: [PATCH 06/14] [FIX] website_sale: flag partners as customers When placing an order in the ecommerce, it's seems obvious that the partner is a customer. Nevertheless, It wasn't flagged as such in its partner from, preventing to see him in the customers list Fixes #2422 Closes #2881 --- addons/website_sale/controllers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index a68a867656f..230b52d6d29 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -526,7 +526,7 @@ class website_sale(http.Controller): partner_lang = request.lang if request.lang in [lang.code for lang in request.website.language_ids] else None - billing_info = {} + billing_info = {'customer': True} if partner_lang: billing_info['lang'] = partner_lang billing_info.update(self.checkout_parse('billing', checkout, True)) From 0e446eb5a6903756569111b8dcd994ebc505a969 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 10 Aug 2015 11:50:21 +0200 Subject: [PATCH 07/14] [FIX] sale_stock: 'uom' in context Force the 'uom in the context to False on the field 'product_id' in the popup form view "sale.order.form.sale.stock", to force the non-propagation of the context. To avoid using the uos in function "_product_lst_price" when computing the public price of a product. opw:646880 --- addons/sale_stock/sale_stock_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_stock/sale_stock_view.xml b/addons/sale_stock/sale_stock_view.xml index 802d3a090a5..338034f3331 100644 --- a/addons/sale_stock/sale_stock_view.xml +++ b/addons/sale_stock/sale_stock_view.xml @@ -31,7 +31,7 @@ From 85b2e607bf55be9fe557ed62110404db143774d5 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 12 Aug 2015 17:34:51 +0200 Subject: [PATCH 08/14] [FIX] crm: prevent use a sales tag from another team. On the `categ_ids` fields definition on `crm.lead`, a domain has been added in order to prevent the use of a sales tag belonging to another sales team. As the domain was overidden in the form views, with a different domain, it was allowed to use a sales tag from another sales team. Besides, the domain applied in the form views, `[('object_id.model','=','crm.lead')]` is included in the domain applied in the fiel definition. Closes #2898 --- addons/crm/crm_lead_view.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 651735b432a..a477a8a4ae6 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -164,7 +164,6 @@ @@ -436,9 +435,7 @@ - + context="{'object_name': 'crm.lead'}"/> From 9fed748647d808dc67fd97e1edc4bd9eebc7fda8 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 13 Aug 2015 09:03:30 +0200 Subject: [PATCH 09/14] [FIX] website_sale: error in message Error introduced by 4f91dc371c0e736dad5515d24af9b44417ba2c38 --- addons/website_sale/controllers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 230b52d6d29..1f1170c2ca9 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -767,7 +767,7 @@ class website_sale(http.Controller): if tx.acquirer_id.post_msg: message += tx.acquirer_id.post_msg elif state == 'error': - message = '

%s

' % _('An error occured during the transaction.') + message = '

%s

' % _('An error occurred during the transaction.') validation = tx.acquirer_id.validation return { From 4c610a31b9d348b802eec6e567a62854c6263597 Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 1 Oct 2014 08:39:36 +0800 Subject: [PATCH 10/14] [FIX] survey: allow change of previous answers for all questions types Permission error on survey update The user who answer the survey may not have delete permission for the user_input_line In a survey, for a survey user (!= manager), When browsing previous pages of anwsers, the user wasn't allowed to change his answers regarding simple choice, multiple choices and matrix questions, as this kind of answers changes leaded to an unlink operation, not allowed for survey users. Closes #2901 --- addons/survey/survey.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/survey/survey.py b/addons/survey/survey.py index 21f2902e8be..aae53c6a750 100644 --- a/addons/survey/survey.py +++ b/addons/survey/survey.py @@ -21,6 +21,7 @@ from openerp.osv import fields, osv from openerp.tools.translate import _ +from openerp import SUPERUSER_ID from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT as DF from openerp.addons.website.models.website import slug from urlparse import urljoin @@ -1145,7 +1146,7 @@ class survey_user_input_line(osv.Model): ('question_id', '=', question.id)], context=context) if old_uil: - self.unlink(cr, uid, old_uil, context=context) + self.unlink(cr, SUPERUSER_ID, old_uil, context=context) if answer_tag in post and post[answer_tag].strip() != '': vals.update({'answer_type': 'suggestion', 'value_suggested': post[answer_tag]}) @@ -1176,7 +1177,7 @@ class survey_user_input_line(osv.Model): ('question_id', '=', question.id)], context=context) if old_uil: - self.unlink(cr, uid, old_uil, context=context) + self.unlink(cr, SUPERUSER_ID, old_uil, context=context) ca = dict_keys_startswith(post, answer_tag) comment_answer = ca.pop(("%s_%s" % (answer_tag, 'comment')), '').strip() @@ -1207,7 +1208,7 @@ class survey_user_input_line(osv.Model): ('question_id', '=', question.id)], context=context) if old_uil: - self.unlink(cr, uid, old_uil, context=context) + self.unlink(cr, SUPERUSER_ID, old_uil, context=context) no_answers = True ca = dict_keys_startswith(post, answer_tag) From 937b9575c034cacebc645544f7e2410a2cf0a797 Mon Sep 17 00:00:00 2001 From: Thomas Rehn Date: Mon, 6 Oct 2014 10:51:55 +0200 Subject: [PATCH 11/14] [FIX] account: check for profit/loss accounts in method `button_confirm_cash` of `account.cash.statement` The check was verifying that the profit/loss account was set on the journal, and if it was, it raised that it wasn't, which is obviously wrong. This was solved in Odoo 8.0 by replacing the code by something more readable in 9dc9169, and the same logic to check that the profit/loss accounts are set is still there. Closes #2924 --- addons/account/account_cash_statement.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index bd053b22352..11efed54d08 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -296,7 +296,7 @@ class account_cash_statement(osv.osv): continue for item_label, item_account in TABLES: - if getattr(obj.journal_id, item_account): + if not getattr(obj.journal_id, item_account): raise osv.except_osv(_('Error!'), _('There is no %s Account on the journal %s.') % (item_label, obj.journal_id.name,)) From ed6d9afecc7f48ba126034d627076f90c1e0f512 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 13 Aug 2015 12:09:13 +0200 Subject: [PATCH 12/14] [FIX] purchase: env['product.pricelist'].price_get expect a partner ID --- addons/purchase/stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index bfd1d69c01d..950f5b591c0 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -171,7 +171,7 @@ class stock_move(osv.osv): pricelist_obj = self.pool.get("product.pricelist") pricelist = partner.property_product_pricelist_purchase.id price = pricelist_obj.price_get(cr, uid, [pricelist], - move.product_id.id, move.product_uom_qty, partner, { + move.product_id.id, move.product_uom_qty, partner.id, { 'uom': move.product_uom.id, 'date': move.date, })[pricelist] From 8827789ff29dec5d4cdb027696c389b0549f8059 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 13 Aug 2015 12:46:22 +0200 Subject: [PATCH 13/14] [FIX] stock_account: remove traceback introduced by f2108e9 invoice_vals['name'] may not be defined yet. --- addons/stock_account/stock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock_account/stock.py b/addons/stock_account/stock.py index e24f00afab2..addc7a97fc5 100644 --- a/addons/stock_account/stock.py +++ b/addons/stock_account/stock.py @@ -240,7 +240,7 @@ class stock_picking(osv.osv): @return: object of the partner to invoice """ return picking.partner_id and picking.partner_id.id - + def action_invoice_create(self, cr, uid, ids, journal_id, group=False, type='out_invoice', context=None): """ Creates invoice based on the invoice state selected for picking. @param journal_id: Id of journal @@ -315,7 +315,7 @@ class stock_picking(osv.osv): if not invoice.origin or invoice_vals['origin'] not in invoice.origin.split(', '): invoice_origin = filter(None, [invoice.origin, invoice_vals['origin']]) merge_vals['origin'] = ', '.join(invoice_origin) - if not invoice.name or invoice_vals['name'] not in invoice.name.split(', '): + if invoice_vals.get('name', False) and (not invoice.name or invoice_vals['name'] not in invoice.name.split(', ')): invoice_name = filter(None, [invoice.name, invoice_vals['name']]) merge_vals['name'] = ', '.join(invoice_name) if merge_vals: From cdb900044960f03df81cead4921c6e7cc05d8ba3 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Mon, 10 Aug 2015 09:20:45 +0200 Subject: [PATCH 14/14] [FIX] website, base: escaping and unescaping html When saving a template in version 8.0, html would be saved as it should be displayed once on the site. In particular, if some text should be escaped once send to the browser, it will be saved as such. But when rendering, a text node content is unescaped two times: * for translation which seems wrong since we already use .text of a node which already escaped it, doing it one more time is bad, * when rendering the template, since the html template is stored in xml, This commit remove superfluous unescaping for translation, and add an escaping when saving the changed template content. closes #7967 opw-646889 --- addons/website/models/ir_ui_view.py | 9 +++++++++ addons/website/tests/test_views.py | 10 ++++++++++ openerp/addons/base/ir/ir_ui_view.py | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/addons/website/models/ir_ui_view.py b/addons/website/models/ir_ui_view.py index 9a3a84a9adb..2895379dcf4 100644 --- a/addons/website/models/ir_ui_view.py +++ b/addons/website/models/ir_ui_view.py @@ -7,6 +7,7 @@ from openerp import SUPERUSER_ID, api from openerp.addons.website.models import website from openerp.http import request from openerp.osv import osv, fields +from openerp.tools import html_escape class view(osv.osv): _inherit = "ir.ui.view" @@ -119,6 +120,14 @@ class view(osv.osv): # ensure there's only one match [root] = arch.xpath(section_xpath) + # html text need to be escaped for xml storage + def escape_node(node): + node.text = node.text and html_escape(node.text) + node.tail = node.tail and html_escape(node.tail) + escape_node(replacement) + for descendant in replacement.iterdescendants(): + escape_node(descendant) + root.text = replacement.text root.tail = replacement.tail # replace all children diff --git a/addons/website/tests/test_views.py b/addons/website/tests/test_views.py index 1adb11712ec..c8e7efb9044 100644 --- a/addons/website/tests/test_views.py +++ b/addons/website/tests/test_views.py @@ -174,6 +174,16 @@ class TestViewSaving(common.TransactionCase): ) ) + def test_save_escaped_text(self): + view_id = self.registry('ir.ui.view').create(self.cr, self.uid, { + 'arch':'hello world', + 'type':'qweb' + }) + view = self.registry('ir.ui.view').browse(self.cr, self.uid, view_id) + replacement = 'hello world & <angle brackets>!' + view.save(replacement, xpath='/t') + self.assertEqual(view.render(), replacement, 'html special characters wrongly escaped') + def test_save_only_embedded(self): Company = self.registry('res.company') company_id = 1 diff --git a/openerp/addons/base/ir/ir_ui_view.py b/openerp/addons/base/ir/ir_ui_view.py index 7136c44ee71..2be02332660 100644 --- a/openerp/addons/base/ir/ir_ui_view.py +++ b/openerp/addons/base/ir/ir_ui_view.py @@ -945,7 +945,7 @@ class view(osv.osv): def get_trans(text): if not text or not text.strip(): return None - text = h.unescape(text.strip()) + text = text.strip() if len(text) < 2 or (text.startswith('')): return None return translate_func(text)