python - openerp cutomer tree view -
here code module, have inherited res.partner table , added column partner_ref. need in myproject have show customer referred whom. , list of referred customer current customer.
here table definition:
from osv import fields, osv import logging _logger = logging.getlogger('realty') class cust_ref(osv.osv): _description = "reference" _inherit = 'res.partner' _columns = { 'partref_id' : fields.many2one('res.partner', 'referred by', required=false), } cust_ref()
and here xml code :
<?xml version="1.0"?> <insignierp> <data> <record id="partner_reference_ref_form" model="ir.ui.view"> <field name="name">realty.res.partner.form.inherit</field> <field name="model">res.partner</field> <field name="arch" type="xml"> <xpath expr="/form/notebook/page[@string='accounting']" position='after'> <page string='references'> </page> </xpath> </field> </record> </data> </insignierp>
now, in reference page need list in tree view, list of customers referred customer. know how implement this. guide me solve this. or suggestion , ideas helpful. all.
you have create field one2many list of partners, referenced partner. like:
'partref_id': fields.many2one('res.partner', 'related company'), 'ref_partner_ids': fields.one2many('res.partner', 'partref_id', 'refrence partner'),
and have show ref_partner_ids in view, partner reference 'partref_id' partner show in fields ref_partner_ids.
Comments
Post a Comment