모듈 작업 중입니다. 단추가 있으면 다음 코드와 같이 해당 이름이 만듭니다. 내가이 버튼을 클릭 왜 단추를 클릭 할 때 명령을 삽입합니까? OpenERP
<button name="creates" string="Create" type="object" groups="base.group_erp_manager" />
def creates(self,cr,uid,ids,context=None):
for id in ids:
deg_obj=self.pool.get('deg.form').browse(cr,uid,id)
pr=int(deg_obj.categg_temp)
ctx=dict(context)
ctx.update({'default_pr':pr})
return{
'view_type': 'form',
'view_mode': 'form',
'res_model': 'product.product',
'context': ctx,
'type': 'ir.actions.act_window',
'target': 'current',
}
가 난 내 첫 번째 질문은
2014-12-31 08:18:40,566 7407 ERROR new_db openerp.sql_db: bad query: insert into "product_template" (id,"supply_method","list_price","standard_price","mes_type","uom_id","cost_method","categ_id","uos_coeff","sale_delay","procure_method","sale_ok","company_id","produce_delay","uom_po_id","rental","type",create_uid,create_date,write_uid,write_date) values (639,'buy','1.00','0.00','fixed',1,'standard','9','1.000',7.0,'make_to_stock','True',1,1.0,1,'False','consu',1,(now() at time zone 'UTC'),1,(now() at time zone 'UTC'))
Traceback (most recent call last):
File "/opt/openerp/server/openerp/sql_db.py", line 226, in execute
res = self._obj.execute(query, params)
IntegrityError: null value in column "name" violates not-null constraint
DETAIL: Failing row contains (639, 1, 2014-12-31 08:18:40.463017, 2014-12-31 08:18:40.463017, 1, null, null, 1.00, null, null, null, 0.00, fixed, 1, null, standard, 9, null, 1.000, null, t, null, null, 1, null, 1, 1, f, consu, null, null, 7, null, buy, make_to_stock).
2014-12-31 08:18:40,569 7407 ERROR new_db openerp.netsvc: Integrity Error
The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a record while other records still reference it
- creation/update: a mandatory field is not correctly set
[object with reference: name - name]
Traceback (most recent call last):
File "/opt/openerp/server/openerp/netsvc.py", line 296, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/opt/openerp/server/openerp/service/web_services.py", line 626, in dispatch
res = fn(db, uid, *params)
File "/opt/openerp/server/openerp/osv/osv.py", line 190, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/opt/openerp/server/openerp/osv/osv.py", line 174, in wrapper
netsvc.abort_response(1, _('Integrity Error'), 'warning', msg)
File "/opt/openerp/server/openerp/netsvc.py", line 71, in abort_response
raise openerp.osv.osv.except_osv(description, details)
except_osv: ('Integrity Error', 'The operation cannot be completed, probably due to the following:\n- deletion: you may be trying to delete a record while other records still reference it\n- creation/update: a mandatory field is not correctly set\n\n[object with reference: name - name]')
이다가 내 서버 로그에
Integrity Error
The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a record while other records still reference it
- creation/update: a mandatory field is not correctly set
[object with reference: name - name]
를 얻을.
creates
메서드와 관련된 삽입이 없어도 SQL 삽입 명령에 오류가 발생하는 이유는 무엇입니까? 단순히 값을 저장하기 위해 저장 버튼을 누르거나 저장 버튼을 누르는 형태로 열립니다. 둘째, 어떻게 이것을 우회하여 다음 단계로 이동하여 항목을 만들 수 있습니까?
참고 :보기 및 편집 모드에서 값을 열어주는 편집,보기 방법 및 단추도 있습니다. 그러나 그들에게도 똑같은 문제가 있습니다. 내가 언급해야
편집
한 가지. 나는 print "\n\n Inside Create Method"
을 creater 방법으로 사용하고 있습니다. 그것은 내 서버 콘솔/터미널에 표시되지 않습니다.
EDIT1 deg_form
는`내가 클래스에서이 _inherit='product.product'
이 일을 깨는 것을 확신 = 'product.product'
메서드 이름을 변경하려고 시도 했습니까? –
보기에는 만들기 버튼이 포함되어 있습니까? –
@PhucTran 나는 메서드 이름을 생성자에서 작성자로 변경했습니다. 같은 문제. –