I recently added a custom Char field called 'Report No' to the invoice lines in Odoo 15,
using the following code:
class AccountMoveLineInherited(models.Model):
_inherit = 'account.move.line'
report_no = fields.Char('Report No', required=True)
However, when I enter a new invoice line record and save it, the custom field often gets lost.
I'm not sure why this is happening and would appreciate any suggestions or solutions. Thank you.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
After encountering an issue where my custom Char field 'report_no' was getting lost when I saved new invoice line records in Odoo 15, I spent two hours troubleshooting the issue. Eventually, I discovered that the issue arose because the 'account.move' model contains two fields with the same relation to 'account.move.line', causing a conflict with my custom field. so I added the 'report_no' field in both one2many relation fields in the views
Regards
Hi,
Try with the field attribute “ store”.
Eg:
class AccountMoveLineInherited(models.Model):
_inherit = 'account.move.line'
report_no = fields.Char('Report No', required=True, store= True)
If this is not works, try with the force_save = 1 in XML
<field name=”report_no” force_save=”1”/>
Regards
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
1
kwi 23
|
3519 | ||
Learning Roadmap for developer
Rozwiązane
|
|
2
gru 24
|
6010 | |
|
2
cze 24
|
11258 | ||
|
0
maj 23
|
1460 | ||
|
1
wrz 22
|
3044 |