From 229696111b24f4414017b613ce0f370fedf1b018 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 9 Dec 2013 10:11:42 +0100 Subject: [PATCH 01/47] [FIX] website_sale: access for product.pricelist.item bzr revid: chm@openerp.com-20131209091142-1pyz1tz64d0gh39r --- addons/website_sale/security/ir.model.access.csv | 1 + addons/website_sale/security/website_sale.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/addons/website_sale/security/ir.model.access.csv b/addons/website_sale/security/ir.model.access.csv index 39ec59589e6..4723d66b5c5 100644 --- a/addons/website_sale/security/ir.model.access.csv +++ b/addons/website_sale/security/ir.model.access.csv @@ -5,6 +5,7 @@ access_product_category_,product.category.public,product.model_product_category, access_product_category_public,product.category.public,product.model_product_public_category,base.group_public,1,0,0,0 access_product_pricelist_version_public,product.pricelist.version.public,product.model_product_pricelist_version,base.group_public,1,0,0,0 access_product_pricelist_public,product.pricelist.public,product.model_product_pricelist,base.group_public,1,0,0,0 +access_product_pricelist_item_public,product.pricelist.item.public,product.model_product_pricelist_item,base.group_public,1,0,0,0 access_product_product_price_type_public,product.price.type.public,product.model_product_price_type,base.group_public,1,0,0,0 access_sale_order_public,sale.order.public,model_sale_order,base.group_public,1,0,0,0 access_sale_order_line_public,sale.order.line.public,model_sale_order_line,base.group_public,1,0,0,0 diff --git a/addons/website_sale/security/website_sale.xml b/addons/website_sale/security/website_sale.xml index 485e78c339b..0f4fc32a1e4 100644 --- a/addons/website_sale/security/website_sale.xml +++ b/addons/website_sale/security/website_sale.xml @@ -43,5 +43,6 @@ + \ No newline at end of file From 26220814b213b3085d9634106da718832d5ece21 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 9 Dec 2013 11:17:38 +0100 Subject: [PATCH 02/47] [FIX] delivery: tests raise for wrong depends (sale, stock). Tests use picking_ids but sale_stock does not already install. Change sale and stock depends to sale_stock (who depends of sale and stock) bzr revid: chm@openerp.com-20131209101738-ng9q329w9gchvtib --- addons/delivery/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/delivery/__openerp__.py b/addons/delivery/__openerp__.py index 5c4aac8513d..1ee6bf413ec 100644 --- a/addons/delivery/__openerp__.py +++ b/addons/delivery/__openerp__.py @@ -32,7 +32,7 @@ You can define your own carrier and delivery grids for prices. When creating invoices from picking, OpenERP is able to add and compute the shipping line. """, 'author': 'OpenERP SA', - 'depends': ['sale', 'stock'], + 'depends': ['sale_stock'], 'data': [ 'security/ir.model.access.csv', 'delivery_report.xml', From 3aeff809690ecb6d0093bddc0d9d10232282d657 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 9 Dec 2013 12:15:50 +0100 Subject: [PATCH 03/47] [IMP] stock: add comment for a yml test bzr revid: chm@openerp.com-20131209111550-7eacnor8r3eskh8t --- addons/stock/test/shipment.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/stock/test/shipment.yml b/addons/stock/test/shipment.yml index 5f2f4686621..0a4f8cd9842 100644 --- a/addons/stock/test/shipment.yml +++ b/addons/stock/test/shipment.yml @@ -66,6 +66,8 @@ - !python {model: stock.partial.picking}: | context.update({'active_model': 'stock.picking', 'active_id': ref('incomming_shipment'), 'active_ids': [ref('incomming_shipment')]}) +- + I make a partial picking and moves done. - !python {model: stock.partial.picking}: | partial = [] From 5f0fcfb9be0695a2e0fba5e4ea85c449b7f5af8b Mon Sep 17 00:00:00 2001 From: ddm Date: Mon, 9 Dec 2013 12:25:34 +0100 Subject: [PATCH 04/47] [IMP] Tour improvements => automated tests bzr revid: ddm@openerp.com-20131209112534-3ysihjgm20jj3d9k --- .../static/src/js/website.snippets.editor.js | 3 ++ .../static/src/js/website.tour.banner.js | 7 ++-- addons/website/static/src/js/website.tour.js | 42 ++++++++++++++----- .../static/src/js/website.tour.blog.js | 6 +-- .../static/src/js/website.tour.event.js | 6 +-- .../static/src/js/website.tour.shop.js | 2 +- 6 files changed, 45 insertions(+), 21 deletions(-) diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js index ef4c029280e..e605bba3d1b 100644 --- a/addons/website/static/src/js/website.snippets.editor.js +++ b/addons/website/static/src/js/website.snippets.editor.js @@ -246,6 +246,9 @@ this.snippet_focus($snippet); } $("#oe_snippets").trigger('snippet-activated', $snippet); + if ($snippet) { + $snippet.trigger('snippet-activated', $snippet); + } }, create_overlay: function ($snippet) { if (typeof $snippet.data("snippet-editor") === 'undefined') { diff --git a/addons/website/static/src/js/website.tour.banner.js b/addons/website/static/src/js/website.tour.banner.js index 70c5dd9dc38..9bea6b223da 100644 --- a/addons/website/static/src/js/website.tour.banner.js +++ b/addons/website/static/src/js/website.tour.banner.js @@ -46,7 +46,7 @@ }, { stepId: 'drag-banner', - element: '#website-top-navbar [data-snippet-id=carousel].ui-draggable', + snippet: 'carousel', placement: 'bottom', title: "Drag & Drop a Banner", content: "Drag the Banner block and drop it in your page.", @@ -84,7 +84,7 @@ }, { stepId: 'drag-three-columns', - element: '#website-top-navbar [data-snippet-id=three-columns].ui-draggable', + snippet: 'three-columns', placement: 'bottom', title: "Drag & Drop a Block", content: "Drag the '3 Columns' block and drop it below the banner.", @@ -97,7 +97,8 @@ title: "Edit an Area", content: "Select any area of the page to modify it. Click on this subtitle.", trigger: { - id: 'snippet-activated' + emitter: '#wrap [data-snippet-id=three-columns]:first .text-center[data-snippet-id=colmd]', + id: 'snippet-activated', }, }, { diff --git a/addons/website/static/src/js/website.tour.js b/addons/website/static/src/js/website.tour.js index 90f2f8a3d21..3ea5626009f 100644 --- a/addons/website/static/src/js/website.tour.js +++ b/addons/website/static/src/js/website.tour.js @@ -27,6 +27,9 @@ if (!step.element) { step.orphan = true; } + if (step.snippet) { + step.element = '#oe_snippets div.oe_snippet[data-snippet-id="'+step.snippet+'"] .oe_snippet_thumbnail'; + } if (step.trigger) { if (step.trigger === 'click') { step.triggers = function (callback) { @@ -48,8 +51,9 @@ }; } else { step.triggers = function (callback) { - var emitter = step.trigger.emitter || $(step.element); - emitter.one(step.trigger.id, function customHandler () { + var emitter = _.isString(step.trigger.emitter) ? $(step.trigger.emitter) : (step.trigger.emitter || $(step.element)); + emitter.on(step.trigger.id, function customHandler () { + console.log(arguments); (callback || self.moveToNextStep).apply(self, arguments); }); }; @@ -164,7 +168,7 @@ $('.popover.tour').remove(); function advance () { if (_.isFunction(callback)) { - callback.call(self); + callback.apply(self); } } $(document.body).one('mouseup', advance); @@ -215,7 +219,17 @@ }); var TestConsole = website.TestConsole = { - tests: [] + dragAndDropSnippet: function (snippetId) { + var selector = '#oe_snippets div.oe_snippet[data-snippet-id="'+snippetId+'"] .oe_snippet_thumbnail'; + var $thumbnail = $(selector).first(); + var thumbnailPosition = $thumbnail.position(); + $thumbnail.trigger($.Event( "mousedown", { which: 1, pageX: thumbnailPosition.left, pageY: thumbnailPosition.top })); + $thumbnail.trigger($.Event( "mousemove", { which: 1, pageX: thumbnailPosition.left+100, pageY: thumbnailPosition.top+700 })); + var $dropZone = $(".oe_drop_zone").first(); + var dropPosition = $dropZone.position(); + $dropZone.trigger($.Event( "mouseup", { which: 1, pageX: dropPosition.left, pageY: dropPosition.top })); + }, + tests: [], }; website.EditorBar.include({ @@ -247,16 +261,22 @@ id: tour.id, run: function runTest () { var actionSteps = _.filter(tour.steps, function (step) { - return step.triggers; + return step.trigger; }); var currentIndex = 0; function executeStep (step) { - var $element = $(step.element); - step.triggers(function () { - currentIndex = currentIndex + 1; - executeStep(actionSteps[currentIndex]); - }); - $element.click(); + var $element = $(step.element); + step.triggers(function () { + currentIndex = currentIndex + 1; + executeStep(actionSteps[currentIndex]); + }); + if (step.snippet && step.trigger === 'drag') { + setTimeout(function () { + TestConsole.dragAndDropSnippet(step.snippet); + }, 50); + } else { + $element.click(); + } } executeStep(actionSteps[currentIndex]); }, diff --git a/addons/website_blog/static/src/js/website.tour.blog.js b/addons/website_blog/static/src/js/website.tour.blog.js index 989c4227a09..d541ca0bd3b 100644 --- a/addons/website_blog/static/src/js/website.tour.blog.js +++ b/addons/website_blog/static/src/js/website.tour.blog.js @@ -51,7 +51,7 @@ title: "Which Blog?", content: "Blog posts are organized in multiple categories (news, job offers, events, etc). Select News and click Continue.", trigger: { - emitter: $('.modal select'), + emitter: '.modal select', id: 'change', predicate: function ($el, value) { return $el.find('[value='+value+']').text().toLowerCase() === 'news'; @@ -89,7 +89,7 @@ }, { stepId: 'drag-image-text', - element: '#website-top-navbar [data-snippet-id=image-text].ui-draggable', + snippet: 'image-text', placement: 'bottom', title: "Drag & Drop a Block", content: "Drag the 'Image-Text' block and drop it in your page.", @@ -105,7 +105,7 @@ }, { stepId: 'drag-text-block', - element: '#website-top-navbar [data-snippet-id=text-block].ui-draggable', + snippet: 'text-block', placement: 'bottom', title: "Drag & Drop a block", content: "Drag the 'Text Block' block and drop it below the image block.", diff --git a/addons/website_event/static/src/js/website.tour.event.js b/addons/website_event/static/src/js/website.tour.event.js index b9a0c7045d2..10582874103 100644 --- a/addons/website_event/static/src/js/website.tour.event.js +++ b/addons/website_event/static/src/js/website.tour.event.js @@ -75,7 +75,7 @@ }, { stepId: 'drag-banner', - element: '#website-top-navbar [data-snippet-id=carousel].ui-draggable', + snippet: 'carousel', placement: 'bottom', title: "Drag & Drop a block", content: "Drag the 'Banner' block and drop it in your page.", @@ -91,7 +91,7 @@ }, { stepId: 'drag-text-block', - element: '#website-top-navbar [data-snippet-id=text-block].ui-draggable', + snipet: 'text-block', placement: 'bottom', title: "Drag & Drop a block", content: "Drag the 'Text Block' block below the banner.", @@ -107,7 +107,7 @@ }, { stepId: 'drag-three-columns', - element: '#website-top-navbar [data-snippet-id=three-columns].ui-draggable', + snippet: 'three-columns', placement: 'bottom', title: "Drag & Drop a block", content: "Drag the 'Three Columns' block at the bottom.", diff --git a/addons/website_sale/static/src/js/website.tour.shop.js b/addons/website_sale/static/src/js/website.tour.shop.js index c323e5185e4..5a4d0c04939 100644 --- a/addons/website_sale/static/src/js/website.tour.shop.js +++ b/addons/website_sale/static/src/js/website.tour.shop.js @@ -113,7 +113,7 @@ }, { stepId: 'drag-big-picture', - element: '#website-top-navbar [data-snippet-id=big-picture].ui-draggable', + snippet: 'big-picture', placement: 'bottom', title: "Drag & Drop a block", content: "Drag the 'Big Picture' block and drop it in your page.", From 66e85ee1e0a49a9907cb3bd55e9483bf029985cd Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 9 Dec 2013 15:22:03 +0100 Subject: [PATCH 05/47] [IMP] Product visible discount: discount is expressed based in Public Price bzr revid: fp@tinyerp.com-20131209142203-20l555dfdyvb60xe --- addons/product/pricelist.py | 3 --- addons/product_visible_discount/product_visible_discount.py | 6 ------ 2 files changed, 9 deletions(-) diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py index 2f53d67760c..838c3008318 100644 --- a/addons/product/pricelist.py +++ b/addons/product/pricelist.py @@ -278,8 +278,6 @@ class product_pricelist(osv.osv): break if price: - # FP Note: what's this? - # results['item_id'] = res.id if 'uom' in context and not uom_price_already_computed: product = products_dict[product.id] uom = product.uos_id or product.uom_id @@ -292,7 +290,6 @@ class product_pricelist(osv.osv): product = self.pool.get('product.product').browse(cr, uid, prod_id, context=context) res_multi = self.price_get_multi(cr, uid, pricelist_ids=ids, products_by_qty_by_partner=[(product, qty, partner)], context=context) res = res_multi[prod_id] - res.update({'item_id': {ids[-1]: res_multi.get('item_id', ids[-1])}}) return res diff --git a/addons/product_visible_discount/product_visible_discount.py b/addons/product_visible_discount/product_visible_discount.py index bd43028b36a..605a71e8b80 100644 --- a/addons/product_visible_discount/product_visible_discount.py +++ b/addons/product_visible_discount/product_visible_discount.py @@ -48,12 +48,6 @@ class sale_order_line(osv.osv): product_obj = self.pool.get('product.product') field_name = 'list_price' - if res_dict.get('item_id',False) and res_dict['item_id'].get(pricelist,False): - item = res_dict['item_id'].get(pricelist,False) - item_base = item_obj.read(cr, uid, [item], ['base'])[0]['base'] - if item_base > 0: - field_name = price_type_obj.browse(cr, uid, item_base).field - product = product_obj.browse(cr, uid, product_id, context) product_read = product_obj.read(cr, uid, product_id, [field_name], context=context) From 6aface1bd00e99869452de214c57206c76b91b90 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 9 Dec 2013 16:11:35 +0100 Subject: [PATCH 06/47] [FIX] product.supplierinfo: product_id is a product.product fields. Rename fields into product_tmpl_id for many2one to product.template model bzr revid: chm@openerp.com-20131209151135-q54g17zcq1vnshsl --- addons/product/product.py | 8 +- addons/product/product_demo.xml | 92 +++++++++---------- addons/website_sale/controllers/main.py | 4 +- .../website_sale/models/product_attributes.py | 8 +- 4 files changed, 56 insertions(+), 56 deletions(-) diff --git a/addons/product/product.py b/addons/product/product.py index 2a1b20860fc..7ca28e2f623 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -944,7 +944,7 @@ class product_supplierinfo(osv.osv): 'product_uom': fields.related('product_id', 'uom_po_id', type='many2one', relation='product.uom', string="Supplier Unit of Measure", readonly="1", help="This comes from the product form."), 'min_qty': fields.float('Minimal Quantity', required=True, help="The minimal quantity to purchase to this supplier, expressed in the supplier Product Unit of Measure if not empty, in the default unit of measure of the product otherwise."), 'qty': fields.function(_calc_qty, store=True, type='float', string='Quantity', multi="qty", help="This is a quantity which is converted into Default Unit of Measure."), - 'product_id' : fields.many2one('product.template', 'Product', required=True, ondelete='cascade', select=True), + 'product_id' : fields.many2one('product.product', 'Product', required=True, ondelete='cascade', select=True), 'delay' : fields.integer('Delivery Lead Time', required=True, help="Lead time in days between the confirmation of the purchase order and the reception of the products in your warehouse. Used by the scheduler for automatic computation of the purchase order planning."), 'pricelist_ids': fields.one2many('pricelist.partnerinfo', 'suppinfo_id', 'Supplier Pricelist'), 'company_id':fields.many2one('res.company','Company',select=1), @@ -970,10 +970,10 @@ class product_supplierinfo(osv.osv): pricelist_pool = self.pool.get('product.pricelist') currency_pool = self.pool.get('res.currency') currency_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id + # Compute price from standard price of product + product_price = product_pool.price_get(cr, uid, [product_id], 'standard_price', context=context)[product_id] for supplier in partner_pool.browse(cr, uid, supplier_ids, context=context): - # Compute price from standard price of product - price = product_pool.price_get(cr, uid, [product_id], 'standard_price', context=context)[product_id] - + price = product_price # Compute price from Purchase pricelist of supplier pricelist_id = supplier.property_product_pricelist_purchase.id if pricelist_id: diff --git a/addons/product/product_demo.xml b/addons/product/product_demo.xml index 39be1635d1a..52cbd6abaf7 100644 --- a/addons/product/product_demo.xml +++ b/addons/product/product_demo.xml @@ -995,322 +995,322 @@ QWERTY keyboard --> - + 3 1 - + 3 1 - + 3 1 - + 3 1 - + 2 5 - + 4 1 - + 2 1 - + 2 1 - + 5 1 - + 5 1 - + 5 1 - + 1 1 - + 1 1 - + 3 1 - + 3 1 - + 4 5 - + 3 1 - + 2 1 - + 3 1 - + 3 1 - + 3 1 - + 8 1 - + 8 1 - + 4 1 - + 5 1 - + 2 12 - + 2 12 - + 2 5 - + 2 12 - + 2 5 - + 2 1 - + 2 1 - + 4 1 - + 4 1 - + 5 1 - + 5 1 - + 7 1 - + 4 1 - + 4 0 - + 5 0 - + 2 0 - + 4 0 - + 10 0 - + 3 0 - + 5 0 diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 6bfa59bf143..0ea18f3ac2a 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -173,8 +173,8 @@ class Ecommerce(http.Controller): else: domain.append(("value_id", "in", key_val[1:])) att_ids = obj.search(request.cr, request.uid, domain, context=request.context) - att = obj.read(request.cr, request.uid, att_ids, ["product_id"], context=request.context) - return [r["product_id"][0] for r in att] + att = obj.read(request.cr, request.uid, att_ids, ["product_tmpl_id"], context=request.context) + return [r["product_tmpl_id"][0] for r in att] @website.route(['/shop/pricelist'], type='http', auth="public", multilang=True) def shop_promo(self, code, **post): diff --git a/addons/website_sale/models/product_attributes.py b/addons/website_sale/models/product_attributes.py index a1d861fbd5a..6efa13905fb 100644 --- a/addons/website_sale/models/product_attributes.py +++ b/addons/website_sale/models/product_attributes.py @@ -40,7 +40,7 @@ class attributes(osv.Model): 'name': fields.char('Name', size=64, translate=True, required=True), 'type': fields.selection([('distinct', 'Textual Value'), ('float', 'Numeric Value')], "Type", required=True), 'value_ids': fields.one2many('product.attribute.value', 'attribute_id', 'Values'), - 'product_ids': fields.one2many('product.attribute.product', 'attribute_id', 'Products'), + 'attr_product_ids': fields.one2many('product.attribute.product', 'attribute_id', 'Products'), 'float_max': fields.function(_get_float_max, type='float', string="Max", store={ 'product.attribute.product': (_get_min_max, ['value','attribute_id'], 20), @@ -60,7 +60,7 @@ class attributes_value(osv.Model): _columns = { 'name': fields.char('Value', size=64, translate=True, required=True), 'attribute_id': fields.many2one('product.attribute', 'Attribute', required=True), - 'product_ids': fields.one2many('product.attribute.product', 'value_id', 'Products'), + 'atr_product_ids': fields.one2many('product.attribute.product', 'value_id', 'Products'), } class attributes_product(osv.Model): @@ -70,7 +70,7 @@ class attributes_product(osv.Model): 'value': fields.float('Numeric Value'), 'value_id': fields.many2one('product.attribute.value', 'Textual Value'), 'attribute_id': fields.many2one('product.attribute', 'Attribute', required=True), - 'product_id': fields.many2one('product.template', 'Product', required=True), + 'product_tmpl_id': fields.many2one('product.template', 'Product', required=True), 'type': fields.related('attribute_id', 'type', type='selection', selection=[('distinct', 'Distinct'), ('float', 'Float')], string='Type'), @@ -83,5 +83,5 @@ class attributes_product(osv.Model): class product_template(osv.Model): _inherit = "product.template" _columns = { - 'website_attribute_ids': fields.one2many('product.attribute.product', 'product_id', 'Product Attributes'), + 'website_attribute_ids': fields.one2many('product.attribute.product', 'product_tmpl_id', 'Product Attributes'), } From 4715ab370597d1b247f1a2f8baebc13ffe8eeee2 Mon Sep 17 00:00:00 2001 From: ddm Date: Mon, 9 Dec 2013 16:28:01 +0100 Subject: [PATCH 07/47] [FIX] HTML editor bug bzr revid: ddm@openerp.com-20131209152801-2q9grtwc7xfiengv --- addons/website/static/src/js/website.ace.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website/static/src/js/website.ace.js b/addons/website/static/src/js/website.ace.js index 1156ac5165e..7108fd9ded7 100644 --- a/addons/website/static/src/js/website.ace.js +++ b/addons/website/static/src/js/website.ace.js @@ -160,7 +160,7 @@ }); _.each(index, function (view) { var parentId = view.inherit_id; - if (parentId) { + if (parentId && index[parentId]) { index[parentId].children.push(view); } else { roots.push(view); From b894f72fdafd9884d5d1b742d677d036cb79f1f5 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 9 Dec 2013 16:29:23 +0100 Subject: [PATCH 08/47] [FIX] payment_acquirer_adyen: controller methods=POST bzr revid: chm@openerp.com-20131209152923-7qru626cydyrwuaw --- addons/payment_acquirer_adyen/controllers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/payment_acquirer_adyen/controllers/main.py b/addons/payment_acquirer_adyen/controllers/main.py index 2ea9fb00c51..706b26e163d 100644 --- a/addons/payment_acquirer_adyen/controllers/main.py +++ b/addons/payment_acquirer_adyen/controllers/main.py @@ -19,7 +19,7 @@ class AdyenController(http.Controller): @website.route([ '/payment/adyen/return/', - ], type='http', auth='public') + ], type='http', auth='public', methods=['POST']) def adyen_return(self, **post): """ Paypal IPN. """ _logger.info('Beginning Adyen form_feedback with post data %s', pprint.pformat(post)) # debug From 66528564456553812311180d3213ada62809475f Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 9 Dec 2013 17:32:54 +0100 Subject: [PATCH 09/47] [FIX] website_sale: link; product: clean code and use product.template for supplierinfo bzr revid: chm@openerp.com-20131209163254-k9dwxw48rcgz1hbs --- addons/mrp/report/price.py | 1 - addons/product/pricelist.py | 2 - addons/product/product.py | 10 +- addons/product/product_demo.xml | 92 +++++++++---------- addons/purchase/purchase.py | 1 - .../purchase_requisition.py | 1 - addons/website_sale/models/product.py | 9 +- 7 files changed, 52 insertions(+), 64 deletions(-) diff --git a/addons/mrp/report/price.py b/addons/mrp/report/price.py index 5afd6b3ee49..d5a3c32646c 100644 --- a/addons/mrp/report/price.py +++ b/addons/mrp/report/price.py @@ -34,7 +34,6 @@ class report_custom(report_rml): registry = openerp.registry(cr.dbname) product_pool = registry.get('product.product') product_uom_pool = registry.get('product.uom') - supplier_info_pool = registry.get('product.supplierinfo') workcenter_pool = registry.get('mrp.workcenter') user_pool = registry.get('res.users') bom_pool = registry.get('mrp.bom') diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py index 838c3008318..279f921f6c9 100644 --- a/addons/product/pricelist.py +++ b/addons/product/pricelist.py @@ -172,9 +172,7 @@ class product_pricelist(osv.osv): products = map(lambda x: x[0], products_by_qty_by_partner) currency_obj = self.pool.get('res.currency') product_obj = self.pool.get('product.product') - product_category_obj = self.pool.get('product.category') product_uom_obj = self.pool.get('product.uom') - supplierinfo_obj = self.pool.get('product.supplierinfo') price_type_obj = self.pool.get('product.price.type') version = False diff --git a/addons/product/product.py b/addons/product/product.py index 7ca28e2f623..2b1380bd58e 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -410,7 +410,7 @@ class product_template(osv.osv): help='Coefficient to convert default Unit of Measure to Unit of Sale\n' ' uos = uom * coeff'), 'mes_type': fields.selection((('fixed', 'Fixed'), ('variable', 'Variable')), 'Measure Type'), - 'seller_ids': fields.one2many('product.supplierinfo', 'product_id', 'Supplier'), + 'seller_ids': fields.one2many('product.supplierinfo', 'product_tmpl_id', 'Supplier'), 'company_id': fields.many2one('res.company', 'Company', select=1), # image: all image fields are base64 encoded and PIL-supported 'image': fields.binary("Image", @@ -928,7 +928,6 @@ class product_supplierinfo(osv.osv): _description = "Information about a product supplier" def _calc_qty(self, cr, uid, ids, fields, arg, context=None): result = {} - product_uom_pool = self.pool.get('product.uom') for supplier_info in self.browse(cr, uid, ids, context=context): for field in fields: result[supplier_info.id] = {field:False} @@ -941,10 +940,10 @@ class product_supplierinfo(osv.osv): 'product_name': fields.char('Supplier Product Name', size=128, help="This supplier's product name will be used when printing a request for quotation. Keep empty to use the internal one."), 'product_code': fields.char('Supplier Product Code', size=64, help="This supplier's product code will be used when printing a request for quotation. Keep empty to use the internal one."), 'sequence' : fields.integer('Sequence', help="Assigns the priority to the list of product supplier."), - 'product_uom': fields.related('product_id', 'uom_po_id', type='many2one', relation='product.uom', string="Supplier Unit of Measure", readonly="1", help="This comes from the product form."), + 'product_uom': fields.related('product_tmpl_id', 'uom_po_id', type='many2one', relation='product.uom', string="Supplier Unit of Measure", readonly="1", help="This comes from the product form."), 'min_qty': fields.float('Minimal Quantity', required=True, help="The minimal quantity to purchase to this supplier, expressed in the supplier Product Unit of Measure if not empty, in the default unit of measure of the product otherwise."), 'qty': fields.function(_calc_qty, store=True, type='float', string='Quantity', multi="qty", help="This is a quantity which is converted into Default Unit of Measure."), - 'product_id' : fields.many2one('product.product', 'Product', required=True, ondelete='cascade', select=True), + 'product_tmpl_id' : fields.many2one('product.template', 'Product Template', required=True, ondelete='cascade', select=True), 'delay' : fields.integer('Delivery Lead Time', required=True, help="Lead time in days between the confirmation of the purchase order and the reception of the products in your warehouse. Used by the scheduler for automatic computation of the purchase order planning."), 'pricelist_ids': fields.one2many('pricelist.partnerinfo', 'suppinfo_id', 'Supplier Pricelist'), 'company_id':fields.many2one('res.company','Company',select=1), @@ -972,6 +971,7 @@ class product_supplierinfo(osv.osv): currency_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id # Compute price from standard price of product product_price = product_pool.price_get(cr, uid, [product_id], 'standard_price', context=context)[product_id] + product = product_pool.browse(cr, uid, product_id, context=context) for supplier in partner_pool.browse(cr, uid, supplier_ids, context=context): price = product_price # Compute price from Purchase pricelist of supplier @@ -981,7 +981,7 @@ class product_supplierinfo(osv.osv): price = currency_pool.compute(cr, uid, pricelist_pool.browse(cr, uid, pricelist_id).currency_id.id, currency_id, price) # Compute price from supplier pricelist which are in Supplier Information - supplier_info_ids = self.search(cr, uid, [('name','=',supplier.id),('product_id','=',product_id)]) + supplier_info_ids = self.search(cr, uid, [('name','=',supplier.id),('product_tmpl_id','=',product.product_tmpl_id.id)]) if supplier_info_ids: cr.execute('SELECT * ' \ 'FROM pricelist_partnerinfo ' \ diff --git a/addons/product/product_demo.xml b/addons/product/product_demo.xml index 52cbd6abaf7..a309a1f8b88 100644 --- a/addons/product/product_demo.xml +++ b/addons/product/product_demo.xml @@ -995,322 +995,322 @@ QWERTY keyboard --> - + 3 1 - + 3 1 - + 3 1 - + 3 1 - + 2 5 - + 4 1 - + 2 1 - + 2 1 - + 5 1 - + 5 1 - + 5 1 - + 1 1 - + 1 1 - + 3 1 - + 3 1 - + 4 5 - + 3 1 - + 2 1 - + 3 1 - + 3 1 - + 3 1 - + 8 1 - + 8 1 - + 4 1 - + 5 1 - + 2 12 - + 2 12 - + 2 5 - + 2 12 - + 2 5 - + 2 1 - + 2 1 - + 4 1 - + 4 1 - + 5 1 - + 5 1 - + 7 1 - + 4 1 - + 4 0 - + 5 0 - + 2 0 - + 4 0 - + 10 0 - + 3 0 - + 5 0 diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 75f6856709b..88ac7c635c7 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -958,7 +958,6 @@ class purchase_order_line(osv.osv): product_product = self.pool.get('product.product') product_uom = self.pool.get('product.uom') res_partner = self.pool.get('res.partner') - product_supplierinfo = self.pool.get('product.supplierinfo') product_pricelist = self.pool.get('product.pricelist') account_fiscal_position = self.pool.get('account.fiscal.position') account_tax = self.pool.get('account.tax') diff --git a/addons/purchase_requisition/purchase_requisition.py b/addons/purchase_requisition/purchase_requisition.py index 3f31837e38e..5ce57dab811 100644 --- a/addons/purchase_requisition/purchase_requisition.py +++ b/addons/purchase_requisition/purchase_requisition.py @@ -96,7 +96,6 @@ class purchase_requisition(osv.osv): def _seller_details(self, cr, uid, requisition_line, supplier, context=None): product_uom = self.pool.get('product.uom') pricelist = self.pool.get('product.pricelist') - supplier_info = self.pool.get("product.supplierinfo") product = requisition_line.product_id default_uom_po_id = product.uom_po_id.id qty = product_uom._compute_qty(cr, uid, requisition_line.product_uom_id.id, requisition_line.product_qty, default_uom_po_id) diff --git a/addons/website_sale/models/product.py b/addons/website_sale/models/product.py index f04be77d7a2..7070f923e2b 100644 --- a/addons/website_sale/models/product.py +++ b/addons/website_sale/models/product.py @@ -35,17 +35,10 @@ class product_template(osv.Model): _name = 'product.template' def _website_url(self, cr, uid, ids, field_name, arg, context=None): - """ TDE-NOTE: as someone wrote this method without any clue on about what it - does, fixing bugs about product_variant_ids not existing will be done - based on the weather, the sun and Lilo's feelings about pigs. - - If you see this comment in trunk, this means that the website branch has - been merged without any review, which is quite questionable. """ res = dict.fromkeys(ids, '') base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url') for product in self.browse(cr, uid, ids, context=context): - if product.product_variant_ids: - res[product.id] = "%s/shop/product/%s/" % (base_url, product.product_variant_ids[0].id) + res[product.id] = "%s/shop/product/%s/" % (base_url, product.id) return res _columns = { From 59906a3af82aeb216c7c29e9b492e7b69183ec5b Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 9 Dec 2013 22:05:11 +0100 Subject: [PATCH 10/47] [IMP] allow users to change product price from CMS[FIX] small bug in reordering of PTT bzr revid: fp@tinyerp.com-20131209210511-5w03vf2wt0pmgdew --- addons/product/product.py | 4 ++-- addons/website/models/website.py | 4 ++-- addons/website_sale/views/website_sale.xml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/product/product.py b/addons/product/product.py index 2b1380bd58e..e73486c2e13 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -657,8 +657,8 @@ class product_product(osv.osv): 'virtual_available': fields.function(_product_virtual_available, type='float', string='Quantity Available'), 'incoming_qty': fields.function(_product_incoming_qty, type='float', string='Incoming'), 'outgoing_qty': fields.function(_product_outgoing_qty, type='float', string='Outgoing'), - 'price': fields.function(_product_price, type='float', string='Price', digits_compute=dp.get_precision('Product Price')), - 'lst_price' : fields.function(_product_lst_price, fnct_inv=_save_product_lst_price, type='float', string='Public Price', digits_compute=dp.get_precision('Product Price')), + 'price': fields.function(_product_price, fnct_inv=_save_product_lst_price, type='float', string='Price', digits_compute=dp.get_precision('Product Price')), + 'lst_price' : fields.function(_product_lst_price, fnct_inv=_save_product_lst_price, type='float', string='Public Price', digits_compute=dp.get_precision('Product Price')), 'code': fields.function(_product_code, type='char', string='Internal Reference'), 'partner_ref' : fields.function(_product_partner_ref, type='char', string='Customer ref'), 'default_code' : fields.char('Internal Reference', size=64, select=True), diff --git a/addons/website/models/website.py b/addons/website/models/website.py index b1df178e8ed..611b582d9ce 100644 --- a/addons/website/models/website.py +++ b/addons/website/models/website.py @@ -535,8 +535,8 @@ class website_menu(osv.osv): 'new_window': False, } _parent_store = True - _parent_order = 'sequence, name' - _order = "parent_left" + _parent_order = 'sequence' + _order = "sequence" # would be better to take a menu_id as argument def get_tree(self, cr, uid, website_id, context=None): diff --git a/addons/website_sale/views/website_sale.xml b/addons/website_sale/views/website_sale.xml index 24328b6dbb9..0335ac04e81 100644 --- a/addons/website_sale/views/website_sale.xml +++ b/addons/website_sale/views/website_sale.xml @@ -279,7 +279,7 @@ -
+
From bdc2caab613bfc08a30c3a9ab478d53dec87b094 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 10 Dec 2013 11:32:53 +0100 Subject: [PATCH 11/47] [FIX] website: publish function not clear bzr revid: chm@openerp.com-20131210103253-j1n7cqufivh7ng09 --- addons/website/static/src/css/website.css | 6 +++--- addons/website/static/src/css/website.sass | 10 ++++++---- addons/website/static/src/js/website.js | 5 ++--- addons/website/views/website_templates.xml | 12 ++++++++---- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/addons/website/static/src/css/website.css b/addons/website/static/src/css/website.css index 5d0f452863f..9a6541882ba 100644 --- a/addons/website/static/src/css/website.css +++ b/addons/website/static/src/css/website.css @@ -283,12 +283,12 @@ ul.nav-stacked > li > a { } /* ---- PUBLISH ---- */ -.css_unpublish, .css_publish { +.css_published .btn-danger, .css_published .css_publish { display: none; } -.css_published .css_unpublish, .css_unpublished .css_publish { - display: block; +.css_unpublished .btn-success, .css_unpublished .css_unpublish { + display: none; } [data-publish='off'] { diff --git a/addons/website/static/src/css/website.sass b/addons/website/static/src/css/website.sass index a08aee8cfd1..d498cdbb402 100644 --- a/addons/website/static/src/css/website.sass +++ b/addons/website/static/src/css/website.sass @@ -202,10 +202,12 @@ ul.nav-stacked > li > a text-transform: uppercase /* ---- PUBLISH ---- */ -.css_unpublish, .css_publish - display: none -.css_published .css_unpublish, .css_unpublished .css_publish - display: block +.css_published + .btn-danger, .css_publish + display: none +.css_unpublished + .btn-success, .css_unpublish + display: none [data-publish='off'] +opacity(0.5) diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js index 79d5f6b9d57..64767d95171 100644 --- a/addons/website/static/src/js/website.js +++ b/addons/website/static/src/js/website.js @@ -266,12 +266,11 @@ /* ----- PUBLISHING STUFF ---- */ $(document).on('click', '.js_publish_management .js_publish_btn', function () { - var $data = $(this).parent(".js_publish_management"); - var self=this; + var $data = $(this).parents(".js_publish_management:first"); + var self=this; openerp.jsonRpc($data.data('controller') || '/website/publish', 'call', {'id': +$data.data('id'), 'object': $data.data('object')}) .then(function (result) { $data.toggleClass("css_unpublished css_published"); - $(self).toggleClass("btn-success btn-danger"); $data.parents("[data-publish]").attr("data-publish", +result ? 'on' : 'off'); }).fail(function (err, data) { website.error(data, '/web#return_label=Website&model='+$data.data('object')+'&id='+$data.data('id')); diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml index 2ba72fc581e..8734777dc4f 100644 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@ -277,14 +277,18 @@ -