Numbering Position in Purchase Order Line

Asked by John Chen

Hi OpenERP Team,

Question:
1. I would like to have a field of numbering in order line form that show a sequence of number per lines records.
2. This line will be show like this https://dl.dropbox.com/u/25881837/sequence.png
3. How to make a function in defaults: { } that can auto generate a numbering sequence in order line? or maybe any other way? thanks

Thanks

John Chen

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
stone.wu (sutono-wu) said :
#1

Hi John Chen,

i'm having this problem on my side as well,

i saw a discussion on OpenERP forum about "Numbering positions in an order"
http://www.openerp.com/forum/topic31545.html
hope it helps you.

but this link works only when we're committing (save) a transaction.
what i need here is when we're creating (before save) a new transaction,
every item line i created will generate a sequence number sequentially.
i can't find the solution till today, is there anybody can help me on this?

Revision history for this message
John Chen (john-chen2011) said :
#2

Thanks Mr Stone for your reply

This matter me a lot. I need to show sequence numbering in the purchase order line.

I search every source but haven't got any clue yet..

Revision history for this message
digitalsatori(Shine IT) (digitalsatori) said :
#3

Hi,

If you are using web client and browse to suppliers tab on the product
form, You will find that you are able to drag and drop to re-sequence
the order of the supplier_info items and the sequence number will be
instantly changed to reflect the changes of the sequence.

You may do the same by
creating integer field named 'sequence' at the object on many side, set
class variable _order='sequence', set a initial number(whatever
number,eg, 1) in variable _defaults.

The js on the Web will do the rest for you. Cool, hah?

<http://www.openerp.cn>

*Tony Gu* --Shine IT-- Shanghai, China
Tel : + 86 21 66044468
Cell: + 86 13386068213 Skype: digitalsatori
http://www.openerp.cn
*OpenERP Official Partner in China*

On 2012年06月27日 11:41, stone.wu wrote:
> Question #201480 on OpenERP Server changed:
> https://answers.launchpad.net/openobject-server/+question/201480
>
> Status: Open => Answered
>
> stone.wu proposed the following answer:
> Hi John Chen,
>
> i'm having this problem on my side as well,
>
> i saw a discussion on OpenERP forum about "Numbering positions in an order"
> http://www.openerp.com/forum/topic31545.html
> hope it helps you.
>
> but this link works only when we're committing (save) a transaction.
> what i need here is when we're creating (before save) a new transaction,
> every item line i created will generate a sequence number sequentially.
> i can't find the solution till today, is there anybody can help me on this?
>

Revision history for this message
stone.wu (sutono-wu) said :
#4

Hi,

Thanks for your quick response,
that is cool using js, i'm aware that on web apps we can do a lot by hacking into js
but unfortunately too bad i'm using GTK version...
any solution for this?

Thx
Stone

Revision history for this message
digitalsatori(Shine IT) (digitalsatori) said :
#5

in GTK, you may key in a number in the previous mentioned 'sequence'
field to re-order the sequence of items.
signature
<http://www.openerp.cn>

*Tony Gu* --Shine IT-- Shanghai, China
Tel : + 86 21 66044468
Cell: + 86 13386068213 Skype: digitalsatori
http://www.openerp.cn
*OpenERP Official Partner in China*

On 2012年06月27日 12:26, stone.wu wrote:
> Question #201480 on OpenERP Server changed:
> https://answers.launchpad.net/openobject-server/+question/201480
>
> stone.wu posted a new comment:
> Hi,
>
> Thanks for your quick response,
> that is cool using js, i'm aware that on web apps we can do a lot by hacking into js
> but unfortunately too bad i'm using GTK version...
> any solution for this?
>
> Thx
> Stone
>

Revision history for this message
John Chen (john-chen2011) said :
#6

Thanks Mr Digitalsatori.

Question:
1. Can you guide me more about this sequence in GTK?

Explains:
1. I have created a <field name="sequence"> with:
    _defaults {'sequence': lambda *a: 1.0,}

But the sequence that show in GTK is always 1. Can it be auto running number?

Thanks

John Chen

Revision history for this message
digitalsatori(Shine IT) (digitalsatori) said :
#7

There are many ways to achieve your goal, like configuring a specific
sequence in ir.sequence and using it in _default(refer to the default
value of 'name' field on sales order, overriding 'create' method etc.

But the question is why you need that running sequence number. Sequence
is subject to change anyway. The best approach is already given in the
web client, you may drag and drop to adjust the order of items and the
sequence number will change accordingly.
signature
<http://www.openerp.cn>

*Tony Gu* --Shine IT-- Shanghai, China
Tel : + 86 21 66044468
Cell: + 86 13386068213 Skype: digitalsatori
http://www.openerp.cn
*OpenERP Official Partner in China*

On 2012年06月27日 14:50, John Chen wrote:
> Question #201480 on OpenERP Server changed:
> https://answers.launchpad.net/openobject-server/+question/201480
>
> Status: Answered => Open
>
> John Chen is still having a problem:
> Thanks Mr Digitalsatori.
>
> Question:
> 1. Can you guide me more about this sequence in GTK?
>
> Explains:
> 1. I have created a <field name="sequence"> with:
> _defaults {'sequence': lambda *a: 1.0,}
>
> But the sequence that show in GTK is always 1. Can it be auto running
> number?
>
> Thanks
>
> John Chen
>

Revision history for this message
stone.wu (sutono-wu) said :
#8

Hi Mr. Tony,

i think my case is similar with Mr.John's.
Both of us are using GTK version, and we would like the sequence to be generated each time user create an item line and it must increased accordingly.

Let me put an example, this is my user story after i implemented the guide i received from this link http://www.openerp.com/forum/topic31545.html :
* User create a new PR, filled in all header's field
* Create 3 items in the PR
* After created 3 items in the PR, screen will looks like this : https://dl.dropbox.com/u/20066282/Before.png
* But after i save the transaction, the sequence are correct, screen will be this : https://dl.dropbox.com/u/20066282/After.png
   so i assume here the function will work if i'm saving a transaction, else it wont work....

But what i need here is the sequence number are generated automatically after i created a new item line without go through the save action.....
Understand here that on web app we can drag and drop to adjust the order of items and sequence no will change accordingly... but how about on GTK version???

on your last comment, you said we can configuring specific sequence in ir.sequence and use it in _default function,
i'm not quite understand this part as i'm still the beginner at OpenERP, may u provide us more detail?

Thanks so much for your kindly reply.

Revision history for this message
Ferdinand (office-chricar) said :
#9

we went for another solution
we developed a module which allows to sort o2m fields and use alphabetic sorting for positions on screens and especially for printed order, picking, and invoices
alphabetic order is understood by everyone and IMHO mandatory for long (some pages) reports.

the modules can be found here
http://bazaar.launchpad.net/~c2c/c2c-rd-addons/trunk/files

* purchase_order_webkit
* sale_order_webkit
* stock_packing_webkit
* account_invoice_webkit

Can you help with this problem?

Provide an answer of your own, or ask John Chen for more information if necessary.

To post a message you must log in.