콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
5256 화면

i want to check the value of jobsheet field with database. When i run my code it gives syntax errors

self._cr.execute("""


CREATE OR REPLACE VIEW jobsheet_overview AS (

SELECT

row_number() over (ORDER BY move.name) AS id,

move.name as product,

move.product_uom_qty as quantity,

pick.id as picking_id

from stock_move move,stock_picking pick where move.picking_id = pick.id and pick.jobsheet_no=%s)""",(self.jobsheet))

it says "%s" syntax is not correct 

아바타
취소
베스트 답변

Hi Mike

in that last you should pass value as %(self.jobsheet) below i corrected

self._cr.execute("""


CREATE OR REPLACE VIEW jobsheet_overview AS (

SELECT

row_number() over (ORDER BY move.name) AS id,

move.name as product,

move.product_uom_qty as quantity,

pick.id as picking_id

from stock_move move,stock_picking pick where move.picking_id = pick.id and pick.jobsheet_no=%s)""" %(self.jobsheet))

아바타
취소
베스트 답변

Try this one

self._cr.execute("""
CREATE OR REPLACE VIEW jobsheet_overview AS (
SELECT
row_number() over (ORDER BY move.name) AS id,
move.name as product,
move.product_uom_qty as quantity,
pick.id as picking_id
from stock_move move,stock_picking pick where move.picking_id = pick.id and pick.jobsheet_no="""+str(self.jobsheet)+""")
"""


아바타
취소