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 stock split moves kic #30878

Open
wants to merge 4 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@kic-odoo
Copy link
Contributor

kic-odoo commented Feb 6, 2019

Description of the issue/feature this PR addresses:
Task ID - https://www.odoo.com/web#id=1912896&action=327&model=project.task&view_type=form&menu_id=4720
Pad - https://pad.odoo.com/p/r.83e35586ce65fb5c181f217f30cd21b6

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

@robodoo robodoo added the CI 🤖 label Feb 6, 2019

@C3POdoo C3POdoo added the RD label Feb 6, 2019

addons/stock/models/stock_move.py Outdated
@@ -1155,6 +1160,29 @@ def unlink(self):
self.mapped('move_line_ids').unlink()
return super(StockMove, self).unlink()

def split_mts(self):
total_org = sum(qty for qty in self.move_dest_ids.mapped('move_orig_ids.product_uom_qty'))

This comment has been minimized.

@fmdl

fmdl Feb 6, 2019

Contributor

it is multi unit proof (what happend if move_orig_ids are diffrent unit) ?

addons/stock/models/stock_move.py Outdated
@@ -1155,6 +1160,29 @@ def unlink(self):
self.mapped('move_line_ids').unlink()
return super(StockMove, self).unlink()

def split_mts(self):
total_org = sum(qty for qty in self.move_dest_ids.mapped('move_orig_ids.product_uom_qty'))
total_dest = sum(qty for qty in self.move_dest_ids.mapped('product_uom_qty'))

This comment has been minimized.

@fmdl

fmdl Feb 6, 2019

Contributor

don't need for loop
total_dest = sum(self.move_dest_ids.mapped('product_uom_qty'))

addons/stock/models/stock_move.py Outdated
for dest_move in self.move_dest_ids:
if dest_move.procure_method == 'make_to_order':
qty_split = dest_move.product_uom_qty - dest_move.reserved_availability
if qty_split == dest_move.product_uom_qty:

This comment has been minimized.

@fmdl

fmdl Feb 6, 2019

Contributor

maybe use float_compare

addons/stock/models/stock_move.py Outdated
'procure_method': 'make_to_stock',
})
dest_move._action_assign()
elif qty_split > 0:

This comment has been minimized.

@fmdl

fmdl Feb 6, 2019

Contributor

maybe use float_compare

addons/stock/models/stock_move.py Outdated
@@ -1155,6 +1160,29 @@ def unlink(self):
self.mapped('move_line_ids').unlink()
return super(StockMove, self).unlink()

def split_mts(self):

This comment has been minimized.

@fmdl

fmdl Feb 6, 2019

Contributor

get a private methode (with underscore) def _split_mts(self):
and add self.ensure_one()

@kic-odoo kic-odoo force-pushed the odoo-dev:master-stock-split-moves-kic branch to 3436715 Feb 7, 2019

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Feb 7, 2019

@kic-odoo kic-odoo force-pushed the odoo-dev:master-stock-split-moves-kic branch from 3436715 to e505fc9 Feb 11, 2019

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Feb 11, 2019

kic-odoo added some commits Nov 30, 2018

[IMP] stock: Better manage exceptions linked to decrease quantities w…
…hen moves are linked

	- Added a method split_mts() to split initial demand and create a new move(MTS) if the initial demand is decreased.

Task ID - 1912896
[IMP] stock: Added testcases
1) Internal Transfer of Product in MTO:
        - Create 2 internal Locations -> Location 1 and Location 2.
        - Create a route - Internal Transfers and add a rule - Internal location 2 -> Internal location 1.
        - Add this route to the product.
        - Create an Internal Transfer(Picking 1) for 10 units from Location 1 -> Stock.
        - In the Origin move (Picking 2), change quantity from 10 to 8 and transfer products.
        - In the Picking 1, split the stock move into two, one of 8 in MTO, one of 2 in MTS.
        - Update quants and products should be reserved in the Picking 1, then mark as done.

2) Deliver in 2 step of Product in MTO:
        - Create a Output Location.
        - Create a route - Deliver in 2 Steps and add 2 rules:
                1) Stock -> Output rule (MTS)
                2) Output -> Customer rule (MTO).
        - Add this route to the product.
        - Create a Picking 1(SHIP) for 10 units from Output -> Customer.
        - In the Picking 2 (PICK), change quantity from 10 to 5 and transfer products from Stock -> Output.
        - In the Picking 1, split the stock move into two, one of 5 in MTO, one of 5 in MTS.
        - Update quants and products should be reserved in the Picking 1, then mark as done.

These testcases ensure that when initial demand is decreased, the initial demand in destination move should be splitted into two -> one in MTO and one in MTS.

Task ID - 1912896
[IMP] purchase_stock: Added testcase
	Purchase Order of Product in MTO:
        - Create a Picking Out for 10 units.
        - On the RFQ, change quantity from 10 to 5 and validate and receive products.
        - On the Picking Out, split the stock move into two, one of 5 in MTO, one of 5 in MTS.
        - Update quants and products should be reserved in the Picking, then mark as done.
        This test ensure that when initial demand is decreased, the initial demand in destination move should be splitted into two -> one in MTO and one in MTS.

Task ID - 1912896
[IMP] mrp: Added testcase
	Manufacturing Order of Semifinished product in MTO:
        - Create a MO for 10 units of a finished product -> Product A.
        - It creates an MO for 10 units of a semi finished product -> Product B.
        - Decrease quantity to produce from 10 to 5 on the semi finished product (Product B).
        - On the MO for the finished products (Product A), for the component "semi finished product (Product B)", split into two moves, one of 5 in MTO and one of 5 in MTS.
        This test ensure that when quantity to produce is decreased in semi finished product, the quantity to produce in destination move should be splitted into two -> one in MTO and one in MTS.

Task ID - 1912896

@kic-odoo kic-odoo force-pushed the odoo-dev:master-stock-split-moves-kic branch from e505fc9 to 4f89738 Feb 11, 2019

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Feb 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment