我想通过打开设置->公司->货币来更改公司货币。但是当我已经更改货币并点击“保存”按钮时,我收到此警告对话框
您无法更改公司的货币,因为某些日记帐项目已经存在
如何解决这个问题?
您无法更改公司的货币,因为某些日记帐项目已经存在
#forbid the change of currency_id if there are already some accounting entries existing
if 'currency_id' in values and values['currency_id'] != company.currency_id.id:
if self.env['account.move.line'].search([('company_id', '=', company.id)]):
raise UserError(_('You cannot change the currency of the company since some journal items already exist'))
update account_journal set company_id = temp_company_id;
update account_move set company_id = temp_company_id;
update account_move_line set company_id = temp_company_id;
之后您可以更改公司的货币。
最后您可以返回到修改后的寄存器的“company_id”的先前值。