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

I am trying to add a sequence number in purchase order line .But when i create  multiple purchase order with orderline  the sequence comes from the previous purchase order.line sequence number .Here is my code ...

eg: Now sequence come for first purchase order with line is 1,2,3 .If I create another purchase order then order line sequence comes like 4,5,6.I need new order line sequence starting from 1,2,3.This is my issue .Need a help....



class purchase_order_line(osv.osv):

  _inherit = 'purchase.order.line'

_columns={

'line_no':fields.char('Line No'),

}

_defaults = {

'line_no':lambda obj,cr,uid,context:obj.pool.get('ir.sequence').get(cr, uid, 'purchase.order.line'),

}

=======================sequence.xml file

<?xml version="1.0"?>

<openerp>

<data noupdate="1">

<record id="seq_type_purchase_order_line" model="ir.sequence.type">

<field name="name">Purchase Order Line</field>

<field name="code">purchase.order.line</field>

</record>

<record id="seq_purchase_order_line" model="ir.sequence">

<field name="name">Purchase Order Line</field>

<field name="code">purchase.order.line</field>

<field name="padding">1</field>

<field name="number_increment">1</field>

</record>

</data>

</openerp>

==================================view.xml file-------

<record model="ir.ui.view" id="order form">

<field name="name">order.line</field>

<field name="model">purchase.order</field>

<field name="inherit_id" ref="purchase.purchase_order_form" />

<field name="arch" type="xml">

<xpath expr="/form/sheet/notebook/page/field/tree/field[@name='name']" position="after">

<field name="pdt_country"/>

</xpath>

<xpath expr="/form/sheet/notebook/page/field/tree/field[@name='name']" position="before">

<field name="line_no"/>

<!-- <field name="sequence_no" on_change="onchange_line(sequence_no)"/> -->

</xpath>

</field>

</record>

아바타
취소
베스트 답변

Hello,

Due to constraint we cant repeat the sequence. You can try with other fields.

Thanks.

Shamji.

아바타
취소
작성자

Other field means? which field

작성자

Then How to change my code...

작성자

Can You Explain breifly...

베스트 답변

Reffer This Link add serial no in sale order line odoo 

아바타
취소