This question has been flagged
1 Reply
1795 Views


I need to set the default invoice sequence number to a custom format any time there is a fresh install. This needs to be done automatically in code.


This is easy to do for something like a sale order. Here's how I can do it with a sale order:


<data noupdate="1">
<record id="sequence_sale_order_number_wwi" model="ir.sequence">
<field name="name">Sale Order Numbersfield>
<field name="code">sale.orderfield>
<field name="prefix">WO-field>
<field name="padding">4field>
<field name="number_increment">1field>
<field name="company_id">1field>
record>
data>



How do I accomplish the same thing for invoice sequence numbers (Odoo 14 or 15)?

Avatar
Discard
Author

Unfortunately, that module doesn't answer the question. This invoice sequence needs to be set automatically with no manual intervention on a fresh install. So it needs to be done in code.

Best Answer

Dear Drew E,

please try this for give sequence for the invoice.


odoo
data noupdate="1"
record id="seq_account_move" model="ir.sequence"
field name="name">invoice field name="code">account.move field name="prefix">INV field name="padding">5 field name="company_id" eval="False"/
/record
/data
/odoo


I hope this information will helpful to you.


Feel free for further assistance on contact@geminatecs.com

Thank you
Geminate Consultancy Services

Avatar
Discard

<odoo>
<data noupdate="1">
<record id="seq_account_move" model="ir.sequence">
<field name="name">invoice</field>
<field name="code">account.move</field>
<field name="prefix">INV</field>
<field name="padding">5</field>
<field name="company_id" eval="False"/>
</record>
</data>
</odoo>

Author

Thank you, but that doesn't appear to have worked. I've verified that the same method works for sale.order and res.partner, but does not work for account.move. That method may have worked in odoo 13 but does not work in odoo 14 and above.

thats strange, we have tested the code at our end, may be you can pass on your module on contact@geminatecs.com for further resolution. thanks.