I wanted to inherit the customer Address from and Models which are linked to the the customer form to the new module .
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I wanted to inherit the customer Address from and Models which are linked to the the customer form to the new module .
Hi Shararth,
1. If you want to have separate table in database for new customer then this would help you.
from odoo import fields, models, api
class ResPartner(models.Model)
_name = 'your.new.customer.model'
_inherit = 'res.partner'
#you can add some additional field if require, all the partner fields are now accessible to your model.
2. If you just want to fetch information in some existing field from existing partner record than you can go for the solution given by @Avinash. But make sure must be having browse record/record set of customer from which you want to pull the data.
If your question doesn't matches any above to case than please describe your question in more detail.
Happy Odooing...
Hope this will help you.
Rgds,
Anil.
Hello you can use below Code to Inherit the Base Customer Form.
And by using xpath you can Add Replace field in Existing View.
Here is some xpath attribute like,
position="attributes"
position="after"
position="before"
position="inside"
position="replace"<record id="view_partner" model="ir.ui.view">
<field name="name">view_partner</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='existing_field_name']" position="as_per_your_requirement">
<!--Entry of Your New Field-->
</xpath>
</field>
</record>
Hi,
If you want to get the details of a Customer(Record), No need to inherit the model.
You can get the Record details by the following code
customer_obj = self.env['res.partner'] |
customer_record is a RecordSet.
You can access any field in that record by
field_value = customer_record.FieldName
In your case: street = customer_record.street, city = customer_record.city etc
Thank you.
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
Feb 19
|
1969 | ||
|
3
Jul 18
|
2604 | ||
|
1
Mar 15
|
3026 | ||
|
1
Aug 24
|
272 | ||
|
1
Aug 23
|
5072 |