From 96855c19618c50ec169d82f4d5ccb3210b6c4445 Mon Sep 17 00:00:00 2001 From: "Rucha (Open ERP)" Date: Mon, 23 Jul 2012 12:39:09 +0530 Subject: [PATCH] [IMP,ADD,REM]: base: Removed demo of partner address from xml file and moved it to new yml file because we want to use functionality of use_parent_address and need address of company in contact automatically. This is not being fulfilled when we create record from xml. onchange of use_parent_address is called only if we create record from yml (advantage of using yml, lack in xml) * Also removed improvement done in py file to get address of company in contact in create bzr revid: rpa@tinyerp.com-20120723070909-0tl87r9kb5aahu1w --- openerp/addons/base/__openerp__.py | 1 + openerp/addons/base/res/res_partner.py | 10 +- openerp/addons/base/res/res_partner_demo.xml | 295 ------------------- openerp/addons/base/res/res_partner_demo.yml | 246 ++++++++++++++++ 4 files changed, 250 insertions(+), 302 deletions(-) create mode 100644 openerp/addons/base/res/res_partner_demo.yml diff --git a/openerp/addons/base/__openerp__.py b/openerp/addons/base/__openerp__.py index 31e237a6a06..ea7dc9a879b 100644 --- a/openerp/addons/base/__openerp__.py +++ b/openerp/addons/base/__openerp__.py @@ -79,6 +79,7 @@ 'demo_xml': [ 'base_demo.xml', 'res/res_partner_demo.xml', + 'res/res_partner_demo.yml', 'res/res_widget_demo.xml', ], 'test': [ diff --git a/openerp/addons/base/res/res_partner.py b/openerp/addons/base/res/res_partner.py index bb3245f66f4..3f287b3bef5 100644 --- a/openerp/addons/base/res/res_partner.py +++ b/openerp/addons/base/res/res_partner.py @@ -276,13 +276,9 @@ class res_partner(osv.osv): context={} # Update parent and siblings records if vals.get('parent_id') and vals.get('use_parent_address'): - # [RPA] why we need to change the siblings? - # we are creating a child of parent and it should not affect parent and siblings - # domain_siblings = [('parent_id', '=', vals['parent_id']), ('use_parent_address', '=', True)] - # update_ids = [vals['parent_id']] + self.search(cr, uid, domain_siblings, context=context) - # [RPA] the vals we pass in update_address is not of parent so it will do nothing - # self.update_address(cr, uid, update_ids, vals, context) - vals.update(self.get_parent_address(cr, uid, vals['parent_id'], address_fields=ADDRESS_FIELDS, context=context)) + domain_siblings = [('parent_id', '=', vals['parent_id']), ('use_parent_address', '=', True)] + update_ids = [vals['parent_id']] + self.search(cr, uid, domain_siblings, context=context) + self.update_address(cr, uid, update_ids, vals, context) if 'photo' not in vals : vals['photo'] = self._get_photo(cr, uid, vals.get('is_company', False) or context.get('default_is_company'), context) return super(res_partner,self).create(cr, uid, vals, context=context) diff --git a/openerp/addons/base/res/res_partner_demo.xml b/openerp/addons/base/res/res_partner_demo.xml index 0d45f9b2c4a..91ea408cbf3 100644 --- a/openerp/addons/base/res/res_partner_demo.xml +++ b/openerp/addons/base/res/res_partner_demo.xml @@ -401,301 +401,6 @@ www.vicking-direct.com - - - - Mark Davis - - - Chief Executive Officer (CEO) - - - - Roger Scott - - - Chief Operations Officer (COO) - - - - Tang Tsui - - 1 - - Service Manager - - - - - Joseph Walters - - 1 - - Store Manager - - - - - Thomas Passot - - - Functional Consultant - - - - - Michel Fletcher - - - Analyst - - - - Chao Wang - - 1 - - Marketing Manager - - - - - Zhi Ch'ang - - 1 - - - Supervisor - - - - Richard Ellis - - 1 - - Production Supervisor - - - - Paul Williams - - 1 - - Line Mechanic - - - - Brian Williams - - 1 - - Computer Technician - - - - David Simpson - - - Senior Consultant - - - - John M. Brown - - - Director - - - - default - James Miller - - 1 - - - Electrical Supervisor - - - - Charlie Bernard - - - Senior Associate - - - - Jessica Dupont - - - Analyst - - - - default - Phillipp Miller - - 1 - - - Creative Director - - - - default - Ayaan Agarwal - - - - Director - - - - Daniel Jackson - - - Managing Partner - - - - William Thomas - - - - Senior Consultant - - - - default - Sergio Pérez - - - Accountant - - - - Laura Castro - - - Goods Supervisor - - - - Luc Maurer - - 1 - - Director - - - - Laith Jubair - - 1 - - Director - - - - Angel Cook - - - General Manager - - - - Robert Anderson - - - System Analyst - - - - Jacob Taylor - - - - Order Clerk - - - - Arthur Gomez - - 1 - - - Software Developer - - - - Julia Rivero - - 1 - - - Technical Director - - - - Benjamin Flores - - - - Business Executive - - - - George Wilson - - - Chief Information Officer (CIO) - - - - Lucas Jones - - - Functional Consultant - - - - Edward Foster - - 1 - - Sales Representative - - - - Robin Smith - - - Sales Manager - - - - Morgan Rose - - - Financial Manager - - - - Kevin Clarke - - - Knowledge Manager - - - - Peter Mitchell - - 1 - - Store Manager - - diff --git a/openerp/addons/base/res/res_partner_demo.yml b/openerp/addons/base/res/res_partner_demo.yml new file mode 100644 index 00000000000..28f488dff33 --- /dev/null +++ b/openerp/addons/base/res/res_partner_demo.yml @@ -0,0 +1,246 @@ +- + !record {model: 'res.partner', id: base.res_partner_address_1}: + name: Tang Tsui + parent_id: base.res_partner_1 + use_parent_address: True + function: Service Manager + category_id: + - base.res_partner_category_17 +- + !record {model: 'res.partner', id: base.res_partner_address_2}: + name: Joseph Walters + parent_id: base.res_partner_1 + use_parent_address: True + function: Store Manager + category_id: + - base.res_partner_category_21 +- + !record {model: 'res.partner', id: base.res_partner_address_3}: + name: Thomas Passot + parent_id: base.res_partner_2 + use_parent_address: True + function: Functional Consultant + category_id: + - base.res_partner_category_22 +- + !record {model: 'res.partner', id: base.res_partner_address_4}: + name: Michel Fletcher + parent_id: base.res_partner_2 + use_parent_address: True + function: Analyst +- + !record {model: 'res.partner', id: base.res_partner_address_5}: + name: Chao Wang + parent_id: base.res_partner_3 + use_parent_address: True + function: Marketing Manager + category_id: + - base.res_partner_category_23 +- + !record {model: 'res.partner', id: base.res_partner_address_6}: + name: Zhi Ch'ang + parent_id: base.res_partner_3 + use_parent_address: True + function: Supervisor +- + !record {model: 'res.partner', id: base.res_partner_address_7}: + name: Richard Ellis + parent_id: base.res_partner_4 + use_parent_address: True + function: Production Supervisor +- + !record {model: 'res.partner', id: base.res_partner_address_8}: + name: Paul Williams + parent_id: base.res_partner_4 + use_parent_address: True + function: Line Mechanic +- + !record {model: 'res.partner', id: base.res_partner_address_9}: + name: Brian Williams + parent_id: base.res_partner_4 + use_parent_address: True + function: Computer Technician +- + !record {model: 'res.partner', id: base.res_partner_address_10}: + name: David Simpson + parent_id: base.res_partner_5 + use_parent_address: True + function: Senior Consultant +- + !record {model: 'res.partner', id: base.res_partner_address_11}: + name: John M. Brown + parent_id: base.res_partner_5 + use_parent_address: True + function: Director +- + !record {model: 'res.partner', id: base.res_partner_address_12}: + name: James Miller + parent_id: base.res_partner_6 + use_parent_address: True + function: Electrical Supervisor + category_id: + - base.res_partner_category_17 +- + !record {model: 'res.partner', id: base.res_partner_address_13}: + name: Charlie Bernard + parent_id: base.res_partner_7 + use_parent_address: True + function: Senior Associate +- + !record {model: 'res.partner', id: base.res_partner_address_14}: + name: Jessica Dupont + parent_id: base.res_partner_7 + use_parent_address: True + function: Analyst +- + !record {model: 'res.partner', id: base.res_partner_address_15}: + name: Phillipp Miller + parent_id: base.res_partner_8 + use_parent_address: True + function: Creative Director + category_id: + - base.res_partner_category_17 +- + !record {model: 'res.partner', id: base.res_partner_address_16}: + name: Ayaan Agarwal + parent_id: base.res_partner_9 + use_parent_address: True + function: Director + category_id: + - base.res_partner_category_17 +- + !record {model: 'res.partner', id: base.res_partner_address_17}: + name: Daniel Jackson + parent_id: base.res_partner_10 + use_parent_address: True + function: Managing Partner +- + !record {model: 'res.partner', id: base.res_partner_address_18}: + name: William Thomas + parent_id: base.res_partner_10 + use_parent_address: True + function: Senior Consultant + category_id: + - base.res_partner_category_22 +- + !record {model: 'res.partner', id: base.res_partner_address_19}: + name: Sergio Pérez + parent_id: base.res_partner_11 + use_parent_address: True + function: Accountant +- + !record {model: 'res.partner', id: base.res_partner_address_20}: + name: Laura Castro + parent_id: base.res_partner_11 + use_parent_address: True + function: Goods Supervisor +- + !record {model: 'res.partner', id: base.res_partner_address_21}: + name: Luc Maurer + parent_id: base.res_partner_12 + use_parent_address: True + function: Director +- + !record {model: 'res.partner', id: base.res_partner_address_22}: + name: Laith Jubair + parent_id: base.res_partner_13 + use_parent_address: True + function: Director +- + !record {model: 'res.partner', id: base.res_partner_address_23}: + name: Angel Cook + parent_id: base.res_partner_14 + use_parent_address: True + function: General Manager +- + !record {model: 'res.partner', id: base.res_partner_address_24}: + name: Robert Anderson + parent_id: base.res_partner_14 + use_parent_address: True + function: System Analyst +- + !record {model: 'res.partner', id: base.res_partner_address_25}: + name: Jacob Taylor + parent_id: base.res_partner_15 + use_parent_address: True + function: Order Clerk + category_id: + - base.res_partner_category_17 +- + !record {model: 'res.partner', id: base.res_partner_address_26}: + name: Arthur Gomez + parent_id: base.res_partner_16 + use_parent_address: True + function: Software Developer + category_id: + - base.res_partner_category_22 +- + !record {model: 'res.partner', id: base.res_partner_address_27}: + name: Julia Rivero + parent_id: base.res_partner_16 + use_parent_address: True + function: Technical Director + category_id: + - base.res_partner_category_17 +- + !record {model: 'res.partner', id: base.res_partner_address_28}: + name: Benjamin Flores + parent_id: base.res_partner_17 + use_parent_address: True + function: Business Executive + category_id: + - base.res_partner_category_17 +- + !record {model: 'res.partner', id: base.res_partner_address_29}: + name: George Wilson + parent_id: base.res_partner_18 + use_parent_address: True + function: Chief Information Officer (CIO) +- + !record {model: 'res.partner', id: base.res_partner_address_30}: + name: Lucas Jones + parent_id: base.res_partner_18 + use_parent_address: True + function: Functional Consultant +- + !record {model: 'res.partner', id: base.res_partner_address_31}: + name: Edward Foster + parent_id: base.res_partner_19 + use_parent_address: True + function: Sales Representative +- + !record {model: 'res.partner', id: base.res_partner_address_32}: + name: Robin Smith + parent_id: base.res_partner_21 + use_parent_address: True + function: Sales Manager +- + !record {model: 'res.partner', id: base.res_partner_address_33}: + name: Morgan Rose + parent_id: base.res_partner_21 + use_parent_address: True + function: Financial Manager +- + !record {model: 'res.partner', id: base.res_partner_address_34}: + name: Kevin Clarke + parent_id: base.res_partner_21 + use_parent_address: True + function: Knowledge Manager +- + !record {model: 'res.partner', id: base.res_partner_address_35}: + name: Peter Mitchell + parent_id: base.res_partner_22 + use_parent_address: True + function: Store Manager +- + !record {model: 'res.partner', id: base.res_partner_main1}: + name: Mark Davis + parent_id: base.main_partner + use_parent_address: True + function: Chief Executive Officer (CEO) +- + !record {model: 'res.partner', id: base.res_partner_main2}: + name: Roger Scott + parent_id: base.main_partner + use_parent_address: True + function: Chief Operations Officer (COO) \ No newline at end of file