[FIX] sale,purchase: add totals to edi struct, used only for web preview

bzr revid: odo@openerp.com-20111013165600-7k3dvkc406hoog0t
This commit is contained in:
Olivier Dony
2011-10-13 18:56:00 +02:00
parent 2b59a0d6f4
commit a93ca01b5b
2 changed files with 22 additions and 1 deletions
+10
View File
@@ -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
+12 -1
View File
@@ -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)