From a93ca01b5b1365f92e191e3c429ef655e751b455 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 13 Oct 2011 18:56:00 +0200 Subject: [PATCH] [FIX] sale,purchase: add totals to edi struct, used only for web preview bzr revid: odo@openerp.com-20111013165600-7k3dvkc406hoog0t --- addons/purchase/edi/purchase_order.py | 10 ++++++++++ addons/sale/edi/sale_order.py | 13 ++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/addons/purchase/edi/purchase_order.py b/addons/purchase/edi/purchase_order.py index 2bf823707a7..91c2d4ed60d 100644 --- a/addons/purchase/edi/purchase_order.py +++ b/addons/purchase/edi/purchase_order.py @@ -48,6 +48,11 @@ PURCHASE_ORDER_EDI_STRUCT = { 'notes': True, 'order_line': PURCHASE_ORDER_LINE_EDI_STRUCT, #custom: currency_id + + # fields used for web preview only - discarded on import + 'amount_total': True, + 'amount_untaxed': True, + 'amount_tax': True, } class purchase_order(osv.osv, EDIMixin): @@ -164,6 +169,11 @@ class purchase_order(osv.osv, EDIMixin): edi_document['pricelist_id'] = self._edi_get_pricelist(cr, uid, partner_id, order_currency, context=context) edi_document['location_id'] = self._edi_get_location(cr, uid, partner_id, context=context) + # discard web preview fields, if present + edi_document.pop('amount_total', None) + edi_document.pop('amount_tax', None) + edi_document.pop('amount_untaxed', None) + for order_line in edi_document['order_line']: self._edi_requires_attributes(('date_planned', 'product_id', 'product_uom', 'product_qty', 'price_unit'), order_line) # original sale order contains unit price and discount, but not final line price diff --git a/addons/sale/edi/sale_order.py b/addons/sale/edi/sale_order.py index d7ece92717a..5909eabd121 100644 --- a/addons/sale/edi/sale_order.py +++ b/addons/sale/edi/sale_order.py @@ -47,7 +47,12 @@ SALE_ORDER_EDI_STRUCT = { 'partner_id': True, #custom: 'partner_address' #custom: 'notes' - 'order_line': SALE_ORDER_LINE_EDI_STRUCT + 'order_line': SALE_ORDER_LINE_EDI_STRUCT, + + # fields used for web preview only - discarded on import + 'amount_total': True, + 'amount_untaxed': True, + 'amount_tax': True, } class sale_order(osv.osv, EDIMixin): @@ -162,6 +167,12 @@ class sale_order(osv.osv, EDIMixin): edi_document['name'] = partner_ref or edi_document['name'] edi_document['note'] = edi_document.pop('notes', False) edi_document['pricelist_id'] = self._edi_get_pricelist(cr, uid, partner_id, order_currency, context=context) + + # discard web preview fields, if present + edi_document.pop('amount_total', None) + edi_document.pop('amount_tax', None) + edi_document.pop('amount_untaxed', None) + order_lines = edi_document['order_line'] for order_line in order_lines: self._edi_requires_attributes(('date_planned', 'product_id', 'product_uom', 'product_qty', 'price_unit'), order_line)