[FIX] improved code in edi and l10n_ch modules.
bzr revid: tpa@tinyerp.com-20120322061846-021c8rb9yfkespr4
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
##############################################################################
|
||||
import logging
|
||||
|
||||
from osv import fields,osv
|
||||
from osv import fields,osv
|
||||
from edi import EDIMixin
|
||||
from openerp import SUPERUSER_ID
|
||||
from tools.translate import _
|
||||
@@ -74,9 +74,9 @@ class res_partner(osv.osv, EDIMixin):
|
||||
edi_bank_ids = edi_document.pop('bank_ids', None)
|
||||
contact_id = super(res_partner,self).edi_import(cr, uid, edi_document, context=context)
|
||||
if edi_bank_ids:
|
||||
contacts = self.browse(cr, uid, contact_id, context=context)
|
||||
contact = self.browse(cr, uid, contact_id, context=context)
|
||||
import_ctx = dict((context or {}),
|
||||
default_partner_id=contacts.parent_id.id,
|
||||
default_partner_id=contact.id,
|
||||
default_state=self._get_bank_type(cr, uid, context))
|
||||
for ext_bank_id, bank_name in edi_bank_ids:
|
||||
try:
|
||||
|
||||
@@ -153,13 +153,13 @@
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/notebook/page/field[@name='bank_ids']/tree/field[@name='acc_number']" position="before">
|
||||
<xpath expr="//page/field[@name='bank_ids']/tree/field[@name='acc_number']" position="before">
|
||||
<field name="state" />
|
||||
<field name="bank" />
|
||||
<field name="bank" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- res.partner form bank list-->
|
||||
<!-- Adding Type and bank name -->
|
||||
<record id="l10nch_view_partner_bank_invoice_tree" model="ir.ui.view">
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
-
|
||||
-
|
||||
In order to test BVR printing. I create Partner data .
|
||||
-
|
||||
-
|
||||
!record {model: res.partner.category, id: res_partner_category_bvr}:
|
||||
name: Customers
|
||||
-
|
||||
I create BVR DUMMY Customer.
|
||||
-
|
||||
-
|
||||
!record {model: res.partner, id: res_partner_bvr}:
|
||||
category_id:
|
||||
- res_partner_category_bvr
|
||||
name: BVR DUMMY
|
||||
-
|
||||
-
|
||||
I create contact address for BVR DUMMY.
|
||||
-
|
||||
-
|
||||
!record {model: res.partner, id: res_partner_address_1}:
|
||||
partner_id: res_partner_bvr
|
||||
parent_id: res_partner_bvr
|
||||
street: Route de Bélario
|
||||
type: contact
|
||||
-
|
||||
-
|
||||
I create invoice address for BVR DUMMY.
|
||||
-
|
||||
-
|
||||
!record {model: res.partner, id: res_partner_address_2}:
|
||||
partner_id: res_partner_bvr
|
||||
parent_id: res_partner_bvr
|
||||
street: Route de Bélario
|
||||
type: invoice
|
||||
-
|
||||
-
|
||||
I create delivery address for BVR DUMMY.
|
||||
-
|
||||
-
|
||||
!record {model: res.partner, id: res_partner_address_3}:
|
||||
partner_id: res_partner_bvr
|
||||
parent_id: res_partner_bvr
|
||||
street: Route de Bélario
|
||||
type: delivery
|
||||
|
||||
|
||||
@@ -491,7 +491,7 @@ def _create_dta(obj, cr, uid, data, context=None):
|
||||
or ''
|
||||
else:
|
||||
v['partner_country']= pline.partner_id.country_id \
|
||||
and pline.partner_id.acountry_id.name \
|
||||
and pline.partner_id.country_id.name \
|
||||
or ''
|
||||
else:
|
||||
v['partner_street'] =''
|
||||
|
||||
@@ -67,7 +67,7 @@ Dashboard for purchase management that includes:
|
||||
'test/process/generate_invoice_from_reception.yml',
|
||||
'test/process/run_scheduler.yml',
|
||||
'test/process/merge_order.yml',
|
||||
# 'test/process/edi_purchase_order.yml',
|
||||
'test/process/edi_purchase_order.yml',
|
||||
'test/process/invoice_on_poline.yml',
|
||||
'test/ui/print_report.yml',
|
||||
'test/ui/duplicate_order.yml',
|
||||
|
||||
@@ -65,7 +65,7 @@ class purchase_order(osv.osv, EDIMixin):
|
||||
"""Exports a purchase order"""
|
||||
edi_struct = dict(edi_struct or PURCHASE_ORDER_EDI_STRUCT)
|
||||
res_company = self.pool.get('res.company')
|
||||
res_partner_address = self.pool.get('res.partner.address')
|
||||
res_partner_address = self.pool.get('res.partner')
|
||||
edi_doc_list = []
|
||||
for order in records:
|
||||
# generate the main report
|
||||
@@ -95,29 +95,22 @@ class purchase_order(osv.osv, EDIMixin):
|
||||
# the desired company among the user's allowed companies
|
||||
|
||||
self._edi_requires_attributes(('company_id','company_address'), edi_document)
|
||||
res_partner_address = self.pool.get('res.partner.address')
|
||||
res_partner_address = self.pool.get('res.partner')
|
||||
res_partner = self.pool.get('res.partner')
|
||||
|
||||
# imported company = as a new partner
|
||||
src_company_id, src_company_name = edi_document.pop('company_id')
|
||||
partner_id = self.edi_import_relation(cr, uid, 'res.partner', src_company_name,
|
||||
src_company_id, context=context)
|
||||
partner_value = {'customer': True}
|
||||
res_partner.write(cr, uid, [partner_id], partner_value, context=context)
|
||||
|
||||
# imported company_address = new partner address
|
||||
src_company_id, src_company_name = edi_document.pop('company_id')
|
||||
address_info = edi_document.pop('company_address')
|
||||
address_info['partner_id'] = (src_company_id, src_company_name)
|
||||
address_info['type'] = 'default'
|
||||
address_info['customer'] = True
|
||||
if 'name' not in address_info:
|
||||
address_info['name'] = src_company_name
|
||||
address_id = res_partner_address.edi_import(cr, uid, address_info, context=context)
|
||||
|
||||
# modify edi_document to refer to new partner/address
|
||||
partner_address = res_partner_address.browse(cr, uid, address_id, context=context)
|
||||
edi_document['partner_id'] = (src_company_id, src_company_name)
|
||||
edi_document.pop('partner_address', False) # ignored
|
||||
edi_document['partner_id'] = self.edi_m2o(cr, uid, partner_address, context=context)
|
||||
|
||||
return partner_id
|
||||
return address_id
|
||||
|
||||
def _edi_get_pricelist(self, cr, uid, partner_id, currency, context=None):
|
||||
# TODO: refactor into common place for purchase/sale, e.g. into product module
|
||||
|
||||
@@ -101,28 +101,25 @@ class sale_order(osv.osv, EDIMixin):
|
||||
self._edi_requires_attributes(('company_id','company_address'), edi_document)
|
||||
res_partner = self.pool.get('res.partner')
|
||||
|
||||
# imported company = as a new partner
|
||||
src_company_id, src_company_name = edi_document.pop('company_id')
|
||||
partner_id = self.edi_import_relation(cr, uid, 'res.partner', src_company_name,
|
||||
src_company_id, context=context)
|
||||
partner_value = {'supplier': True}
|
||||
res_partner.write(cr, uid, [partner_id], partner_value, context=context)
|
||||
|
||||
# imported company_address = new partner address
|
||||
src_company_id, src_company_name = edi_document.pop('company_id')
|
||||
|
||||
address_info = edi_document.pop('company_address')
|
||||
address_info['parent_id'] = (src_company_id, src_company_name)
|
||||
address_info['type'] = 'default'
|
||||
address_info['supplier'] = True
|
||||
if 'name' not in address_info:
|
||||
address_info['name'] = src_company_name
|
||||
|
||||
address_id = res_partner.edi_import(cr, uid, address_info, context=context)
|
||||
|
||||
# modify edi_document to refer to new partner/address
|
||||
partner_address = res_partner.browse(cr, uid, address_id, context=context)
|
||||
# edi_document['parent_id'] = (src_company_id, src_company_name)
|
||||
edi_document.pop('partner_address', False) # ignored
|
||||
address_edi_m2o = self.edi_m2o(cr, uid, partner_address, context=context)
|
||||
edi_document['partner_id'] = address_edi_m2o
|
||||
edi_document['partner_invoice_id'] = address_edi_m2o
|
||||
edi_document['partner_shipping_id'] = address_edi_m2o
|
||||
|
||||
return partner_id
|
||||
return address_id
|
||||
|
||||
def _edi_get_pricelist(self, cr, uid, partner_id, currency, context=None):
|
||||
# TODO: refactor into common place for purchase/sale, e.g. into product module
|
||||
@@ -210,7 +207,7 @@ class sale_order_line(osv.osv, EDIMixin):
|
||||
product_qty=line.product_uos_qty)
|
||||
|
||||
# company.security_days is for internal use, so customer should only
|
||||
# see the expected date_planned based on line.delay
|
||||
# see the expected date_planned based on line.delay
|
||||
date_planned = datetime.strptime(line.order_id.date_order, DEFAULT_SERVER_DATE_FORMAT) + \
|
||||
relativedelta(days=line.delay or 0.0)
|
||||
edi_doc['date_planned'] = date_planned.strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||
|
||||
@@ -56,17 +56,16 @@
|
||||
"__id": "base:5af1272e-dd26-11e0-b65e-701a04e25543.some_address",
|
||||
"__module": "base",
|
||||
"__model": "res.partner",
|
||||
"name":"Chaussee",
|
||||
"phone": "(+32).81.81.37.00",
|
||||
"street": "Chaussee de Namur 40",
|
||||
"city": "Gerompont",
|
||||
"zip": "1367",
|
||||
"phone": "(+32).81.81.37.00",
|
||||
"street": "Chaussee de Namur 40",
|
||||
"city": "Gerompont",
|
||||
"zip": "1367",
|
||||
"country_id": ["base:5af1272e-dd26-11e0-b65e-701a04e25543.be", "Belgium"],
|
||||
"bank_ids": [
|
||||
["base:5af1272e-dd26-11e0-b65e-701a04e25543.res_partner_bank-adaWadsadasdDJzGbp","Ladies bank: 032465789-156113"]
|
||||
],
|
||||
},
|
||||
"partner_id": ["purchase:5af1272e-dd26-11e0-b65e-701a04e25543.res_partner_test20", "jones white"],
|
||||
},
|
||||
"partner_id": ["purchase:5af1272e-dd26-11e0-b65e-701a04e25543.res_partner_test20", "jones white"],
|
||||
"order_line": [{
|
||||
"__id": "purchase:5af1272e-dd26-11e0-b65e-701a04e25543.purchase_order_line-AlhsVDZGoKvJ",
|
||||
"__module": "purchase",
|
||||
|
||||
Reference in New Issue
Block a user