sequence numbers must be issued without gap

Registered by Ferdinand

currently (5.0) sequence (PO,SO,PACK) numbers are issued at creation of the resource.
IMHO the (sequence) numbers must only be issued if the resource leaves 'draft' state.
all stuff in draft can be abandoned without further documentation leaving holes in the numbers
for accounting and fiscal aproval it is necessary to have document sequences without gaps

20100218 ferdinand
beside the solved problem with intermediate commit
we need
* sequence next number preview function
* sequence commit with increment

the first is necessary if the user has to verify that the current (external) document (bank voucher, manual packing list from external stocks, cash book, ..) will match the number OpenERP will give to the document

IMHO it should be possible to provide this preview easily by creating a new function which just shows the next number
the update should usually happen only during workflow Example from draft -> open/posted or whatever (what happens already in some cases)

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

GG: Yes. I was also about to write blueprint for that. I was waiting for similar opinion.

But for PACK it is a little better from 5.0.3. It doesn't get the number after creation but yet after saving which is also wrong. It could get the stable number after confirmation (it means leaving Draft state as Ferdinand said), and after that shouldn't be deleted but when PACK of some reason is invalid it should be Cancelled only (to keep the number).

I think that when some document identifying is needed even in Draft state we can make visible (but never editable) record ID as it is in account move in Draft state (asterisk and record ID number). It is just proposal.

You said "for accounting and fiscal aproval it is necessary to have document sequences without gaps". I can add that for the same reason two documents shouldn't have the same number. And bug https://bugs.launchpad.net/openobject-addons/+bug/434622 should be fixed. Our Polish accounting and fiscal rules concerns PACK documents and I will vote for sequence order in Packing list. But as we see in bug report other countries has some different rules. I hope such blueprint turns them to different approach.

Unfortunately my country doesn't treat so strictly SO and PO. These documents are not concerns of fiscal rules (only packing lists assigned to them). So I am not able to discuss about SO and PO from such point of view. But Ferdinand please note that SO in draft state is a quotation. And it seems that quotation should have a number because it is sent to customer. And customer should have opportunity to answer "Concerning your Quotation no......". I even think that Quotation should have some revision number as it can be sent to customer few times before customer accept it and you should have history of such "negotiations". So it is better leave SO numbers in draft state as in current functionality. I am not sure but keeping track of Sales orders sent (accepted or not accepted by customer) should be implemented in CRM. If we don't have such functionality it is better to leave SO in draft or cancelled state with numbers. Maybe SO and PO should be improved like packing list now. I mean that they shuold get numbers when saved or printed.

End of GG opinion.

=Ferdinand 20091121=
Quote GG
"Unfortunately my country doesn't treat so strictly SO and PO" and
"SO in draft state is a quotation"

IMHO we need a state "quotation"
A quotation is a legaly binding act which can be enforced by law. No way to allow to delete or alter it. So I agree if quoatations are to be altered we need version numbers and the previous version must be marked as outdated/replaced.

Companies should comply to "ordinary commercial accounting principles" (just found a good explanation in German)
http://de.wikipedia.org/wiki/Grundsätze_ordnungsmäßiger_Buchführung
first line says "a set of written and UNWRITTEN rules" ...

For internal audit and protection of the one implementing the ERP I suggest to enable audit rules for "critical" tables.
Propably theses rules should be shipped with each module and be activated by an "enable global auditing" wizard as it needs deep knowledge of the system to do it manualy.
=End Ferdinand=

==GG 20091123==
I agree that additional State of SO (Quotation) can be implemented. SO should be expanded with version numbers and some functionality to easy create new versions and to easy close dead SO versions as "rejected", "expired" (if date of quotation validity will be implemented).
As you write about accounting principles from my point of view this blueprint is important but following are urgent:
https://bugs.launchpad.net/openobject-addons/+bug/434622
https://blueprints.launchpad.net/openobject-addons/+spec/packing-lists-improvement
https://blueprints.launchpad.net/openobject-addons/+spec/packing-sequence
==END GG=

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.