-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Master mrp improve ui jip #32785
Master mrp improve ui jip #32785
Conversation
b04d5d4
to
d60dbdd
Compare
addons/mrp/models/mrp_production.py
Outdated
@@ -200,6 +200,12 @@ def _get_default_location_dest_id(self): | |||
production_location_id = fields.Many2one('stock.location', "Production Location", related='product_id.property_stock_production', readonly=False) | |||
picking_ids = fields.Many2many('stock.picking', compute='_compute_picking_ids', string='Picking associated to this manufacturing order') | |||
delivery_count = fields.Integer(string='Delivery Orders', compute='_compute_picking_ids') | |||
is_ready_produce = fields.Boolean(compute='_compute_is_ready_produce', default=False) |
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.
default=False
is useless, no ?
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.
done
addons/mrp/models/mrp_production.py
Outdated
@api.depends('move_raw_ids', 'move_raw_ids.reserved_availability') | ||
def _compute_is_ready_produce(self): | ||
for order in self: | ||
order.is_ready_produce = all(move.bom_line_id.product_qty <= move.reserved_availability for move in order.move_raw_ids) |
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.
becarefull all([]) = True
why use bom_line_id.product_qty
; you can modifiy (or delete) the value of quantity or the unit on the bom line, just use move.product_uom_qty
, no ?
avoid useless compute if it is an done or cancel order
for order in self.filtered(lambda x: x.state not in ('xxxx')):
order.is_ready_produce = all(move.product_qty <= move.reserved_availability for move in order.move_raw_ids)
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.
all([]) is not possible in Confirmed state because manufacturing order always have raw materials in Confirmed state
here , we don't want to modify or delete the value of quantity.
we are just comparing the move.bom_line_id.product_qty and move.reserved_availability to know whether reserved_availability is enough.
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.
move.bom_line_id.product_qty
is not a fixed value, you can lauch a manufacturing order, then modifiy the bom, and your compute will be wrong, it think you need to use move.product_qty
ormove.product_uom_qty
, check what is made on stock.picking
.
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.
Your case is right ( if some one change current production bom ) ... but we can not use
move.product_qty <= move.reserved_availability. also reserve quantity will not greater
in any case then move quantity
We can use unit_factor <= reservered ( factor will not change when bom change )
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.
you can also delete a bom line, after lauching MO. That why it is not relevant to use bom_line, it is better to user the state of the move.
addons/mrp/security/mrp_security.xml
Outdated
@@ -25,6 +25,10 @@ | |||
<field name="category_id" ref="base.module_category_hidden"/> | |||
</record> | |||
|
|||
<record id="make_invisible" model="res.groups"> |
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.
use base.group_no_one
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.
done
addons/mrp/views/mrp_views_menus.xml
Outdated
@@ -37,6 +37,7 @@ | |||
|
|||
<menuitem id="menu_view_resource_calendar_search_mrp" | |||
action="resource.action_resource_calendar_form" | |||
groups="make_invisible" |
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.
use base.group_no_one
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.
done
d60dbdd
to
f7b9dfa
Compare
f7b9dfa
to
1ad8c2d
Compare
1ad8c2d
to
4a749c0
Compare
addons/mrp/models/mrp_production.py
Outdated
@@ -200,6 +200,13 @@ def _get_default_location_dest_id(self): | |||
production_location_id = fields.Many2one('stock.location', "Production Location", related='product_id.property_stock_production', readonly=False) | |||
picking_ids = fields.Many2many('stock.picking', compute='_compute_picking_ids', string='Picking associated to this manufacturing order') | |||
delivery_count = fields.Integer(string='Delivery Orders', compute='_compute_picking_ids') | |||
is_ready_produce = fields.Boolean(compute='_compute_is_ready_produce') |
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.
use has_ready_produce
(like this https://github.com/odoo/odoo/blob/master/addons/stock/models/stock_picking.py#L278)
addons/mrp/models/mrp_production.py
Outdated
def _compute_is_ready_produce(self): | ||
for order in self: | ||
if order.state not in ('draft', 'done', 'cancel'): | ||
order.is_ready_produce = all(move.bom_line_id.product_qty <= move.reserved_availability for move in order.move_raw_ids) |
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.
You just need to check the state of move with a bilt-in methode: https://github.com/odoo/odoo/blob/master/addons/stock/models/stock_move.py#L588
for order in self.filtered(lambda x: x.state not in ('draft', 'done', 'cancel')):
order.has_ready_produce = order.move_raw_ids._get_relevant_state_among_moves() == 'assigned'
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.
@jip-odoo, what do you think ?
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.
We don't need moves with full availability if partial available then also we can move to production.
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.
use also partially_available
order.move_raw_ids._get_relevant_state_among_moves() in ('assigned', 'partially_available')
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.
@fmdl @sle-odoo Can we start production without minimum quantity requirement satisfied?
if yes then we will go with state...
Also another case I need 5 unit of component and it reserved 1 unit.
After consumption, we don't have to consider this as ready ( we have to consider done quantity after consumption )
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.
it depends on a settings on the bom right? if the move is partially available but has enough reserved components to produce 1 unit, then it should be ready
4a749c0
to
4a97179
Compare
4a97179
to
bb2cbba
Compare
bb2cbba
to
2053164
Compare
2053164
to
7e44c82
Compare
7e44c82
to
23c977a
Compare
task-1949618
-also improve tooltip on attachment icon -and also hide attachment count in edit mode task-1949618
task-1949618
-apply group_stock_multi_locations group on Miscellaneous tab task-1949618
task-1949618
1f2d46f
to
d19c16d
Compare
d19c16d
to
c8f69f2
Compare
-'Working Times' -'Productivity Losses' task-1949618
-'Waiting for Material' > 'Waiting for Component' -'Material Available' > 'Component Available' task-1949618
task-1949618
c8f69f2
to
e7dd5cf
Compare
robodoo r+ rebase-ff |
Merge method set to rebase and fast-forward |
task-1949618 closes #32785 Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Merged at 85b5c9b, thanks! |
Task: https://www.odoo.com/web?#id=1949618&action=327&model=project.task&view_type=form&menu_id=4720
Pad: https://pad.odoo.com/p/r.a80bef5d908739485b8ca61ee4595be8
Description of the issue/feature this PR addresses:
Current behavior before PR:
Desired behavior after PR is merged:
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr