Skip to content
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

Closed
wants to merge 10 commits into from

Conversation

jip-odoo
Copy link
Contributor

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

@C3POdoo C3POdoo added the RD research & development, internal work label Apr 18, 2019
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Apr 18, 2019
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Apr 19, 2019
@@ -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)
Copy link
Contributor

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 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@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)
Copy link
Contributor

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)

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor

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 )

Copy link
Contributor

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.

@@ -25,6 +25,10 @@
<field name="category_id" ref="base.module_category_hidden"/>
</record>

<record id="make_invisible" model="res.groups">
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -37,6 +37,7 @@

<menuitem id="menu_view_resource_calendar_search_mrp"
action="resource.action_resource_calendar_form"
groups="make_invisible"
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Apr 25, 2019
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Apr 25, 2019
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Apr 25, 2019
@@ -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')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Contributor

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'

Copy link
Contributor

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 ?

Copy link
Contributor

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.

Copy link
Contributor

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')

Copy link
Contributor

@jir-odoo jir-odoo May 15, 2019

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 )

Copy link
Contributor

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

@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Apr 26, 2019
@jip-odoo jip-odoo force-pushed the master-mrp-improve-ui-jip branch from 4a97179 to bb2cbba Compare May 7, 2019 05:15
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels May 7, 2019
@jip-odoo jip-odoo force-pushed the master-mrp-improve-ui-jip branch from bb2cbba to 2053164 Compare May 7, 2019 07:00
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label May 7, 2019
@jip-odoo jip-odoo force-pushed the master-mrp-improve-ui-jip branch from 2053164 to 7e44c82 Compare May 7, 2019 07:30
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label May 7, 2019
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels May 27, 2019
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Aug 28, 2019
-also improve tooltip on attachment icon
-and also hide attachment count in edit mode

task-1949618
-apply group_stock_multi_locations group on Miscellaneous tab

task-1949618
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Aug 28, 2019
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Aug 28, 2019
-'Working Times'
-'Productivity Losses'

task-1949618
-'Waiting for Material' > 'Waiting for Component'
-'Material Available' > 'Component Available'

task-1949618
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Aug 28, 2019
@sle-odoo
Copy link
Contributor

robodoo r+ rebase-ff

@robodoo
Copy link
Contributor

robodoo commented Aug 28, 2019

Merge method set to rebase and fast-forward

robodoo pushed a commit that referenced this pull request Aug 28, 2019
task-1949618

closes #32785

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
@robodoo
Copy link
Contributor

robodoo commented Aug 28, 2019

Merged at 85b5c9b, thanks!

@robodoo robodoo closed this Aug 28, 2019
@fw-bot fw-bot deleted the master-mrp-improve-ui-jip branch October 19, 2019 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI 🤖 Robodoo has seen passing statuses RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants