OCA / sale-workflow

Odoo Sales, Workflow and Organization
GNU Affero General Public License v3.0
290 stars 1.01k forks source link

sale_quotation_number - Cant change the "SQ" prefix for sale.quotation sequence #1994

Closed doublescotch closed 4 weeks ago

doublescotch commented 2 years ago

Module

sale_quotation_number

Describe the bug

Work well but it seems there is a bug when trying to change the "SQ" prefix of the sequence for quotations, you are in the obligation of keeping "SQ" in front of whatsoever prefix you want to use.

For exemple, if i replace SQ by DE, the order will still have the quotation number, no change

If i put DE in front of SQ (so DESQ), same not working

If i put DE after SQ (so SQDE), it will work as expected, with order sequence well used

So i guess there is somewhere in your code an imperativ needing of starting the prefix by SQ, but could it be changed? Cause SQ is ok for an english speaking country, but for a french one like mine, i need to edit

To Reproduce

Odoo Community 14:

Steps to reproduce the behavior:

  1. Change sale.quotation sequence prefix from "SQ" to "anything that do not start with "SQ" "
  2. Create a quote (will have the sequence you have just edited, for exemple "DE0001")
  3. Comfirm the quote (will still have the same number, havent changed to sale.order sequence as it should)

Expected behavior Being able to change the sale.quotation sequence settings whitout having to use "SQ" in front of my custom prefixs

Thanks by advance

doublescotch commented 2 years ago

if not editable from the the sequence itself, can you please tell me where could i edit that prefix in the module files?

Like from ir_sequence_data.xml file :

<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2010-2012 Andy Lu <andy.lu@elico-corp.com> (Elico Corp)
Copyright 2013 Agile Business Group sagl (<http://www.agilebg.com>)
Copyright 2017 valentin vinagre  <valentin.vinagre@qubiq.es> (QubiQ)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
-->
<odoo noupdate="1">
    <!-- Sequence for sale.quotation -->
    <record id="seq_sale_quotation" model="ir.sequence">
        <field name="name">Sales Quotation</field>
        <field name="code">sale.quotation</field>
        <field name="prefix">SQ</field>
        <field name="padding">3</field>
        <field name="company_id" eval="False" />
    </record>
</odoo>

I will try by just changing the SQ here

Edit : Not working, this fix will just make the default sequence to what i want, but you need to put SQ back on the interface for that the new sequence apply

doublescotch commented 2 years ago

I dont understand, i have tried to change all the occurence of "SQ" in the followinf files : sales_config.xml , sale_order.py and also test_sale_order.py, which are the only files i have found whith SQ in it, i have changed SQ to my DE needs, and then still the same error, and if, from the interface, i put back SQ in the sequence, it will work.... even if there is not any SQ no more in the source files....

dariodelzozzo commented 11 months ago

Module

sale_quotation_number

Describe the bug

Work well but it seems there is a bug when trying to change the "SQ" prefix of the sequence for quotations, you are in the obligation of keeping "SQ" in front of whatsoever prefix you want to use.

For exemple, if i replace SQ by DE, the order will still have the quotation number, no change

If i put DE in front of SQ (so DESQ), same not working

If i put DE after SQ (so SQDE), it will work as expected, with order sequence well used

So i guess there is somewhere in your code an imperativ needing of starting the prefix by SQ, but could it be changed? Cause SQ is ok for an english speaking country, but for a french one like mine, i need to edit

To Reproduce

Odoo Community 14:

Steps to reproduce the behavior:

  1. Change sale.quotation sequence prefix from "SQ" to "anything that do not start with "SQ" "
  2. Create a quote (will have the sequence you have just edited, for exemple "DE0001")
  3. Comfirm the quote (will still have the same number, havent changed to sale.order sequence as it should)

Expected behavior Being able to change the sale.quotation sequence settings whitout having to use "SQ" in front of my custom prefixs

Thanks by advance

The problem comes from this line of code: https://github.com/OCA/sale-workflow/blob/16.0/sale_quotation_number/models/sale_order.py#L42

It's check if the Quotation name starts with "SQ", if not it's just skip the record and the sequence doesn't change. I don't know why it's hardcoded like that "SQ" instead of a check from the ir.sequence prefix.

OpenCode commented 8 months ago

Possible fix here: https://github.com/OCA/sale-workflow/pull/2126

github-actions[bot] commented 2 months ago

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.