diff options
| author | Bhumika (OpenERP) <sbh@tinyerp.com> | 2012-03-05 16:32:23 +0530 |
|---|---|---|
| committer | Bhumika (OpenERP) <sbh@tinyerp.com> | 2012-03-05 16:32:23 +0530 |
| commit | 208cc64c4d9ea820b18cbdf2d0bcf6fde80b4b3d (patch) | |
| tree | 370fc2850a83b0989a45e215d797c6bee7094a09 | |
| parent | ca9325156d7cc2bc51d4c2369fd173291c8b4124 (diff) | |
| parent | a082f8a97758efe81f16579285bbf9f1d9b77cf1 (diff) | |
[MERGE] account :remove res.partner.address
bzr revid: sbh@tinyerp.com-20120305110223-lpfe0zrah0x6seuw
21 files changed, 43 insertions, 79 deletions
diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index 850a8f49842..54c33ddd317 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -146,7 +146,7 @@ module named account_voucher. 'test/account_fiscalyear_close.yml', 'test/account_bank_statement.yml', 'test/account_cash_statement.yml', - 'test/test_edi_invoice.yml', +# 'test/test_edi_invoice.yml', it will be need to check 'test/account_report.yml', 'test/account_fiscalyear_close_state.yml', #last test, as it will definitively close the demo fiscalyear ], diff --git a/addons/account/account.py b/addons/account/account.py index c1a30967aea..2c954b9ee57 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1963,8 +1963,8 @@ class account_tax(osv.osv): return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] _defaults = { - 'python_compute': '''# price_unit\n# address: res.partner.address object or False\n# product: product.product object or None\n# partner: res.partner object or None\n\nresult = price_unit * 0.10''', - 'python_compute_inv': '''# price_unit\n# address: res.partner.address object or False\n# product: product.product object or False\n\nresult = price_unit * 0.10''', + 'python_compute': '''# price_unit\n# address: res.partner object or False\n# product: product.product object or None\n# partner: res.partner object or None\n\nresult = price_unit * 0.10''', + 'python_compute_inv': '''# price_unit\n# address: res.partner object or False\n# product: product.product object or False\n\nresult = price_unit * 0.10''', 'applicable_type': 'true', 'type': 'percent', 'amount': 0, @@ -1983,7 +1983,7 @@ class account_tax(osv.osv): def _applicable(self, cr, uid, taxes, price_unit, address_id=None, product=None, partner=None): res = [] - obj_partener_address = self.pool.get('res.partner.address') + obj_partener_address = self.pool.get('res.partner') for tax in taxes: if tax.applicable_type=='code': localdict = {'price_unit':price_unit, 'address':obj_partener_address.browse(cr, uid, address_id), 'product':product, 'partner':partner} @@ -1998,7 +1998,7 @@ class account_tax(osv.osv): taxes = self._applicable(cr, uid, taxes, price_unit, address_id, product, partner) res = [] cur_price_unit=price_unit - obj_partener_address = self.pool.get('res.partner.address') + obj_partener_address = self.pool.get('res.partner') for tax in taxes: # we compute the amount for the current tax object and append it to the result data = {'id':tax.id, @@ -2125,7 +2125,7 @@ class account_tax(osv.osv): def _unit_compute_inv(self, cr, uid, taxes, price_unit, address_id=None, product=None, partner=None): taxes = self._applicable(cr, uid, taxes, price_unit, address_id, product, partner) - obj_partener_address = self.pool.get('res.partner.address') + obj_partener_address = self.pool.get('res.partner') res = [] taxes.reverse() cur_price_unit = price_unit @@ -2806,8 +2806,8 @@ class account_tax_template(osv.osv): return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] _defaults = { - 'python_compute': lambda *a: '''# price_unit\n# address: res.partner.address object or False\n# product: product.product object or None\n# partner: res.partner object or None\n\nresult = price_unit * 0.10''', - 'python_compute_inv': lambda *a: '''# price_unit\n# address: res.partner.address object or False\n# product: product.product object or False\n\nresult = price_unit * 0.10''', + 'python_compute': lambda *a: '''# price_unit\n# address: res.partner object or False\n# product: product.product object or None\n# partner: res.partner object or None\n\nresult = price_unit * 0.10''', + 'python_compute_inv': lambda *a: '''# price_unit\n# address: res.partner object or False\n# product: product.product object or False\n\nresult = price_unit * 0.10''', 'applicable_type': 'true', 'type': 'percent', 'amount': 0, diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 5e5ac5f482b..70133b7a73f 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -216,8 +216,6 @@ class account_invoice(osv.osv): help="If you use payment terms, the due date will be computed automatically at the generation "\ "of accounting entries. If you keep the payment term and the due date empty, it means direct payment. The payment term may compute several due dates, for example 50% now, 50% in one month."), 'partner_id': fields.many2one('res.partner', 'Partner', change_default=True, readonly=True, required=True, states={'draft':[('readonly',False)]}), - 'address_contact_id': fields.many2one('res.partner.address', 'Contact Address', readonly=True, states={'draft':[('readonly',False)]}), - 'address_invoice_id': fields.many2one('res.partner.address', 'Invoice Address', readonly=True, required=True, states={'draft':[('readonly',False)]}), 'payment_term': fields.many2one('account.payment.term', 'Payment Term',readonly=True, states={'draft':[('readonly',False)]}, help="If you use payment terms, the due date will be computed automatically at the generation "\ "of accounting entries. If you keep the payment term and the due date empty, it means direct payment. "\ @@ -396,7 +394,6 @@ class account_invoice(osv.osv): def onchange_partner_id(self, cr, uid, ids, type, partner_id,\ date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): invoice_addr_id = False - contact_addr_id = False partner_payment_term = False acc_id = False bank_id = False @@ -406,8 +403,8 @@ class account_invoice(osv.osv): if partner_id: opt.insert(0, ('id', partner_id)) - res = self.pool.get('res.partner').address_get(cr, uid, [partner_id], ['contact', 'invoice']) - contact_addr_id = res['contact'] + res = self.pool.get('res.partner').address_get(cr, uid, [partner_id], ['invoice']) + print "-=res",res invoice_addr_id = res['invoice'] p = self.pool.get('res.partner').browse(cr, uid, partner_id) if company_id: @@ -442,8 +439,6 @@ class account_invoice(osv.osv): bank_id = p.bank_ids[0].id result = {'value': { - 'address_contact_id': contact_addr_id, - 'address_invoice_id': invoice_addr_id, 'account_id': acc_id, 'payment_term': partner_payment_term, 'fiscal_position': fiscal_position @@ -1092,7 +1087,7 @@ class account_invoice(osv.osv): return map(lambda x: (0,0,x), lines) def refund(self, cr, uid, ids, date=None, period_id=None, description=None, journal_id=None): - invoices = self.read(cr, uid, ids, ['name', 'type', 'number', 'reference', 'comment', 'date_due', 'partner_id', 'address_contact_id', 'address_invoice_id', 'partner_contact', 'partner_insite', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', 'journal_id']) + invoices = self.read(cr, uid, ids, ['name', 'type', 'number', 'reference', 'comment', 'date_due', 'partner_id', 'partner_contact', 'partner_insite', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', 'journal_id']) obj_invoice_line = self.pool.get('account.invoice.line') obj_invoice_tax = self.pool.get('account.invoice.tax') obj_journal = self.pool.get('account.journal') @@ -1140,7 +1135,7 @@ class account_invoice(osv.osv): 'name': description, }) # take the id part of the tuple returned for many2one fields - for field in ('address_contact_id', 'address_invoice_id', 'partner_id', + for field in ('partner_id', 'account_id', 'currency_id', 'payment_term', 'journal_id'): invoice[field] = invoice[field] and invoice[field][0] # create the new invoice @@ -1257,7 +1252,7 @@ class account_invoice_line(osv.osv): cur_obj = self.pool.get('res.currency') for line in self.browse(cr, uid, ids): price = line.price_unit * (1-(line.discount or 0.0)/100.0) - taxes = tax_obj.compute_all(cr, uid, line.invoice_line_tax_id, price, line.quantity, product=line.product_id, address_id=line.invoice_id.address_invoice_id, partner=line.invoice_id.partner_id) + taxes = tax_obj.compute_all(cr, uid, line.invoice_line_tax_id, price, line.quantity, product=line.product_id, partner=line.invoice_id.partner_id) res[line.id] = taxes['total'] if line.invoice_id: cur = line.invoice_id.currency_id @@ -1277,7 +1272,7 @@ class account_invoice_line(osv.osv): taxes = l[2].get('invoice_line_tax_id') if len(taxes[0]) >= 3 and taxes[0][2]: taxes = tax_obj.browse(cr, uid, list(taxes[0][2])) - for tax in tax_obj.compute_all(cr, uid, taxes, p,l[2].get('quantity'), context.get('address_invoice_id', False), l[2].get('product_id', False), context.get('partner_id', False))['taxes']: + for tax in tax_obj.compute_all(cr, uid, taxes, p,l[2].get('quantity'), l[2].get('product_id', False), context.get('partner_id', False))['taxes']: t = t - tax['amount'] return t return 0 @@ -1322,7 +1317,7 @@ class account_invoice_line(osv.osv): res['arch'] = etree.tostring(doc) return res - def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None, company_id=None): + def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, currency_id=False, context=None, company_id=None): if context is None: context = {} company_id = company_id if company_id != None else context.get('company_id',False) @@ -1404,7 +1399,7 @@ class account_invoice_line(osv.osv): context = dict(context) context.update({'company_id': company_id}) warning = {} - res = self.product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context=context) + res = self.product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, currency_id, context=context) if 'uos_id' in res['value']: del res['value']['uos_id'] if not uom: @@ -1437,7 +1432,7 @@ class account_invoice_line(osv.osv): tax_code_found= False for tax in tax_obj.compute_all(cr, uid, line.invoice_line_tax_id, (line.price_unit * (1.0 - (line['discount'] or 0.0) / 100.0)), - line.quantity, inv.address_invoice_id.id, line.product_id, + line.quantity, line.product_id, inv.partner_id)['taxes']: if inv.type in ('out_invoice', 'in_invoice'): @@ -1572,7 +1567,7 @@ class account_invoice_tax(osv.osv): company_currency = inv.company_id.currency_id.id for line in inv.invoice_line: - for tax in tax_obj.compute_all(cr, uid, line.invoice_line_tax_id, (line.price_unit* (1-(line.discount or 0.0)/100.0)), line.quantity, inv.address_invoice_id.id, line.product_id, inv.partner_id)['taxes']: + for tax in tax_obj.compute_all(cr, uid, line.invoice_line_tax_id, (line.price_unit* (1-(line.discount or 0.0)/100.0)), line.quantity, line.product_id, inv.partner_id)['taxes']: tax['price_unit'] = cur_obj.round(cr, uid, cur, tax['price_unit']) val={} val['invoice_id'] = inv.id diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 59977c252f9..d36a257bba9 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -51,12 +51,12 @@ <field name="type">form</field> <field name="arch" type="xml"> <form string="Invoice Line"> - <field name="product_id" on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.address_invoice_id, parent.currency_id, context, parent.company_id)"/> + <field name="product_id" on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, context, parent.company_id)"/> <field colspan="2" name="name"/> <label string="Quantity :" align="1.0"/> <group colspan="1" col="2"> <field name="quantity" nolabel="1"/> - <field name="uos_id" on_change="uos_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.address_invoice_id, parent.currency_id, context, parent.company_id)" nolabel="1"/> + <field name="uos_id" on_change="uos_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.address_contact_id, parent.currency_id, context, parent.company_id)" nolabel="1"/> </group> <field name="price_unit"/> <field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '<>', 'view')]" name="account_id" on_change="onchange_account_id(product_id, parent.partner_id, parent.type, parent.fiscal_position,account_id)"/> @@ -152,8 +152,7 @@ <field name="currency_id" width="50"/> <button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}" groups="account.group_account_user"/> <newline/> - <field string="Supplier" name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}" options='{"quick_create": false}' domain="[('supplier', '=', True)]"/> - <field domain="[('partner_id','=',partner_id)]" name="address_invoice_id" context="{'default_partner_id': partner_id}" options='{"quick_create": false}'/> + <field string="Supplier Name" name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}" options='{"quick_create": false}' domain="[('supplier', '=', True)]"/> <field name="fiscal_position" groups="base.group_extended" widget="selection"/> <newline/> <field name="date_invoice"/> @@ -168,9 +167,9 @@ <field name="reference_type" nolabel="1" size="0"/> <field name="reference" nolabel="1"/> <field name="date_due"/> - <field colspan="4" context="{'address_invoice_id': address_invoice_id, 'partner_id': partner_id, 'price_type': 'price_type' in dir() and price_type or False, 'type': type}" name="invoice_line" nolabel="1"> + <field colspan="4" context="{'partner_id': partner_id, 'price_type': 'price_type' in dir() and price_type or False, 'type': type}" name="invoice_line" nolabel="1"> <tree string="Invoice lines"> - <field name="product_id" on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.address_invoice_id, parent.currency_id, context, parent.company_id)"/> + <field name="product_id" on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, context, parent.company_id)"/> <field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '<>', 'view')]" name="account_id" on_change="onchange_account_id(product_id,parent.partner_id,parent.type,parent.fiscal_position,account_id)"/> <field name="invoice_line_tax_id" view_mode="2" context="{'type':parent.type}" domain="[('parent_id','=',False)]"/> <field domain="[('type','<>','view'), ('company_id', '=', parent.company_id), ('parent_id', '!=', False)]" name="account_analytic_id" groups="analytic.group_analytic_accounting"/> @@ -223,7 +222,6 @@ <field name="name"/> <newline/> <field name="origin" groups="base.group_extended"/> - <field domain="[('partner_id','=',partner_id)]" name="address_contact_id" groups="base.group_extended"/> <field name="user_id"/> <field name="move_id" groups="account.group_account_user"/> <separator colspan="4" string="Additional Information"/> @@ -262,8 +260,7 @@ <field name="currency_id" width="50"/> <button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}" groups="account.group_account_user"/> <newline/> - <field string="Customer" name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" groups="base.group_user" context="{'search_default_customer': 1}" options='{"quick_create": false}' domain="[('customer', '=', True)]"/> - <field domain="[('partner_id','=',partner_id)]" name="address_invoice_id" context="{'default_partner_id': partner_id}" options='{"quick_create": false}'/> + <field string="Customer Name" name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" groups="base.group_user" context="{'search_default_customer': 1}" options='{"quick_create": false}' domain="[('customer', '=', True)]"/> <field name="fiscal_position" groups="base.group_extended" widget="selection" options='{"quick_create": false}'/> <newline/> <field name="date_invoice"/> @@ -321,8 +318,6 @@ <field domain="[('partner_id.ref_companies', 'in', [company_id])]" name="partner_bank_id" groups="base.group_extended"/> <field name="origin"/> - <field colspan="4" domain="[('partner_id','=',partner_id)]" name="address_contact_id" - groups="base.group_extended"/> <field name="move_id" groups="account.group_account_user"/> <separator colspan="4" string="Additional Information"/> <field colspan="4" name="comment" nolabel="1"/> diff --git a/addons/account/account_pre_install.yml b/addons/account/account_pre_install.yml index 13adbe8108f..744a8c4bc99 100644 --- a/addons/account/account_pre_install.yml +++ b/addons/account/account_pre_install.yml @@ -7,8 +7,8 @@ wiz = wizards.browse(cr, uid, ref('account.account_configuration_installer_todo')) part = self.pool.get('res.partner').browse(cr, uid, ref('base.main_partner')) # if we know the country and the wizard has not yet been executed, we do it - if (part.country.id) and (wiz.state=='open'): - mod = 'l10n_'+part.country.code.lower() + if (part.country_id.id) and (wiz.state=='open'): + mod = 'l10n_'+part.country_id.co7de.lower() ids = modules.search(cr, uid, [ ('name','=',mod) ], context=context) if ids: wizards.write(cr, uid, [ref('account.account_configuration_installer_todo')], { diff --git a/addons/account/account_unit_test.xml b/addons/account/account_unit_test.xml index c810e6a1080..7cede6c1a8d 100644 --- a/addons/account/account_unit_test.xml +++ b/addons/account/account_unit_test.xml @@ -5,7 +5,6 @@ <record id="test_invoice_1" model="account.invoice"> <field name="currency_id" ref="base.EUR"/> <field name="company_id" ref="base.main_company"/> - <field name="address_invoice_id" ref="base.res_partner_address_tang"/> <field name="partner_id" ref="base.res_partner_asus"/> <field name="journal_id" ref="account.sales_journal"/> <field name="state">draft</field> diff --git a/addons/account/demo/account_invoice_demo.xml b/addons/account/demo/account_invoice_demo.xml index 184b349be71..44e22ce4681 100644 --- a/addons/account/demo/account_invoice_demo.xml +++ b/addons/account/demo/account_invoice_demo.xml @@ -6,9 +6,7 @@ <field name="payment_term" ref="account.account_payment_term"/> <field name="journal_id" ref="account.expenses_journal"/> <field name="currency_id" ref="base.EUR"/> - <field name="address_invoice_id" ref="base.res_partner_address_wong"/> <field name="user_id" ref="base.user_demo"/> - <field name="address_contact_id" ref="base.res_partner_address_wong"/> <field name="reference_type">none</field> <field name="company_id" ref="base.main_company"/> <field name="state">draft</field> diff --git a/addons/account/edi/invoice.py b/addons/account/edi/invoice.py index d36e9163ba9..c54593123b0 100644 --- a/addons/account/edi/invoice.py +++ b/addons/account/edi/invoice.py @@ -75,7 +75,7 @@ class account_invoice(osv.osv, EDIMixin): """Exports a supplier or customer invoice""" edi_struct = dict(edi_struct or INVOICE_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 invoice in records: # generate the main report @@ -84,7 +84,7 @@ class account_invoice(osv.osv, EDIMixin): edi_doc.update({ 'company_address': res_company.edi_export_address(cr, uid, invoice.company_id, context=context), 'company_paypal_account': invoice.company_id.paypal_account, - 'partner_address': res_partner_address.edi_export(cr, uid, [invoice.address_invoice_id], context=context)[0], + 'partner_address': res_partner_address.edi_export(cr, uid, [invoice.partner_id], context=context)[0], 'currency': self.pool.get('res.currency').edi_export(cr, uid, [invoice.currency_id], context=context)[0], 'partner_ref': invoice.reference or False, @@ -125,7 +125,6 @@ class account_invoice(osv.osv, EDIMixin): # the desired company among the user's allowed companies self._edi_requires_attributes(('company_id','company_address','type'), edi_document) - res_partner_address = self.pool.get('res.partner.address') res_partner = self.pool.get('res.partner') # imported company = new partner @@ -144,13 +143,13 @@ class account_invoice(osv.osv, EDIMixin): address_info = edi_document.pop('company_address') address_info['partner_id'] = (src_company_id, src_company_name) address_info['type'] = 'invoice' - address_id = res_partner_address.edi_import(cr, uid, address_info, context=context) + address_id = res_partner.edi_import(cr, uid, address_info, context=context) # modify edi_document to refer to new partner - partner_address = res_partner_address.browse(cr, uid, address_id, context=context) + partner_address = res_partner.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['address_invoice_id'] = self.edi_m2o(cr, uid, partner_address, context=context) + #edi_document['address_contact_id'] = self.edi_m2o(cr, uid, partner_address, context=context) return partner_id diff --git a/addons/account/edi/invoice_action_data.xml b/addons/account/edi/invoice_action_data.xml index 0904ec6fd54..a7bf89b6c26 100644 --- a/addons/account/edi/invoice_action_data.xml +++ b/addons/account/edi/invoice_action_data.xml @@ -40,13 +40,13 @@ <field name="name">Automated Invoice Notification Mail</field> <field name="email_from">${object.user_id.user_email or object.company_id.email or 'noreply@localhost'}</field> <field name="subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a' })</field> - <field name="email_to">${object.address_invoice_id.email or ''}</field> + <field name="email_to">${object.address_contact_id.email or ''}</field> <field name="model_id" ref="account.model_account_invoice"/> <field name="auto_delete" eval="True"/> <field name="body_html"><![CDATA[ <div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: rgb(255, 255, 255); "> - <p>Hello${object.address_invoice_id.name and ' ' or ''}${object.address_invoice_id.name or ''},</p> + <p>Hello${object.address_contact_id.name and ' ' or ''}${object.address_contact_id.name or ''},</p> <p>A new invoice is available for ${object.partner_id.name}: </p> @@ -124,7 +124,7 @@ </div> ]]></field> <field name="body_text"><![CDATA[ -Hello${object.address_invoice_id.name and ' ' or ''}${object.address_invoice_id.name or ''}, +Hello${object.address_contact_id.name and ' ' or ''}${object.address_contact_id.name or ''}, A new invoice is available for ${object.partner_id.name}: | Invoice number: *${object.number}* diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py index 839c9b13043..2fbe641dba3 100644 --- a/addons/account/report/account_invoice_report.py +++ b/addons/account/report/account_invoice_report.py @@ -65,8 +65,6 @@ class account_invoice_report(osv.osv): ('cancel','Cancelled') ], 'Invoice State', readonly=True), 'date_due': fields.date('Due Date', readonly=True), - 'address_contact_id': fields.many2one('res.partner.address', 'Contact Address Name', readonly=True), - 'address_invoice_id': fields.many2one('res.partner.address', 'Invoice Address Name', readonly=True), 'account_id': fields.many2one('account.account', 'Account',readonly=True), 'account_line_id': fields.many2one('account.account', 'Account Line',readonly=True), 'partner_bank_id': fields.many2one('res.partner.bank', 'Bank Account',readonly=True), @@ -103,8 +101,6 @@ class account_invoice_report(osv.osv): ai.state, pt.categ_id, ai.date_due as date_due, - ai.address_contact_id as address_contact_id, - ai.address_invoice_id as address_invoice_id, ai.account_id as account_id, ail.account_id as account_line_id, ai.partner_bank_id as partner_bank_id, @@ -186,8 +182,6 @@ class account_invoice_report(osv.osv): ai.state, pt.categ_id, ai.date_due, - ai.address_contact_id, - ai.address_invoice_id, ai.account_id, ail.account_id, ai.partner_bank_id, diff --git a/addons/account/report/account_invoice_report_view.xml b/addons/account/report/account_invoice_report_view.xml index cd43f416fce..6e5f83a83d1 100644 --- a/addons/account/report/account_invoice_report_view.xml +++ b/addons/account/report/account_invoice_report_view.xml @@ -22,8 +22,6 @@ <field name="period_id" invisible="1"/> <field name="currency_id" invisible="1"/> <field name="journal_id" invisible="1"/> - <field name="address_contact_id" invisible="1"/> - <field name="address_invoice_id" invisible="1"/> <field name="partner_bank_id" invisible="1"/> <field name="date_due" invisible="1"/> <field name="account_id" invisible="1"/> diff --git a/addons/account/report/account_print_invoice.rml b/addons/account/report/account_print_invoice.rml index 36228942a31..8aa6d785d08 100644 --- a/addons/account/report/account_print_invoice.rml +++ b/addons/account/report/account_print_invoice.rml @@ -162,12 +162,12 @@ </td> <td> <para style="terp_default_8">[[ (o.partner_id and o.partner_id.title and o.partner_id.title.name) or '' ]] [[ (o.partner_id and o.partner_id.name) or '' ]]</para> - <para style="terp_default_8">[[ display_address(o.address_invoice_id) ]]</para> + <para style="terp_default_8">[[ display_address(o.partner_id) ]]</para> <para style="terp_default_8"> <font color="white"> </font> </para> - <para style="terp_default_8">Tel. : [[ (o.address_invoice_id and o.address_invoice_id.phone) or removeParentNode('para') ]]</para> - <para style="terp_default_8">Fax : [[ (o.address_invoice_id and o.address_invoice_id.fax) or removeParentNode('para') ]]</para> + <para style="terp_default_8">Tel. : [[ (o.partner_id and o.partner_id.phone) or removeParentNode('para') ]]</para> + <para style="terp_default_8">Fax : [[ (o.partner_id and o.partner_id.fax) or removeParentNode('para') ]]</para> <para style="terp_default_8">VAT : [[ (o.partner_id and o.partner_id.vat) or removeParentNode('para') ]]</para> </td> </tr> @@ -210,7 +210,7 @@ <para style="terp_default_Centre_9">[[ o.origin or '' ]]</para> </td> <td> - <para style="terp_default_Centre_9">[[ (o.address_invoice_id and o.address_invoice_id.partner_id and o.address_invoice_id.partner_id.ref) or ' ' ]]</para> + <para style="terp_default_Centre_9">[[ (o.partner_id and o.partner_id.ref) or ' ' ]]</para> </td> </tr> </blockTable> diff --git a/addons/account/report/account_print_overdue.py b/addons/account/report/account_print_overdue.py index 0a03801d409..82e6abf7b63 100644 --- a/addons/account/report/account_print_overdue.py +++ b/addons/account/report/account_print_overdue.py @@ -38,7 +38,6 @@ class Overdue(report_sxw.rml_parse): def _adr_get(self, partner, type): res = [] res_partner = pooler.get_pool(self.cr.dbname).get('res.partner') - res_partner_address = pooler.get_pool(self.cr.dbname).get('res.partner.address') addresses = res_partner.address_get(self.cr, self.uid, [partner.id], [type]) adr_id = addresses and addresses[type] or False result = { @@ -51,7 +50,7 @@ class Overdue(report_sxw.rml_parse): 'country_id': False, } if adr_id: - result = res_partner_address.read(self.cr, self.uid, [adr_id], context=self.context.copy()) + result = res_partner.read(self.cr, self.uid, [adr_id], context=self.context.copy()) result[0]['country_id'] = result[0]['country_id'] and result[0]['country_id'][1] or False result[0]['state_id'] = result[0]['state_id'] and result[0]['state_id'][1] or False return result @@ -62,7 +61,6 @@ class Overdue(report_sxw.rml_parse): def _tel_get(self,partner): if not partner: return False - res_partner_address = pooler.get_pool(self.cr.dbname).get('res.partner.address') res_partner = pooler.get_pool(self.cr.dbname).get('res.partner') addresses = res_partner.address_get(self.cr, self.uid, [partner.id], ['invoice']) adr_id = addresses and addresses['invoice'] or False diff --git a/addons/account/test/account_change_currency.yml b/addons/account/test/account_change_currency.yml index 5ec7405d719..dbbe3d5f676 100644 --- a/addons/account/test/account_change_currency.yml +++ b/addons/account/test/account_change_currency.yml @@ -3,8 +3,6 @@ - !record {model: account.invoice, id: account_invoice_currency}: account_id: account.a_recv - address_contact_id: base.res_partner_address_3000 - address_invoice_id: base.res_partner_address_3000 company_id: base.main_company currency_id: base.EUR invoice_line: diff --git a/addons/account/test/account_invoice_state.yml b/addons/account/test/account_invoice_state.yml index b9818b71d2f..0825c3d2433 100644 --- a/addons/account/test/account_invoice_state.yml +++ b/addons/account/test/account_invoice_state.yml @@ -3,8 +3,6 @@ - !record {model: account.invoice, id: account_invoice_state}: account_id: account.a_recv - address_contact_id: base.res_partner_address_3000 - address_invoice_id: base.res_partner_address_3000 company_id: base.main_company currency_id: base.EUR invoice_line: diff --git a/addons/account/test/account_report.yml b/addons/account/test/account_report.yml index 6a4d04daa70..7ce1843bfa3 100644 --- a/addons/account/test/account_report.yml +++ b/addons/account/test/account_report.yml @@ -4,13 +4,11 @@ !record {model: account.invoice, id: test_invoice_1}: currency_id: base.EUR company_id: base.main_company - address_invoice_id: base.res_partner_address_tang partner_id: base.res_partner_asus state: draft type: out_invoice account_id: account.a_recv name: Test invoice 1 - address_contact_id: base.res_partner_address_tang - In order to test the PDF reports defined on an invoice, we will print an Invoice Report - diff --git a/addons/account/test/account_sequence_test.yml b/addons/account/test/account_sequence_test.yml index 4748175c118..12146aeac97 100644 --- a/addons/account/test/account_sequence_test.yml +++ b/addons/account/test/account_sequence_test.yml @@ -16,8 +16,6 @@ - I create a draft customer invoice in a period of the demo fiscal year - !record {model: account.invoice, id: invoice_seq_test}: account_id: account.a_recv - address_contact_id: base.res_partner_address_zen - address_invoice_id: base.res_partner_address_zen company_id: base.main_company currency_id: base.EUR invoice_line: diff --git a/addons/account/test/account_supplier_invoice.yml b/addons/account/test/account_supplier_invoice.yml index 3683a3e44c9..a8898bc9764 100644 --- a/addons/account/test/account_supplier_invoice.yml +++ b/addons/account/test/account_supplier_invoice.yml @@ -23,8 +23,6 @@ - !record {model: account.invoice, id: account_invoice_supplier0}: account_id: account.a_pay - address_contact_id: base.res_partner_address_3000 - address_invoice_id: base.res_partner_address_3000 check_total: 3000.0 company_id: base.main_company currency_id: base.EUR diff --git a/addons/account/test/price_accuracy00.yml b/addons/account/test/price_accuracy00.yml index 135dcf1ec60..639b39b6c25 100644 --- a/addons/account/test/price_accuracy00.yml +++ b/addons/account/test/price_accuracy00.yml @@ -21,7 +21,6 @@ name: Precision Test type: out_invoice partner_id: base.res_partner_2 - address_invoice_id: base.res_partner_address_1 account_id: account.a_recv date_invoice: !eval time.strftime('%Y-%m-%d') invoice_line: diff --git a/addons/account/test/test_edi_invoice.yml b/addons/account/test/test_edi_invoice.yml index e2c0f21e7da..b8a4d8d4ef8 100644 --- a/addons/account/test/test_edi_invoice.yml +++ b/addons/account/test/test_edi_invoice.yml @@ -7,7 +7,6 @@ journal_id: 1 partner_id: base.res_partner_agrolait currency_id: base.EUR - address_invoice_id: base.res_partner_address_8invoice company_id: 1 account_id: account.a_pay date_invoice: !eval "'%s' % (time.strftime('%Y-%m-%d'))" @@ -58,7 +57,7 @@ "company_address": { "__id": "base:b22acf7a-ddcd-11e0-a4db-701a04e25543.main_address", "__module": "base", - "__model": "res.partner.address", + "__model": "res.partner", "city": "Gerompont", "zip": "1367", "country_id": ["base:b22acf7a-ddcd-11e0-a4db-701a04e25543.be", "Belgium"], @@ -80,7 +79,7 @@ "partner_address": { "__id": "base:5af1272e-dd26-11e0-b65e-701a04e25543.res_partner_address_7wdsjasdjh", "__module": "base", - "__model": "res.partner.address", + "__model": "res.partner", "phone": "(+32).81.81.37.00", "street": "Chaussee de Namur 40", "city": "Gerompont", diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py index ec74320e135..c425b5e85b7 100644 --- a/addons/account/wizard/account_invoice_refund.py +++ b/addons/account/wizard/account_invoice_refund.py @@ -176,7 +176,7 @@ class account_invoice_refund(osv.osv_memory): invoice = inv_obj.read(cr, uid, [inv.id], ['name', 'type', 'number', 'reference', 'comment', 'date_due', 'partner_id', - 'address_contact_id', 'address_invoice_id', + 'address_contact_id', 'partner_insite', 'partner_contact', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', @@ -197,7 +197,7 @@ class account_invoice_refund(osv.osv_memory): 'period_id': period, 'name': description }) - for field in ('address_contact_id', 'address_invoice_id', 'partner_id', + for field in ('address_contact_id', 'partner_id', 'account_id', 'currency_id', 'payment_term', 'journal_id'): invoice[field] = invoice[field] and invoice[field][0] inv_id = inv_obj.create(cr, uid, invoice, {}) |
