- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有这个方法:
@api.multi
@api.depends('order_picking', 'order_picking.isbn', 'contract_worksheet', 'state')
def accounting_scenarios(self):
for record in self:
if not len(record.transporter):
raise Warning('Please Enter Transporter !')
elif not len(record.transporter.transp_transit):
raise Warning('Please assign transit account to the transporter !')
if record.state in ('awaitingraw'): #('cancel', 'done')
record.temp = record.contract_worksheet.total_alles - record.contract_worksheet.total_totals
acc_move = self.env['account.move']
move_lines = [
(0, 0, {
'name': 'name', # a label so accountant can understand where this line come from
'debit': record.temp or 0.0, # amount of debit
'credit': 0, # amount of credit
'account_id': record.transporter.transp_transit,
'date': date,
'partner_id': record.transporter,
#'currency_id': currency_id or (account.currency_id.id or False),
}),
]
journal_id = False
if record.transporter.transp_transit:
journals = self.env['account.journal'].search([
('default_debit_account_id', '=', record.transporter.transp_transit.id)
])
if journals:
journal_id = journals[0].id
acc_move.create({
#'period_id': period_id, #Fiscal period
'journal_id': journal_id,
'date': fields.Date.today(),
'state': 'draft',
'line_id': move_lines,
})
elif record.state in ('work_in_progress'):
record.temp2 = record.contract_worksheet.total_totals
elif record.state in ('delivered'):
record.transporter.transp_transit.debit = record.contract_worksheet.total_alles
我已经意识到借方
和贷方
字段存在问题,问题是日记帐没有该帐户(transp_transit
)作为默认借方或贷方帐户。
无论如何,现在它似乎正在尝试执行 account.move
但它向我抛出了这个:
2017-12-14 00:44:34,438 2736 INFO hasta_cuandooo_def werkzeug: 127.0.0.1 - -
[14/Dec/2017 00:44:34] "POST /web/dataset/call_button HTTP/1.1" 200 -
2017-12-14 00:44:38,177 2736 ERROR hasta_cuandooo_def openerp.sql_db:
Programming error: can't adapt type 'account.account', in query SELECT
"account_account"."id","account_account"."active" FROM "account_account"
WHERE "account_account".id IN %s ORDER BY "account_account"."parent_left"
2017-12-14 00:44:38,177 2736 ERROR hasta_cuandooo_def openerp.http: Exception during JSON request handling.
Traceback (most recent call last):
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\http.py", line 546, in _handle_exception
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\http.py", line 583, in dispatch
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\http.py", line 319, in _call_function
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\service\model.py", line 118, in wrapper
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\http.py", line 316, in checked_call
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\http.py", line 812, in __call__
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\http.py", line 412, in response_wrap
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\openerp\addons\web\controllers\main.py", line 948, in call_button
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\openerp\addons\web\controllers\main.py", line 936, in _call_kw
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 268, in wrapper
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 399, in old_api
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\openerp\addons\bsi\models\models.py", line 1472, in check_quantity
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 266, in wrapper
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\openerp\addons\bsi\models\models.py", line 1400, in write
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 266, in wrapper
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 3789, in write
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 266, in wrapper
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 592, in new_api
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 4048, in _write
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 266, in wrapper
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 5773, in recompute
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 5773, in <dictcomp>
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 5654, in __getitem__
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\fields.py", line 835, in __get__
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\fields.py", line 913, in determine_value
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\fields.py", line 893, in compute_value
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\fields.py", line 885, in _compute_value
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 266, in wrapper
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\openerp\addons\bsi\models\models.py", line 1390, in accounting_scenarios
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 266, in wrapper
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 508, in new_api
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\openerp\addons\account\account.py", line 1388, in create
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 268, in wrapper
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 372, in old_api
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 4101, in create
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 266, in wrapper
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 508, in new_api
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 4292, in _create
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\osv\fields.py", line 799, in set
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 268, in wrapper
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\openerp\addons\account\account_move_line.py", line 1276, in create
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 268, in wrapper
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 3148, in read
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 266, in wrapper
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 3183, in read
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\api.py", line 266, in wrapper
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\models.py", line 3312, in _read_from_database
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\sql_db.py", line 171, in wrapper
File "C:\Program Files (x86)\Odoo 8.0-20170914\server\.\openerp\sql_db.py", line 247, in execute
File "psycopg2\extensions.pyc", line 129, in getquoted
ProgrammingError: can't adapt type 'account.account'
有什么想法吗?
编辑
我的类(class)有这个字段:
transporter = fields.Many2one('res.partner', string="Transporter", domain="[('type_of_supplier','=','transporter')]")
在res.partner
(传输器)上:
transp_transit = fields.Many2one('account.account', string='Transporter Transit Account')
最佳答案
当您传递值来创建或写入时,请确保您不会为 Many2one 字段传递对象并传递 id
'partner_id': record.transporter.id
关于python - 编程错误: can't adapt type 'account.account' - Odoo v8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47804100/
我正在制作一个 android 应用程序,它允许用户在 editText 中输入关键字,当他们点击提交时,下面的 recyclerview 将显示来自 API 请求的结果。 我的 recyclerVi
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
我想在我的 Svelte Kit 应用程序中使用 @sveltejs/adapter-static(想把它变成一个 SPA)。 我使用 npm i @sveltejs/adapter-static 安
我有一个简单的表单,在提交重定向到 AuthController 内的 processAction 之后,在这个 action 中我想要创建一个简单的 table bar。 已编辑: 引用Zend f
当我使用 ListView 时,我扩展了 ArrayAdapter 并将数据(一个列表)存储在 ArrayAdapter 中,因此当数据更改时,我调用: adapter.add(item).; 还有另
我有一个使用 Webpack 捆绑的 commonjs 浏览器应用程序( typescript )。它使用 webrtc,所以我想使用 webrtc-adapter package from npm
在 “DesignPatterns: Elements of Reusable Object-Oriented Software” 一书中谈到 C++ 实现 Adapter 模式时,它是这样的这个:
只需要帮助理解 ZF2 中的一些简单数据库查询。在 ZF1 中,我有这样简单的方法: public function recordset() { // listing of all records $
当使用Spring的Java配置时,你一定会看到像WebMvcConfigurerAdapter这样的类& HandlerInterceptorAdapter它们实现单个接口(interface),并
我将 doctrine2 与 ZF2 一起使用,我的一些库与 Zend\Db\Adapter\Adapter 一起使用,其他的与 doctrine2 一起使用。现在,他们两次连接到数据库。是否可以在原
过去几天我一直在工作灯上工作,现在正在尝试制作连接到数据库的应用程序。以下是截图: 1) Worklight\server\conf\worklight.properties 2) mySQLAdap
几年前,我在 this tutorial 之后开始学习 Zend 框架。 .在那里,它显示映射器是使用 Zend\Db\Adapter\Adapter 创建的。类来获取数据库连接,这就是我使用数据库的
我正在学习 RecyclerView 并在 developer 中的站点 Adapter 类扩展 RecyclerView.Adapter 。实现显示: public class MyAdapter
查看文档:http://docs.spring.io/spring-integration/reference/html/ip.html#tcp-adapters我知道适配器仅用于单向通信。但是,这里
当我移动到另一个 fragment 时,我如何恢复分页适配器项状态?我试过下面的文章,但没有用。 https://medium.com/@florina.muntenescu private fun
我正在使用 capistrano 并收到此错误消息: Please install the pg adapter: `gem install activerecord-pg-adapter` (can
我正在尝试在本地主机上安装 Magento 2,当我想连接数据库时出现错误。 错误是: “Magento\Framework\DB\Adapter\Pdo\MysqlFactory”生成的源类“\Ma
我的 Rails 服务器通过正常的开发脚本运行良好,我计划使用 Netbeans for Rails。当我使用 Netbeans 启动我现有的项目并重新启动我的 Webrick 服务器时,它显示错误
运行 Ruby on Rails (RoR) 应用程序或使用 ActiveRecord 框架的 Ruby 代码,您会收到错误消息: Please install the postgresql adap
我在运行 Redmine2.3-stable 时遇到这个错误,随后无法成功安装 mysql2 适配器。 这是错误: Please install the mysql2 adapter: `ge
我是一名优秀的程序员,十分优秀!