Odoo Hilfe

0

0
1 Answer
0
Spike Lee
21.06.17, 03:11

Here is a solution. I think you already solve this problem though.


I guess there's no way to inherit a exists sequence record.


You can write a new sequence.xml below:

<?xml version="1.0" encoding="utf-8"?>

<openerp>

    <data noupdate="1">


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

            <field name="name">Sales Order</field>

            <field name="code">new.sale.order</field>

            <field name="prefix">SO%(y)s</field>

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

            <field name="company_id" eval="False"/>

        </record>


    </data>

</openerp>

See this line: <field name="code">new.sale.order</field>

I set field's value to new.sale.order

You should set a name as you want.


And override a create method in sale.order

from openerp import api, models, _


class SaleOrder(models.Model):

    _inherit = 'sale.order'


    @api.model

    def create(self, vals):

        record = super(SaleOrder, self).create(vals)

        record['name'] = self.env['ir.sequence'].next_by_code('kinder.sale.order') or _('New')

        return record

See : record['name'] = self.env['ir.sequence'].next_by_code('kinder.sale.order') or _('New')

You can input sequence new.sale.order by using next_by_code method.

I think there is no way to inherit a sequence xml files.

Instead, you can override a create method.


Have a nice day!

Fragen Sie
Keep Informed
0 Verfolger
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now