Issue 9612

Title
Allow to read the supplier value when creating quotation lines
Priority
feature
Status
testing
Nosy list
ced, pokoli, reviewbot
Assigned to
pokoli
Keywords
review

Created on 2020-09-17.13:30:48 by pokoli, last changed yesterday by reviewbot.

Messages

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-09-22.00:07:33
You can have the creation method like this:

for supplier in …:
     quotations.append(self.get_quotation(supplier))
Quotation.save(quotations)


def get_quotation(self, supplier):
   …
   for key, grouped_requests in groupby(…):
       for r in grouped_requests:
             lines.append(self.get_quotation_line(request))
       quotation.lines = lines
   return quotation
Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2020-09-18.13:35:40
I'm not sure to understand what do you mean (because there are three lops on the code). 

Could you please clarify it?
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-09-17.15:47:03
On 2020-09-17 15:18, Sergi Almacellas Abellana wrote:
> > Indeed I think it will be better to externalize the quotation instantiation out of the loop.
> 
> It won't work for our use case as each quotation has a diferent supplier, so it must be done inside the loop.

It will work if done properly by doing a second loop on the quotation
lines.
Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2020-09-17.15:18:18
El 17/9/20 a les 15:03, Cédric Krier ha escrit:
> For me, it is not clear what could be customized on the line depending on the parent.

Our requirement is to customize the description using the values from product_supplier table (include supplier name and code if available)

> Indeed I think it will be better to externalize the quotation instantiation out of the loop.

It won't work for our use case as each quotation has a diferent supplier, so it must be done inside the loop.
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2020-09-17.15:03:37
For me, it is not clear what could be customized on the line depending on the parent.
Indeed I think it will be better to externalize the quotation instantiation out of the loop.
Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2020-09-17.13:30:48
One may be interested on customizing the lines values depending on the supplier used but this is not currently possible because the field is not available on the request: 

https://hg.tryton.org/modules/purchase_request_quotation/file/1789591561e2/purchase.py#l524

So I think we should factorize the method to pass also the newly created quotation so we can read the supplier and other values.
History
Date User Action Args
2021-04-09 17:15:21reviewbotsetmessages: + msg66237
2021-04-07 17:14:07reviewbotsetmessages: + msg66154
2020-09-23 14:24:44reviewbotsetnosy: + reviewbot
messages: + msg60292
2020-09-22 00:07:33cedsetmessages: + msg60257
2020-09-18 13:35:40pokolisetassignedto: pokoli
messages: + msg60225
2020-09-17 15:47:03cedsetmessages: + msg60199
2020-09-17 15:18:18pokolisetmessages: + msg60197
2020-09-17 15:03:37cedsetnosy: + ced, - reviewbot
messages: + msg60196
2020-09-17 13:45:11reviewbotsetnosy: + reviewbot
messages: + msg60189
2020-09-17 13:31:57pokolisetstatus: in-progress -> testing
reviews: 302171002
keyword: + review

Showing 10 items. Show all history (warning: this could be VERY long)