This question has been flagged
2 Replies
5647 Views

Hi,

I Know how to create a new entry in ir_sequence, but if I set 'use_date_range' attribute as True, how can I fill the related table, ir_sequence_date_range, where the date range is:

I think something like:

<record id="sequence_fixation_date_range" model="ir.sequence.date_range">            
    <field name="date_from">2018/01/01</field>
    <field name="date_to">2018/12/31</field> 
    <field name="number_next">1</field>     
    <field name="sequency_id"> ???</field> <--- this, how to fill 
</record>


What I want to know is how to create the relation between ir_sequence and ir_sequence_date_range


Thank you







Avatar
Discard
Best Answer

Hi, a
you have two ways to do that: 

1- <field name="sequence_ideval="ref('Module_name.sequence_xml_id')"/>

OR:

2- from ir.sequence add your ir.sequence.date_range to your ir.sequence, like this : 

<field name="date_range_idseval="[(6,0,[ref('Module_name.sequence_xml_id')])]" />

thanks.

Avatar
Discard
Best Answer

Hello, try with below code

<record id="sequence_fixation_date_range" model="ir.sequence.date_range">            
    <field name="date_from">2018/01/01</field>
    <field name="date_to">2018/12/31</field> 
    <field name="number_next">1</field>     
    <field name="sequency_id"  ref="modulename.sequence_xml_id"/> <!-- xml id of ir.sequence record -->
</record>

Avatar
Discard