class sale_customer(models.Model):
_inherit='res.partner'
pan_number=fields.Char(string='PAN Number')
vat_number = fields.Char(string='VAT Number')
class sales_ext_invoice(models.Model):
_inherit = 'account.invoice'
sno = fields.Char(index=True,string='S.O No.')
payment_type = fields.Selection(
[('not_started', '--Select Payment Type--'), ('cash', 'Cash'), ('cheque', 'Cheque'), ('credit', 'Credit'),
('others', 'Others')], default='not_started')
vehicle_no = fields.Char(string='Vehicle No')
pan_num=fields.Char(string="PAN Number",related='partner_id.pan_number', store=True,)
created_by = fields.Many2one('hr.employee', string='Bill Prepared By')
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Boekhouding
- Voorraad
- PoS
- Project
- MRP
Deze vraag is gerapporteerd
It's very simple, if you use a related field you need to append the modul in the manifest file, where the related field is coming from.
example:
you related order_id from module 'sale', just add 'sale' as depends in your module manifest file.
It works...!!
After searching the code of Odoo10 for field = target._fields[name] I noticed that there is only one occurence. It is in the odoo/fields.py file in the method _setup_related_full.
Now that we know this, we can safely say that the problem is with your related field.
Are you sure that the field pan_number was successfully created? (Quick test if you have sql access: SELECT pan_number FROM res_partner LIMIT 1;)
If column not found: Restart server, try to update your module, if installing/updating is the action that is throwing the error, comment the pan_num field in account.invoice, your module should install/update properly, now the field pan_number should be in db; You can test this again with the previous SQL-query.
Uncomment the related field, restart server, update module.
If the column was found we will probably need some more info as to what you were trying to do/achieve.
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
AanmeldenGerelateerde posts | Antwoorden | Weergaven | Activiteit | |
---|---|---|---|---|
|
2
jul. 25
|
4660 | ||
|
2
dec. 24
|
7789 | ||
How to ORDER BY? [Odoo 10]
Opgelost
|
|
2
nov. 24
|
28567 | |
|
2
mei 24
|
7505 | ||
|
3
mrt. 24
|
6926 |
Please describe your problem a little more. Does this keyerror happen on installing the module? Or when uninstalling? Or only when you access a model? Can you also post the full stacktrace?