I like the idea to have fixed prices. You can sell a project for a fixed amount, and when the project is done, you can calculate the profit or losses. That can be very handy when you have to make an offer for another project, so you can learn from the past.
I have updated review64441002 to have a more generic (and customizable) invoice process. Each method must define the quantity and the unit price for the invoice line.
As it is a major change, I took the opportunity to rename the file work.py into project.py for clarity.
Also I put the dedicated method on separate classes. This show how and what to implement for a new method and simplify the reading.
I also introduced two properties invoice_unit_price and unit_to_invoice in order to allow other unit than time based (see #7853 (closed)).
Last but not least, to create the invoice line I reuse the same field as those to compute the amount to invoice to enforce coherence.
Cédric Krieradded 1 deleted label and removed 1 deleted label
When testing the updated review i've get the following exception when using manual invoice method:
Traceback (most recent call last):
File "/trytond/wsgi.py", line 109, in dispatch_request
return endpoint(request, **request.view_args)
File "/trytond/protocols/dispatcher.py", line 47, in rpc
return methods.get(request.rpc_method, _dispatch)(
File "/trytond/wsgi.py", line 77, in auth_required
return wrapped(*args, **kwargs)
File "/trytond/protocols/wrappers.py", line 131, in wrapper
return func(request, pool, *args, **kwargs)
File "/trytond/protocols/dispatcher.py", line 181, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
File "/trytond/model/modelsql.py", line 832, in read
getter_results = field.get(ids, cls, field_list, values=result)
File "/trytond/model/fields/function.py", line 105, in get
return call(names)
File "/trytond/model/fields/function.py", line 99, in call
return method(records, name)
File "/trytond/modules/project/work.py", line 467, in get_total
values = getattr(cls, '_get_%s' % name)(works)
File "/trytond/modules/project_invoice/project.py", line 398, in _get_invoiced_amount
return cls._get_invoice_values(works, 'invoiced_amount')
File "/trytond/modules/project_invoice/project.py", line 391, in _get_invoice_values
method = getattr(cls, '_get_%s_%s' % (name, method))
AttributeError: type object 'project.work' has no attribute '_get_invoiced_amount_manual'