From d767e71aebddc7745fecde50d4c1e8fd9d9e4e07 Mon Sep 17 00:00:00 2001 From: uco Date: Fri, 9 Jul 2010 14:50:34 +0530 Subject: [PATCH 01/17] [FIX] mrp, stock: Report errors. bzr revid: uco@tinyerp.com-20100709092034-lc5tgqzr4ahlgu98 --- addons/mrp/report/order.rml | 4 ++-- addons/stock/report/packing.rml | 6 +++--- addons/stock/report/picking.rml | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/mrp/report/order.rml b/addons/mrp/report/order.rml index 200ca5bb76e..3db5396d444 100644 --- a/addons/mrp/report/order.rml +++ b/addons/mrp/report/order.rml @@ -265,10 +265,10 @@ [[ formatLang(o.date_planned, date_time = True) ]] - [[ o.sale_ref or removeParentNode('para')]] + [[ 'sale_ref' in o._columns.keys() and o.sale_ref or removeParentNode('para') ]] - [[ o.sale_name or removeParentNode('para') ]] + [[ 'sale_name' in o._columns.keys() and o.sale_name or removeParentNode('para') ]] diff --git a/addons/stock/report/packing.rml b/addons/stock/report/packing.rml index 3edb83921a0..07c8758b8c0 100644 --- a/addons/stock/report/packing.rml +++ b/addons/stock/report/packing.rml @@ -276,9 +276,9 @@ - [[ (line.state == 'done' or line.state == 'confirmed') and removeParentNode('para') ]] - Non Assigned Products: [[ ( line.state == 'assigned' or line.state == 'done' or line.state == 'confirmed' ) and removeParentNode('para') ]] - [[ (line.state == 'done' or line.state == 'confirmed') and removeParentNode('para') ]] + [[ (move_lines.state == 'done' or move_lines.state == 'confirmed') and removeParentNode('para') ]] + Non Assigned Products: [[ ( move_lines.state == 'assigned' or move_lines.state == 'done' or move_lines.state == 'confirmed' ) and removeParentNode('para') ]] + [[ (move_lines.state == 'done' or move_lines.state == 'confirmed') and removeParentNode('para') ]]
[[ repeatIn([line for line in picking.move_lines if (line.state != 'assigned' )],'move_lines') ]] diff --git a/addons/stock/report/picking.rml b/addons/stock/report/picking.rml index 68bae72ba84..677cdfbcfc0 100644 --- a/addons/stock/report/picking.rml +++ b/addons/stock/report/picking.rml @@ -268,9 +268,9 @@
- [[ (line.state == 'done' or line.state == 'confirmed') and removeParentNode('para') ]] - Non Assigned Products: [[ ( line.state == 'assigned' or line.state == 'done' or line.state == 'confirmed' ) and removeParentNode('para') ]] - [[ (line.state == 'done' or line.state == 'confirmed') and removeParentNode('para') ]] + [[ (move_lines.state == 'done' or move_lines.state == 'confirmed') and removeParentNode('para') ]] + Non Assigned Products: [[ ( move_lines.state == 'assigned' or move_lines.state == 'done' or move_lines.state == 'confirmed' ) and removeParentNode('para') ]] + [[ (move_lines.state == 'done' or move_lines.state == 'confirmed') and removeParentNode('para') ]]
[[ repeatIn([line for line in picking.move_lines if (line.state != 'assigned' )],'move_lines') ]] From 2185d20b4c7dafe40ad5c0a484207e58eeacbd42 Mon Sep 17 00:00:00 2001 From: uco Date: Fri, 9 Jul 2010 18:56:13 +0530 Subject: [PATCH 02/17] [FIX] stock_location: Yaml error. bzr revid: uco@tinyerp.com-20100709132613-qboh8mf4vaevx16y --- addons/stock_location/__openerp__.py | 2 +- addons/stock_location/test/stock_location.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock_location/__openerp__.py b/addons/stock_location/__openerp__.py index 96e5bfe41ba..e80b00fc7ad 100644 --- a/addons/stock_location/__openerp__.py +++ b/addons/stock_location/__openerp__.py @@ -43,7 +43,7 @@ This module may be useful for different purposes: 'demo_xml': [], 'installable': True, 'test':[ -# 'test/stock_location.yml' + 'test/stock_location.yml' ], 'active': False, 'certificate': '0046505115101', diff --git a/addons/stock_location/test/stock_location.yml b/addons/stock_location/test/stock_location.yml index 40c34b8b0ec..e3040b6e75b 100644 --- a/addons/stock_location/test/stock_location.yml +++ b/addons/stock_location/test/stock_location.yml @@ -159,7 +159,7 @@ country_id: base.in partner_id: res_partner_microlinktechnologies0 street: Ash House, Ash Road - title: Ms. + title: base.res_partner_title_miss - From e16c15f45cbeaa17df4f8c3431b60f599be1bc37 Mon Sep 17 00:00:00 2001 From: uco Date: Sat, 10 Jul 2010 14:50:07 +0530 Subject: [PATCH 03/17] [IMP] mrp: Improve 'Change Standard Price' wizard to change price of Parent product according to user's choice. bzr revid: uco@tinyerp.com-20100710092007-yp8j0mjzxbf6hqj5 --- addons/mrp/__openerp__.py | 1 + addons/mrp/product.py | 7 +-- addons/mrp/wizard/__init__.py | 1 + .../mrp/wizard/mrp_change_standard_price.py | 48 +++++++++++++++++++ .../wizard/mrp_change_standard_price_view.xml | 17 +++++++ 5 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 addons/mrp/wizard/mrp_change_standard_price.py create mode 100644 addons/mrp/wizard/mrp_change_standard_price_view.xml diff --git a/addons/mrp/__openerp__.py b/addons/mrp/__openerp__.py index 3065516b125..5fc5456ee9a 100644 --- a/addons/mrp/__openerp__.py +++ b/addons/mrp/__openerp__.py @@ -69,6 +69,7 @@ 'wizard/change_production_qty_view.xml', 'wizard/mrp_price_view.xml', 'wizard/mrp_workcenter_load_view.xml', + 'wizard/mrp_change_standard_price_view.xml', # 'wizard/mrp_track_prod_view.xml', 'mrp_view.xml', 'mrp_wizard.xml', diff --git a/addons/mrp/product.py b/addons/mrp/product.py index 8954d234510..1af0bd686ce 100644 --- a/addons/mrp/product.py +++ b/addons/mrp/product.py @@ -63,11 +63,12 @@ class product_product(osv.osv): """ res = super(product_product, self).do_change_standard_price(cr, uid, ids, datas, context=context) bom_obj = self.pool.get('mrp.bom') + change = context.get('change_parent_price', False) def _compute_price(bom): price = 0.0 - if bom.bom_id : - if bom.bom_id.bom_lines : - for bom_line in bom.bom_id.bom_lines : + if bom.bom_id and change: + if bom.bom_id.bom_lines: + for bom_line in bom.bom_id.bom_lines: prod_price = self.read(cr, uid, bom_line.product_id.id, ['standard_price'])['standard_price'] price += bom_line.product_qty * prod_price diff --git a/addons/mrp/wizard/__init__.py b/addons/mrp/wizard/__init__.py index aa4408e543e..be148883d10 100644 --- a/addons/mrp/wizard/__init__.py +++ b/addons/mrp/wizard/__init__.py @@ -24,6 +24,7 @@ import mrp_price import mrp_workcenter_load #import mrp_track_prod import change_production_qty +import mrp_change_standard_price # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mrp/wizard/mrp_change_standard_price.py b/addons/mrp/wizard/mrp_change_standard_price.py new file mode 100644 index 00000000000..0a5a054762b --- /dev/null +++ b/addons/mrp/wizard/mrp_change_standard_price.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from osv import fields, osv + +class change_standard_price(osv.osv_memory): + _inherit = "stock.change.standard.price" + _description = "Change Standard Price" + + _columns = { + 'change_parent_price': fields.boolean('Change Parent Price'), + } + + + def change_price(self, cr, uid, ids, context): + """ Changes the Standard Price of Parent Product according to BoM + only when the field 'change_parent_price' is True. + And creates an account move accordingly. + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param ids: List of IDs selected + @param context: A standard dictionary + @return: + """ + res = self.browse(cr, uid, ids) + context.update({'change_parent_price': res[0].change_parent_price}) + return super(change_standard_price, self).change_price(cr, uid, ids, context=context) + +change_standard_price() diff --git a/addons/mrp/wizard/mrp_change_standard_price_view.xml b/addons/mrp/wizard/mrp_change_standard_price_view.xml new file mode 100644 index 00000000000..6c9b2059aca --- /dev/null +++ b/addons/mrp/wizard/mrp_change_standard_price_view.xml @@ -0,0 +1,17 @@ + + + + + Change Standard Price (Inherit) + stock.change.standard.price + + form + + + + + + + + + From 0450d6d5897184699afd7c294898b7ebf1a2a8cb Mon Sep 17 00:00:00 2001 From: uco Date: Sat, 10 Jul 2010 18:10:44 +0530 Subject: [PATCH 04/17] [IMP] mrp_operations: View improvements. bzr revid: uco@tinyerp.com-20100710124044-1xmfhm5ixzd07ehx --- addons/mrp_operations/mrp_operations_view.xml | 49 ++++++++++++++----- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/addons/mrp_operations/mrp_operations_view.xml b/addons/mrp_operations/mrp_operations_view.xml index fb4d728f4da..5c626b24814 100644 --- a/addons/mrp_operations/mrp_operations_view.xml +++ b/addons/mrp_operations/mrp_operations_view.xml @@ -4,6 +4,41 @@ + + + mrp.production.form.inherit + mrp.production + form + + + + + +