How to add new account.invoice.line to an existing account.invoice

Asked by OpenBMS JSC on 2011-05-07

I want to add new account.invoice.line to an existing account.invoice (in draft state) so that if a customer is using/consuming many products, he/she only have to pay a single invoice at the end. We bypass the sale-order process as the customer need to be billed as use automatically. I'm a bit puzzle with how to modify the one2many field (invoice_line) to add the new records in.

Any examples are highly appreciated.

Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Ana Juaristi Olalde
Solved:
2011-05-13
Last query:
2011-05-13
Last reply:
2011-05-08

Hi Phong:

I'm afraid I don't understand very well what you wanna do. I don't even
understand if it is a functional question or a technical one.

Please, could you explain a little bit better with a real case use or an
example what you need? Could it be valid to create several draft invoices
and make a fusion of them before validating? There is a module for 5.0
that makes just that.

Thank you:

Ana

2011/5/8 Phong Nguyen-Thanh <email address hidden>

> New question #156489 on OpenERP Addons:
> https://answers.launchpad.net/openobject-addons/+question/156489
>
> I want to add new account.invoice.line to an existing account.invoice (in
> draft state) so that if a customer is using/consuming many products, he/she
> only have to pay a single invoice at the end. We bypass the sale-order
> process as the customer need to be billed as use automatically. I'm a bit
> puzzle with how to modify the one2many field (invoice_line) to add the new
> records in.
>
> Any examples are highly appreciated.
>
> Thanks.
>
> --
> You received this question notification because you are a member of
> OpenERP Committers, which is an answer contact for OpenERP Addons.
>

--
Ana Juaristi Olalde
Avanzosc, S.L.
Partner OpenERP
www.anajuaristi.com
www.openerpsite.com
www.avanzosc.com
Skype: avanzosc
677 93 42 59 - 943 02 69 02

OpenBMS JSC (openbmsjsc) said : #2

Hello Ana,

Thank you for response. I will clarify my situation a bit more. I'm customizing OpenERP for a medical practice center, where they want that all services (lab test, consultations) will be registered into a single invoice for a single patient, regardless how many doctors the patient have seen, provided that the patient hasn't pay the invoice yet (the invoice is in draft state), as doctors might refer the patient to different departments for additional check-up as he/she sees necessary. I want to avoid generating the SO for each services and go directly to generate invoices. Currently I generate different draft invoices for each service the patient actually use, but it has several problems:

1. The number of invoices can be large, so it takes more time for the staff to confirm/validate each invoice before these can be paid. Putting all in a single invoice will generate less work for them, thus speeding up the process.

2. The customer/patient will receive a lot of invoices, one for each service, which is very annoying for he/she as he/she only wants a single invoice containing every services that have been consumed.

So, what I'm doing is to find the current draft invoice for that particular patient, within that day, and add the (newly) consumed services as account.invoice.lines to the patient current invoice. This is a technical question: how to add more (not yet created in DB) records to a one2many field, in a secure/transactional way using OpenERP framework.

I'm not sure if my current approach for this problem is the best possible approach, so I really appreciate any suggestions. I'm not sure if it's better to generate SOs, and automatically validate/confirm these SOs and combine them in a single invoice. I'm not yet familiar with the workflow and automatic actions, so pointers to relevant documentations are also appreciated.

xrg (xrg) said : #3

On Sunday 08 May 2011, you wrote:

> Thank you for response. I will clarify my situation a bit more. I'm
> customizing OpenERP for a medical practice center, where they want that
> all services (lab test, consultations) will be registered into a single
> invoice for a single patient, regardless how many doctors the patient
> have seen, provided that the patient hasn't pay the invoice yet (the
> invoice is in draft state), as doctors might refer the patient to
> different departments for additional check-up as he/she sees necessary.
> I want to avoid generating the SO for each services and go directly to
> generate invoices. Currently I generate different draft invoices for
> each service the patient actually use, but it has several problems:
>...

I simply generate those N invoices, and then merge them with
account_invoice_merge at the end..

OpenBMS JSC (openbmsjsc) said : #4

where can I find account_invoice_merge module? is it from addons-community?

OpenBMS JSC (openbmsjsc) said : #5

where can I find that module?

HI Phong:

I agree that the simpliest solution for your use case would be each doctor
to generate their own invoice (even without knowing the other doctors
invoices if not needed) and then the administrative who makes the invoices
for patiences would merge all the draft invoices grouping by
customer/patience.

I know this module for 5.0 from an spanish partner (trey) that makes merging
draft invoices:
https://code.launchpad.net/~robertolizana/openobject-addons/trey_join_invoice

For 6.0 I could not find the module account_invoice_merge, not in addons,
nor in extra-addons, nor in community. Xrg, it would be interesting if you
provide us the link to the module.

Thank you very much:

Ana

2011/5/8 Phong Nguyen-Thanh <email address hidden>

> Question #156489 on OpenERP Addons changed:
> https://answers.launchpad.net/openobject-addons/+question/156489
>
> Phong Nguyen-Thanh posted a new comment:
> where can I find that module?
>
> --
> You received this question notification because you are a member of
> OpenERP Committers, which is an answer contact for OpenERP Addons.
>

--
Ana Juaristi Olalde
Avanzosc, S.L.
Partner OpenERP
www.anajuaristi.com
www.openerpsite.com
www.avanzosc.com
Skype: avanzosc
677 93 42 59 - 943 02 69 02

OpenBMS JSC (openbmsjsc) said : #7

Thanks Ana Juaristi Olalde, that solved my question.