-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ADD] Add sale order lot selection #140
Conversation
Sale Order Lot Selection | ||
======================== | ||
|
||
This Module Allow you to select on sale order the production lot that will be delivered |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Allow/allows
Please put an specific icon (and smaller) for the module, to not confuse with other functionality. About functionality itself, I miss:
|
'name': 'Sale Order Lot Selection', | ||
'version': '1.0', | ||
'category': 'Sales Management', | ||
'author': "Agile Business Group", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add OCA as author
Hi @pedrobaeza in my last commit i've made some changings. |
Why don't you reserve instead quants (with a many2many) in the same manner that Odoo works? That way, you only need to lock that quants. By standard, you can't do that, but you can use same mechanism than this: https://github.com/odoomrp/odoomrp-wip/blob/8.0/mrp_lock_lot/models/stock_quant.py to forbid to use that quants. |
@hurrinico, please check the PR against your branch and move this to merge the module. |
[IMP] better lot names in tests
@pedrobaeza @eLBati @Viggor i've made some changes to tests and now travis turns green |
from openerp import fields, models, api | ||
|
||
|
||
class procurement_order(models.Model): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use CamelCase for class names
I also wonder if we should restrict the lot selection to the current available lots. If not, we should note in the README that the lot selection doesn't correspond with available lots in stock (it's only a priority), but I'm not sure that in this case, the module will be useful. |
Afaik, the module prevents to use unavailable lots.
|
Indeed there's a warning programmed in an onchange, but it has 2 problems:
I suggest you to pre-calculate in a many2many field the available lots using quants, calling the method for getting the preferred domain and mapping the lots of these quants. |
@pedrobaeza I've added a test case in order to dimostrate that if a lot on a sale order is already restricted, you can't confirm the order. |
Yeah, I know, but my remark is about the usability. Can you read it again? |
Ok @pedrobaeza we have understand the problem, and we agree with you. |
The idea is to have a many2many computed field available lots in the sale.order.line, that depends on the warehouse, product and the quantity. This field is calculated calling the self.env['stock.quant'].quants_get_prefered_domain with the corresponding arguments, and applying that domain to make a search. Then, make a mapped function to retrieve the lots associated (this doesn't remove duplicates). |
Hi @pedrobaeza , we have find this solution; we have replaced the onchange on lot_id with an override to the method "product_id_change_with_wh" where we have called (as you suggest) quants_get_prefered_domain and extended the domain. Could be this a solution? |
@eLBati you are right!! i have made the requested changes. |
@eLBati i've fixed the indentation |
Tried on runbot:
get
|
@eLBati i've fixed with my last commit |
I'm closing this in favor of #202 (I fixed last issues and squashed some commits) Recent updates, which should fix the remaining problems, are |
This Module Allows you to select on sale order the production lot that will be delivered