Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
762 Widoki

We'd like to change "S000x" when creating a quote to "Q000x" since Quote# would be a better way to represent that.

Is that a possibility?

Awatar
Odrzuć
Najlepsza odpowiedź

Hello Crystal,


For this one need to enable the debug mode.


Go to the Setting -->Technical --> Sequence and changes the prefix for sales order.


Thanks.


Awatar
Odrzuć
Najlepsza odpowiedź

Hello Crystal C,


1) You can use this app as it is or refer it's code: https://apps.odoo.com/apps/modules/16.0/sale_quotation_number


2) To change the sequence number of Quotation, Please find the below code to achieve.

   

    1. Create a Data folder in your moduel and inside the folder create and xml(quotation_sequnece_data.xml) file.

   

    //Code 1 in comment//

   

    2. Create a folder named models, inside the folder create __init__.py and sale_order.py

       Do not forget to import sale_order.py in __init__.py of folder models.

       

       after that add below code in sale_order.py

       

       //Code 2 in comment//


Hope this helps.

   

If you need any help in customization feel free to contact us.


Thanks & Regards,

Email:  odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari

Awatar
Odrzuć

Code 1:

<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- Sequence for sale orders in quotation state -->
<record id="seq_sale_order_quotation" model="ir.sequence">
<field name="name">Sale Order Quotation</field>
<field name="code">sale.order.quotation</field>
<field name="prefix">QU</field>
<field name="padding">5</field>
<field name="company_id" eval="False"/>
</record>
</odoo>

Code 2:

# -*- coding: utf-8 -*-

from odoo import api, fields, models

class SaleOrder(models.Model):
"""Inherit sale order for custom Sequence"""
_inherit = "sale.order"

@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if vals.get('state', 'draft') == 'draft':
vals['name'] = self.env['ir.sequence'].next_by_code('sale.order.quotation')
return super(SaleOrder, self).create(vals_list)

def action_confirm(self):
res = super(SaleOrder, self).action_confirm()
for order in self:
if order.state == 'sale':
order.name = self.env['ir.sequence'].next_by_code('sale.order')
return res

def action_draft(self):
for order in self:
if order.write({'state' : 'draft'}):
order.name = self.env['ir.sequence'].next_by_code('sale.order.quotation')
res = super(SaleOrder, self).action_draft()
return res

Najlepsza odpowiedź

Hi,

Go to Settings > Technical > Sequences and select the sequence for sale order and change the prefix from S to Q.


Hope it helps

Awatar
Odrzuć