Duplicate primary key for Invoice

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Duplicate primary key for Invoice

simmy007
Hi,

I am seeing some weird behavior on my ofbiz site. I took the trunk snapshot today. I start my site by executing the command ant run-install. I am successfully able to place an order on the site as a user. As an admin I am able to confirm the order. But when I restart the server and place a new order it generates the same invoice-id (CI1) that I had placed earlier. As a result as an admin when I go to confirm the order it gives me the error of "duplicate primary key constraint in Invoice". When I delete all the existing entries related to invoice from database it works. Shouldnt ofbiz generated a higher invoice id when restarting the server? Or am I missing something?

Reply | Threaded
Open this post in threaded view
|

Re: Duplicate primary key for Invoice

rajsaini

Are using your custom data? Have you changed the company of your store?
I had this problem when I had the invoices generated for two different
entities. You can prefix invoice numbers with some letters e.g.  name of
your company.

Raj

simmy007 wrote:

> Hi,
>
> I am seeing some weird behavior on my ofbiz site. I took the trunk snapshot
> today. I start my site by executing the command ant run-install. I am
> successfully able to place an order on the site as a user. As an admin I am
> able to confirm the order. But when I restart the server and place a new
> order it generates the same invoice-id (CI1) that I had placed earlier. As a
> result as an admin when I go to confirm the order it gives me the error of
> "duplicate primary key constraint in Invoice". When I delete all the
> existing entries related to invoice from database it works. Shouldnt ofbiz
> generated a higher invoice id when restarting the server? Or am I missing
> something?
>
>
>  

Reply | Threaded
Open this post in threaded view
|

Re: Duplicate primary key for Invoice

simmy007
I m getting this same problem when I run the site with the original demo data i.e. without filling my custom data.
I run the command ant run-install to run deploy the code each time.

Raj Saini wrote
Are using your custom data? Have you changed the company of your store?
I had this problem when I had the invoices generated for two different
entities. You can prefix invoice numbers with some letters e.g.  name of
your company.

Raj

simmy007 wrote:
> Hi,
>
> I am seeing some weird behavior on my ofbiz site. I took the trunk snapshot
> today. I start my site by executing the command ant run-install. I am
> successfully able to place an order on the site as a user. As an admin I am
> able to confirm the order. But when I restart the server and place a new
> order it generates the same invoice-id (CI1) that I had placed earlier. As a
> result as an admin when I go to confirm the order it gives me the error of
> "duplicate primary key constraint in Invoice". When I delete all the
> existing entries related to invoice from database it works. Shouldnt ofbiz
> generated a higher invoice id when restarting the server? Or am I missing
> something?
>
>
>  
Reply | Threaded
Open this post in threaded view
|

Re: Duplicate primary key for Invoice

rajsaini
Are you using derby db? Try doing a clean install, by running ant
clean-all. And you dont need to run the run-install every time. You just
need to do it once.

Raj

simmy007 wrote:

> I m getting this same problem when I run the site with the original demo data
> i.e. without filling my custom data.
> I run the command ant run-install to run deploy the code each time.
>
>
> Raj Saini wrote:
>  
>> Are using your custom data? Have you changed the company of your store?
>> I had this problem when I had the invoices generated for two different
>> entities. You can prefix invoice numbers with some letters e.g.  name of
>> your company.
>>
>> Raj
>>
>> simmy007 wrote:
>>    
>>> Hi,
>>>
>>> I am seeing some weird behavior on my ofbiz site. I took the trunk
>>> snapshot
>>> today. I start my site by executing the command ant run-install. I am
>>> successfully able to place an order on the site as a user. As an admin I
>>> am
>>> able to confirm the order. But when I restart the server and place a new
>>> order it generates the same invoice-id (CI1) that I had placed earlier.
>>> As a
>>> result as an admin when I go to confirm the order it gives me the error
>>> of
>>> "duplicate primary key constraint in Invoice". When I delete all the
>>> existing entries related to invoice from database it works. Shouldnt
>>> ofbiz
>>> generated a higher invoice id when restarting the server? Or am I missing
>>> something?
>>>
>>>
>>>  
>>>      
>>
>>    
>
>  

Reply | Threaded
Open this post in threaded view
|

RE: Duplicate primary key for Invoice

wperng
I am having the same problem.  I did a clean install, but the problem comes
back.

William

-----Original Message-----
From: Raj Saini [mailto:[hidden email]]
Sent: Thursday, January 31, 2008 5:59 AM
To: [hidden email]
Subject: Re: Duplicate primary key for Invoice

Are you using derby db? Try doing a clean install, by running ant clean-all.
And you dont need to run the run-install every time. You just need to do it
once.

Raj

simmy007 wrote:

> I m getting this same problem when I run the site with the original
> demo data i.e. without filling my custom data.
> I run the command ant run-install to run deploy the code each time.
>
>
> Raj Saini wrote:
>  
>> Are using your custom data? Have you changed the company of your store?
>> I had this problem when I had the invoices generated for two
>> different entities. You can prefix invoice numbers with some letters
>> e.g.  name of your company.
>>
>> Raj
>>
>> simmy007 wrote:
>>    
>>> Hi,
>>>
>>> I am seeing some weird behavior on my ofbiz site. I took the trunk
>>> snapshot today. I start my site by executing the command ant
>>> run-install. I am successfully able to place an order on the site as
>>> a user. As an admin I am able to confirm the order. But when I
>>> restart the server and place a new order it generates the same
>>> invoice-id (CI1) that I had placed earlier.
>>> As a
>>> result as an admin when I go to confirm the order it gives me the
>>> error of "duplicate primary key constraint in Invoice". When I
>>> delete all the existing entries related to invoice from database it
>>> works. Shouldnt ofbiz generated a higher invoice id when restarting
>>> the server? Or am I missing something?
>>>
>>>
>>>  
>>>      
>>
>>    
>
>  


Reply | Threaded
Open this post in threaded view
|

Re: Duplicate primary key for Invoice

Jacopo Cappellato
Hi,

this is annoying and it only happens when you reload demo data (ant
run-install) over existing data when you have already created at least
one invoice.
The problem is that the PartyAcctgPreference.lastInvoiceNumber field
(that contains the number of the last invoice) is overriden with 0.
This should be fixed in rev. 617515 (however there are probably better
ways to manage this stuff).

Jacopo

William Perng wrote:

> I am having the same problem.  I did a clean install, but the problem comes
> back.
>
> William
>
> -----Original Message-----
> From: Raj Saini [mailto:[hidden email]]
> Sent: Thursday, January 31, 2008 5:59 AM
> To: [hidden email]
> Subject: Re: Duplicate primary key for Invoice
>
> Are you using derby db? Try doing a clean install, by running ant clean-all.
> And you dont need to run the run-install every time. You just need to do it
> once.
>
> Raj
>
> simmy007 wrote:
>> I m getting this same problem when I run the site with the original
>> demo data i.e. without filling my custom data.
>> I run the command ant run-install to run deploy the code each time.
>>
>>
>> Raj Saini wrote:
>>  
>>> Are using your custom data? Have you changed the company of your store?
>>> I had this problem when I had the invoices generated for two
>>> different entities. You can prefix invoice numbers with some letters
>>> e.g.  name of your company.
>>>
>>> Raj
>>>
>>> simmy007 wrote:
>>>    
>>>> Hi,
>>>>
>>>> I am seeing some weird behavior on my ofbiz site. I took the trunk
>>>> snapshot today. I start my site by executing the command ant
>>>> run-install. I am successfully able to place an order on the site as
>>>> a user. As an admin I am able to confirm the order. But when I
>>>> restart the server and place a new order it generates the same
>>>> invoice-id (CI1) that I had placed earlier.
>>>> As a
>>>> result as an admin when I go to confirm the order it gives me the
>>>> error of "duplicate primary key constraint in Invoice". When I
>>>> delete all the existing entries related to invoice from database it
>>>> works. Shouldnt ofbiz generated a higher invoice id when restarting
>>>> the server? Or am I missing something?
>>>>
>>>>
>>>>  
>>>>      
>>>    
>>  
>

Reply | Threaded
Open this post in threaded view
|

Re: Duplicate primary key for Invoice

Jacques Le Roux
Administrator
Untill Jacopo took this decision, I used to manage it by upgrading the PartyAcctgPreference lastInvoiceNumber (for invoices, quotes
or orders) by hand in function of already existing DB values (if needed). Not so much work, but annoying sometimes (when in a hurry
for instance) I must admit

Jacques

From: "Jacopo Cappellato" <[hidden email]>

> Hi,
>
> this is annoying and it only happens when you reload demo data (ant run-install) over existing data when you have already created
> at least one invoice.
> The problem is that the PartyAcctgPreference.lastInvoiceNumber field (that contains the number of the last invoice) is overriden
> with 0.
> This should be fixed in rev. 617515 (however there are probably better ways to manage this stuff).
>
> Jacopo
>
> William Perng wrote:
>> I am having the same problem.  I did a clean install, but the problem comes
>> back.
>>
>> William
>>
>> -----Original Message-----
>> From: Raj Saini [mailto:[hidden email]] Sent: Thursday, January 31, 2008 5:59 AM
>> To: [hidden email]
>> Subject: Re: Duplicate primary key for Invoice
>>
>> Are you using derby db? Try doing a clean install, by running ant clean-all.
>> And you dont need to run the run-install every time. You just need to do it
>> once.
>>
>> Raj
>>
>> simmy007 wrote:
>>> I m getting this same problem when I run the site with the original demo data i.e. without filling my custom data.
>>> I run the command ant run-install to run deploy the code each time.
>>>
>>>
>>> Raj Saini wrote:
>>>
>>>> Are using your custom data? Have you changed the company of your store? I had this problem when I had the invoices generated
>>>> for two different entities. You can prefix invoice numbers with some letters e.g.  name of your company.
>>>>
>>>> Raj
>>>>
>>>> simmy007 wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I am seeing some weird behavior on my ofbiz site. I took the trunk snapshot today. I start my site by executing the command
>>>>> ant run-install. I am successfully able to place an order on the site as a user. As an admin I am able to confirm the order.
>>>>> But when I restart the server and place a new order it generates the same invoice-id (CI1) that I had placed earlier.
>>>>> As a
>>>>> result as an admin when I go to confirm the order it gives me the error of "duplicate primary key constraint in Invoice". When
>>>>> I delete all the existing entries related to invoice from database it works. Shouldnt ofbiz generated a higher invoice id when
>>>>> restarting the server? Or am I missing something?
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
>