Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
2 Vastaukset
9569 Näkymät

First I was creating account and account assets from XML file but now scenario has changed and i'm creating account manually and assigning the category_id to invoices depends upon the total_months. It was working perfectly until I removed those two files (account.xml and account_asset.xml) from manifest. Now I'm stuck at it and don't know  how to tackle this.

__mainfest__.py


'data': [
'data/account_deferred_revenue_account.xml',
'data/account_deferred_revenue_account_asset.xml',

'security/deferred_revenue_security.xml',
'wizard/wizard_asset_compute_view.xml',
'report/account_deferred_revenue_report_view.xml',
'views/res_config_settings.xml',
'views/account_deferred_revenue.xml',
'views/account_deferred_revenue_invoice_view.xml',
'views/account_deferred_revenue_product_view.xml',
'views/res_config_settings_views.xml',
'views/account_invoice.xml',
]

When i commented the above bold lines i got the category_id error and server stopped responding. Any luck?
Avatar
Hylkää
Tekijä Paras vastaus

@niyas yes first I was giving category_id from code which are our xml files in data folder but now i'm manually creating the category_id in account.asset.category and referencing that category_id on basis of no. of Depreciations. here's my code

.py


@api.multi
def action_invoice_open(self):
res = super(AccountInvoice, self).action_invoice_open()
obj = self.env['account.asset.category'].search([('method_number', '=', self.total_months)], limit=1).id

if self.deferred_revenue == True:
self.env['account.asset.asset'].create({
'name' : self.name or 'kkkkk',
'category_id' : obj,
'date' : self.date,
'value' : self.amount_total,
'partner_id' : self.partner_id.id,
'invoice_id' : self.id,


})
return res
See the bold lines it all works fine if I don't comment those data files from manifest. but when i do i receive the error.
Avatar
Hylkää

Either you have provide the value for the required value or make it not required by giving required=False

Paras vastaus

Hi,

From the code you might be creating some records/data in database models from data files, and you might not have supplied value for the required field during the process, that is why you are getting this message.

So check the records that you are creating from the code and supply the value for the field category_id

Thanks

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
heinäk. 24
2530
1
kesäk. 24
5009
1
lokak. 23
10690
1
lokak. 23
98
1
elok. 23
2193