From 6eaa79227eb0330f6bdd875775c13f7ec6df97eb Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 14 Jul 2012 22:51:50 +0200 Subject: [PATCH] [IMP] merge note&name on purchase lines bzr revid: fp@openerp.com-20120714205150-c5qjjjyuovbyxac5 --- addons/purchase/edi/purchase_order.py | 1 - addons/purchase/purchase.py | 24 ++++++----- addons/purchase/purchase_view.xml | 40 +++++++++---------- addons/purchase/report/order.rml | 30 -------------- addons/purchase/report/request_quotation.rml | 7 +--- addons/purchase/stock.py | 1 - .../purchase/wizard/purchase_line_invoice.py | 1 - 7 files changed, 33 insertions(+), 71 deletions(-) diff --git a/addons/purchase/edi/purchase_order.py b/addons/purchase/edi/purchase_order.py index 42cbb04842c..d1c00a3e60d 100644 --- a/addons/purchase/edi/purchase_order.py +++ b/addons/purchase/edi/purchase_order.py @@ -35,7 +35,6 @@ PURCHASE_ORDER_LINE_EDI_STRUCT = { 'product_uom': True, 'price_unit': True, 'product_qty': True, - 'notes': True, # fields used for web preview only - discarded on import 'price_subtotal': True, diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index e74ca83a92b..198f12ca6a9 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -687,7 +687,7 @@ class purchase_order(osv.osv): order_infos['origin'] = (order_infos['origin'] or '') + ' ' + porder.origin for order_line in porder.order_line: - line_key = make_key(order_line, ('name', 'date_planned', 'taxes_id', 'price_unit', 'notes', 'product_id', 'move_dest_id', 'account_analytic_id')) + line_key = make_key(order_line, ('name', 'date_planned', 'taxes_id', 'price_unit', 'product_id', 'move_dest_id', 'account_analytic_id')) o_line = order_infos['order_line'].setdefault(line_key, {}) if o_line: # merge the line with an existing line @@ -806,7 +806,6 @@ class purchase_order_line(osv.osv): 'move_dest_id': fields.many2one('stock.move', 'Reservation Destination', ondelete='set null'), 'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Purchase Price')), 'price_subtotal': fields.function(_amount_line, string='Subtotal', digits_compute= dp.get_precision('Purchase Price')), - 'notes': fields.text('Notes'), 'order_id': fields.many2one('purchase.order', 'Order Reference', select=True, required=True, ondelete='cascade'), 'account_analytic_id':fields.many2one('account.analytic.account', 'Analytic Account',), 'company_id': fields.related('order_id','company_id',type='many2one',relation='res.company',string='Company', store=True, readonly=True), @@ -839,15 +838,15 @@ class purchase_order_line(osv.osv): def onchange_product_uom(self, cr, uid, ids, pricelist_id, product_id, qty, uom_id, partner_id, date_order=False, fiscal_position_id=False, date_planned=False, - name=False, price_unit=False, notes=False, context=None): + name=False, price_unit=False, context=None): """ onchange handler of product_uom. """ if not uom_id: - return {'value': {'price_unit': price_unit or 0.0, 'name': name or '', 'notes': notes or'', 'product_uom' : uom_id or False}} + return {'value': {'price_unit': price_unit or 0.0, 'name': name or '', 'product_uom' : uom_id or False}} return self.onchange_product_id(cr, uid, ids, pricelist_id, product_id, qty, uom_id, partner_id, date_order=date_order, fiscal_position_id=fiscal_position_id, date_planned=date_planned, - name=name, price_unit=price_unit, notes=notes, context=context) + name=name, price_unit=price_unit, context=context) def _get_date_planned(self, cr, uid, supplier_info, date_order_str, context=None): """Return the datetime value to use as Schedule Date (``date_planned``) for @@ -866,14 +865,14 @@ class purchase_order_line(osv.osv): def onchange_product_id(self, cr, uid, ids, pricelist_id, product_id, qty, uom_id, partner_id, date_order=False, fiscal_position_id=False, date_planned=False, - name=False, price_unit=False, notes=False, context=None): + name=False, price_unit=False, context=None): """ onchange handler of product_id. """ if context is None: context = {} - res = {'value': {'price_unit': price_unit or 0.0, 'name': name or '', 'notes': notes or '', 'product_uom' : uom_id or False}} + res = {'value': {'price_unit': price_unit or 0.0, 'name': name or '', 'product_uom' : uom_id or False}} if not product_id: return res @@ -895,7 +894,10 @@ class purchase_order_line(osv.osv): lang = res_partner.browse(cr, uid, partner_id).lang context_partner = {'lang': lang, 'partner_id': partner_id} product = product_product.browse(cr, uid, product_id, context=context_partner) - res['value'].update({'name': product.name, 'notes': notes or product.description_purchase}) + name = product.name + if product.description_purchase: + name += '\n' + product.description_purchase + res['value'].update({'name': name}) # - set a domain on product_uom res['domain'] = {'product_uom': [('category_id','=',product.uom_id.category_id.id)]} @@ -1049,15 +1051,17 @@ class procurement_order(osv.osv): taxes_ids = procurement.product_id.product_tmpl_id.supplier_taxes_id taxes = acc_pos_obj.map_tax(cr, uid, partner.property_account_position, taxes_ids) + name = product.partner_ref + if product.description_purchase: + name += '\n'+ product.description_purchase line_vals = { - 'name': product.partner_ref, + 'name': name, 'product_qty': qty, 'product_id': procurement.product_id.id, 'product_uom': uom_id, 'price_unit': price or 0.0, 'date_planned': schedule_date.strftime(DEFAULT_SERVER_DATETIME_FORMAT), 'move_dest_id': res_id, - 'notes': product.description_purchase, 'taxes_id': [(6,0,taxes)], } name = seq_obj.get(cr, uid, 'purchase.order') or _('PO: %s') % procurement.name diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index 88d9595ac08..0dcc4b0a4a5 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -214,7 +214,7 @@ - + @@ -224,7 +224,7 @@