From 3f6d20200662753d065a64276225bd8b208f71db Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Wed, 24 Nov 2010 13:52:28 +0530 Subject: [PATCH 01/11] [FIX]purchase:Invoice journal(s) not loaded properly lp bug: https://launchpad.net/bugs/677429 fixed bzr revid: ron@tinyerp.com-20101124082228-t6xrcs91bmp5sju7 --- addons/account/account_invoice_view.xml | 2 +- addons/purchase/purchase_view.xml | 12 ++--- .../purchase/wizard/purchase_line_invoice.py | 49 ++++++++++--------- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index c6542758952..d63dce78f17 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -149,7 +149,7 @@
- + diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index ce8923ed5cd..0d27f970246 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -160,7 +160,7 @@ - + @@ -310,12 +310,12 @@ - + - - - + + + @@ -373,7 +373,7 @@ - + diff --git a/addons/purchase/wizard/purchase_line_invoice.py b/addons/purchase/wizard/purchase_line_invoice.py index f57ae82e51f..f93dcdf131b 100644 --- a/addons/purchase/wizard/purchase_line_invoice.py +++ b/addons/purchase/wizard/purchase_line_invoice.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,7 +15,7 @@ # 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 . +# along with this program. If not, see . # ############################################################################## @@ -26,26 +26,26 @@ from tools.translate import _ class purchase_line_invoice(osv.osv_memory): - + """ To create invoice for purchase order line""" - + _name = 'purchase.order.line_invoice' _description = 'Purchase Order Line Make Invoice' - + def makeInvoices(self, cr, uid, ids, context=None): - - """ + + """ To get Purchase Order line and create Invoice @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in - @param context: A standard dictionary + @param context: A standard dictionary @return : retrun view of Invoice """ - + if context is None: context={} - + record_ids = context.get('active_ids',[]) if record_ids: res = False @@ -55,28 +55,28 @@ class purchase_line_invoice(osv.osv_memory): property_obj=self.pool.get('ir.property') account_fiscal_obj=self.pool.get('account.fiscal.position') invoice_line_obj=self.pool.get('account.invoice.line') - - + account_jrnl_obj=self.pool.get('account.journal') + def multiple_order_invoice_name(orders): name = "PO"; for order in orders: name += "-%d" % order.id return name - + def multiple_order_invoice_reference(partner, orders): reference = "P%dPO" % partner.id - for order in orders: + for order in orders: reference += "-%d" % order.id return reference - + def multiple_order_invoice_notes(orders): notes = "" for order in orders: notes += "%s \n" % order.notes return notes - - - + + + def make_invoice_by_partner(partner, orders, lines_ids): """ create a new invoice for one supplier @@ -84,23 +84,24 @@ class purchase_line_invoice(osv.osv_memory): @param orders : The set of orders to add in the invoice @param lines : The list of line's id """ - + journal_id_get = account_jrnl_obj.search(cr,uid,[('type','=','purchase')],context=None)[0] a = partner.property_account_payable.id if partner and partner.property_payment_term.id: pay_term = partner.property_payment_term.id else: pay_term = False inv = { - 'name': multiple_order_invoice_name(orders), - 'origin': multiple_order_invoice_name(orders), + 'name': multiple_order_invoice_name(orders), + 'origin': multiple_order_invoice_name(orders), 'type': 'in_invoice', + 'journal_id':journal_id_get, 'reference': multiple_order_invoice_reference(partner, orders), 'account_id': a, 'partner_id': partner.id, 'address_invoice_id': orders[0].partner_address_id.id, 'address_contact_id': orders[0].partner_address_id.id, 'invoice_line': [(6,0,lines_ids)], - 'currency_id' : orders[0].pricelist_id.currency_id.id, + 'currency_id' : orders[0].pricelist_id.currency_id.id, 'comment': multiple_order_invoice_notes(orders), 'payment_term': pay_term, 'fiscal_position': partner.property_account_position.id @@ -136,7 +137,7 @@ class purchase_line_invoice(osv.osv_memory): 'uos_id': line.product_uom.id, 'product_id': line.product_id.id or False, 'invoice_line_tax_id': [(6, 0, [x.id for x in line.taxes_id])], - 'note': line.notes, + 'note': line.notes, 'account_analytic_id': line.account_analytic_id and line.account_analytic_id.id or False, }) cr.execute('insert into purchase_order_line_invoice_rel (order_line_id,invoice_id) values (%s,%s)', (line.id, inv_id)) @@ -147,7 +148,7 @@ class purchase_line_invoice(osv.osv_memory): for result in invoices.values(): il = map(lambda x: x[1], result) orders = list(set(map(lambda x : x[0].order_id, result))) - + res.append(make_invoice_by_partner(orders[0].partner_id, orders, il)) return { From 4936fb1bf2a12c12dc5a3d605a6293b04b427fe9 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Wed, 24 Nov 2010 17:02:47 +0530 Subject: [PATCH 02/11] [IMP]Task Id:1852 Product form - the link stock by location ->get focusing product stock bzr revid: ron@tinyerp.com-20101124113247-1sa7zy74ztg8e98a --- addons/stock/stock.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 299b81a9c01..cb4bf87d256 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -110,6 +110,7 @@ class stock_location(osv.osv): @param field_names: Name of field @return: Dictionary of values """ + prod_id = context and context.get('product_id', False) product_product_obj = self.pool.get('product.product') @@ -125,6 +126,8 @@ class stock_location(osv.osv): currency = self.pool.get('res.currency').browse(cr, uid, currency_id) currency_obj.round(cr, uid, currency, 300) for loc_id, product_ids in products_by_location.items(): + if prod_id: + product_ids = [prod_id] c = (context or {}).copy() c['location'] = loc_id for prod in product_product_obj.browse(cr, uid, product_ids, context=c): From 5579039d8418fa9303d1b58b71067ee01cb427a2 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Wed, 24 Nov 2010 18:09:17 +0530 Subject: [PATCH 03/11] [ADD]Task Id:1852 Purchase form - Pricelist menu add in purchases->configuration bzr revid: ron@tinyerp.com-20101124123917-f593dcgolzfnt29k --- addons/purchase/purchase_view.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index 0d27f970246..2379a79001a 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -6,6 +6,18 @@ + + + + + + + Addresses From 5324a27c17fd49d3ed0d47bc7a5ca99cf343e9da Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Thu, 25 Nov 2010 16:17:19 +0530 Subject: [PATCH 04/11] [IMP]Tracebility Improvement bzr revid: ron@tinyerp.com-20101125104719-pr255plf9d7aepuq --- addons/stock/wizard/stock_traceability.py | 24 +++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/addons/stock/wizard/stock_traceability.py b/addons/stock/wizard/stock_traceability.py index 815f90810ed..2a40ba2685e 100644 --- a/addons/stock/wizard/stock_traceability.py +++ b/addons/stock/wizard/stock_traceability.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,45 +15,49 @@ # 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 . +# along with this program. If not, see . # ############################################################################## from osv import fields, osv class action_traceability(osv.osv_memory): - """ + """ This class defines a function action_traceability for wizard """ _name = "action.traceability" _description = "Action traceability " - + def action_traceability(self, cr, uid, ids, context={}): """ It traces the information of a product @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 + @param ids: List of IDs selected + @param context: A standard dictionary @return: A dictionary of values """ - + lot_id = ids type1 = context['type'] or 'move_history_ids2' field = context['field'] or 'tracking_id' obj = self.pool.get('stock.move') - ids = obj.search(cr, uid, [(field, 'in',context['active_ids'])]) + ids = obj.search(cr, uid, [(field, 'in',lot_id)]) + if type1 == 'move_history_ids2': + new_id = ids[1] + else: + new_id = ids[0] cr.execute('select id from ir_ui_view where model=%s and field_parent=%s and type=%s', ('stock.move', type1, 'tree')) view_id = cr.fetchone()[0] value = { - 'domain': "[('id','in',["+','.join(map(str, ids))+"])]", + 'domain': "[('id','in',["+','.join(map(str, [new_id]))+"])]", 'name': ((type1=='move_history_ids2') and 'Upstream Traceability') or 'Downstream Traceability', 'view_type': 'tree', 'res_model': 'stock.move', 'field_parent': type1, 'view_id': (view_id,'View'), 'type': 'ir.actions.act_window', - 'nodestroy':True, + 'nodestroy':True, } return value From d108a970e69022e1673a3c108d7b6421dd965fc5 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Fri, 3 Dec 2010 18:36:21 +0530 Subject: [PATCH 05/11] [ADD]wizard to change Product Quantity from Product form View bzr revid: ron@tinyerp.com-20101203130621-ddfrcf36mls4p7q5 --- addons/stock/__openerp__.py | 5 +- addons/stock/product_view.xml | 5 +- addons/stock/stock.py | 1 - addons/stock/wizard/__init__.py | 2 +- .../stock/wizard/stock_change_product_qty.py | 106 ++++++++++++++++++ .../wizard/stock_change_product_qty_view.xml | 37 ++++++ 6 files changed, 151 insertions(+), 5 deletions(-) create mode 100644 addons/stock/wizard/stock_change_product_qty.py create mode 100644 addons/stock/wizard/stock_change_product_qty_view.xml diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py index 0b85511050d..987a0e12493 100644 --- a/addons/stock/__openerp__.py +++ b/addons/stock/__openerp__.py @@ -45,10 +45,11 @@ Thanks to the double entry management, the inventory controlling is powerful and "init_xml" : [], "demo_xml" : ["stock_demo.xml"], "update_xml" : [ - "security/stock_security.xml", - "security/ir.model.access.csv", + "security/stock_security.xml", + "security/ir.model.access.csv", "stock_data.xml", "wizard/stock_move_view.xml", + "wizard/stock_change_product_qty_view.xml", "wizard/stock_partial_picking_view.xml", "wizard/stock_partial_move_view.xml", "wizard/stock_fill_inventory_view.xml", diff --git a/addons/stock/product_view.xml b/addons/stock/product_view.xml index 35715a9e1fb..04344e18c16 100644 --- a/addons/stock/product_view.xml +++ b/addons/stock/product_view.xml @@ -102,9 +102,12 @@ - + +