Merge PR #453 into 13.0

Signed-off-by LoisRForgeFlow
This commit is contained in:
OCA-git-bot
2020-02-10 09:57:04 +00:00
17 changed files with 1112 additions and 0 deletions

View File

@@ -0,0 +1,115 @@
================================
Stock Picking Product Kit Helper
================================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github
:target: https://github.com/OCA/manufacture/tree/13.0/stock_picking_product_kit_helper
:alt: OCA/manufacture
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/manufacture-13-0/manufacture-13-0-stock_picking_product_kit_helper
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/129/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
When sales order contain product kits (product with BOM of type kit),
the delivery order (stock.move) created by it will be exploded to multiple product lines.
Normally, to partially deliver, user will calculate manually the quantity of each product lines to delivery.
This module add new tab "Product Kit Help" to help in calculate quantity in product line with ease.
**Table of contents**
.. contents::
:local:
Usage
=====
When origin sales order of the underlining delivery order contains at least 1 product kit,
the tab "Product Kit Helper" will appear.
To use the helper, go to the "Product Kit Helper" tab,
#. Click => Show Product Kit
#. Edit and fill in required quantity
#. Click Assign Operation Quantity
#. Check result in Operations tab
Changelog
=========
13.0.1.0.0 (2020-01-09)
~~~~~~~~~~~~~~~~~~~~~~~
Migrated to odoo 13.
12.0.1.0.0 (2019-06-17)
~~~~~~~~~~~~~~~~~~~~~~~
First version.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/manufacture/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/manufacture/issues/new?body=module:%20stock_picking_product_kit_helper%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Ecosoft
Contributors
~~~~~~~~~~~~
* `Ecosoft <https://ecosoft.co.th/>`__:
* Kitti Upariphutthiphong <kittiu@ecosoft.co.th>
* Pimolnat Suntian <pimolnats@ecosoft.co.th>
Maintainers
~~~~~~~~~~~
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
.. |maintainer-kittiu| image:: https://github.com/kittiu.png?size=40px
:target: https://github.com/kittiu
:alt: kittiu
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-kittiu|
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/13.0/stock_picking_product_kit_helper>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -0,0 +1,4 @@
# Copyright 2019 Kitti U. - Ecosoft <kittiu@ecosoft.co.th>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import models

View File

@@ -0,0 +1,15 @@
# Copyright 2019 Kitti U. - Ecosoft <kittiu@ecosoft.co.th>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Stock Picking Product Kit Helper",
"summary": "Set quanity in picking line based on product kit quantity",
"version": "13.0.1.0.0",
"category": "Stock",
"website": "https://github.com/OCA/manufacture",
"author": "Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": ["sale_mrp"],
"data": ["security/ir.model.access.csv", "views/stock_view.xml"],
"maintainers": ["kittiu"],
}

View File

@@ -0,0 +1,156 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_product_kit_helper
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: stock_picking_product_kit_helper
#: model:ir.model,name:stock_picking_product_kit_helper.model_stock_picking_product_kit_helper
msgid "\n"
" Product Kit Helper, allow user to specify quantity of product kit,\n"
" to explode as product quantity in operations tab\n"
" "
msgstr ""
#. module: stock_picking_product_kit_helper
#: model_terms:ir.ui.view,arch_db:stock_picking_product_kit_helper.view_picking_form
msgid "Assign Operation Quantity"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model_terms:ir.ui.view,arch_db:stock_picking_product_kit_helper.view_picking_form
msgid "Check result in Operations tab"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model_terms:ir.ui.view,arch_db:stock_picking_product_kit_helper.view_picking_form
msgid "Click =&gt; Show Product Kit"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model_terms:ir.ui.view,arch_db:stock_picking_product_kit_helper.view_picking_form
msgid "Click Assign Operation Quantity"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model:ir.model.fields,field_description:stock_picking_product_kit_helper.field_stock_picking_product_kit_helper__create_uid
msgid "Created by"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model:ir.model.fields,field_description:stock_picking_product_kit_helper.field_stock_picking_product_kit_helper__create_date
msgid "Created on"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model:ir.model.fields,field_description:stock_picking_product_kit_helper.field_stock_picking_product_kit_helper__display_name
msgid "Display Name"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model_terms:ir.ui.view,arch_db:stock_picking_product_kit_helper.view_picking_form
msgid "Edit and fill in required quantity"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model:ir.model.fields,field_description:stock_picking_product_kit_helper.field_stock_picking__has_product_kit
msgid "Has Product Kit"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model:ir.model.fields,field_description:stock_picking_product_kit_helper.field_stock_picking_product_kit_helper__id
msgid "ID"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model_terms:ir.ui.view,arch_db:stock_picking_product_kit_helper.view_picking_form
msgid "Kit Helper"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model:ir.model.fields,field_description:stock_picking_product_kit_helper.field_stock_picking_product_kit_helper____last_update
msgid "Last Modified on"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model:ir.model.fields,field_description:stock_picking_product_kit_helper.field_stock_picking_product_kit_helper__write_uid
msgid "Last Updated by"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model:ir.model.fields,field_description:stock_picking_product_kit_helper.field_stock_picking_product_kit_helper__write_date
msgid "Last Updated on"
msgstr ""
#. module: stock_picking_product_kit_helper
#: code:addons/stock_picking_product_kit_helper/models/stock_picking.py:129
#, python-format
msgid "No matching detailed product %s for product kit %s"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model:ir.model.fields,field_description:stock_picking_product_kit_helper.field_stock_picking_product_kit_helper__picking_id
msgid "Picking"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model:ir.model.fields,field_description:stock_picking_product_kit_helper.field_stock_picking_product_kit_helper__product_id
msgid "Product"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model:ir.model.fields,field_description:stock_picking_product_kit_helper.field_stock_picking__product_kit_helper_ids
msgid "Product Kit Helper Lines"
msgstr ""
#. module: stock_picking_product_kit_helper
#: code:addons/stock_picking_product_kit_helper/models/stock_picking.py:61
#, python-format
msgid "Product Kit Helper is not allowed on current state"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model:ir.model.fields,field_description:stock_picking_product_kit_helper.field_stock_picking_product_kit_helper__product_uom_qty
msgid "Quantity"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model:ir.model.fields,field_description:stock_picking_product_kit_helper.field_stock_picking_product_kit_helper__sale_line_id
msgid "Sales Order Line"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model_terms:ir.ui.view,arch_db:stock_picking_product_kit_helper.view_picking_form
msgid "To deliver partial product kits, you can use this tab to help calculate\n"
" quantity and auto fill in \"Done\" column in Operations tab.<br/>"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model:ir.model,name:stock_picking_product_kit_helper.model_stock_picking
msgid "Transfer"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model:ir.model.fields,help:stock_picking_product_kit_helper.field_stock_picking__has_product_kit
msgid "True if there is at least 1 product kit in the sales order"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model:ir.model.fields,field_description:stock_picking_product_kit_helper.field_stock_picking_product_kit_helper__product_uom
msgid "Unit of Measure"
msgstr ""
#. module: stock_picking_product_kit_helper
#: model_terms:ir.ui.view,arch_db:stock_picking_product_kit_helper.view_picking_form
msgid "⇒ Show Product Kit"
msgstr ""

View File

@@ -0,0 +1,4 @@
# Copyright 2019 Kitti U. - Ecosoft <kittiu@ecosoft.co.th>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import stock_picking

View File

@@ -0,0 +1,137 @@
# Copyright 2019 Kitti U. - Ecosoft <kittiu@ecosoft.co.th>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
class StockPicking(models.Model):
_inherit = "stock.picking"
product_kit_helper_ids = fields.One2many(
comodel_name="stock.picking.product.kit.helper",
string="Product Kit Helper Lines",
inverse_name="picking_id",
readonly=False,
states={"done": [("readonly", True)], "cancel": [("readonly", True)]},
)
has_product_kit = fields.Boolean(
string="Has Product Kit",
compute="_compute_has_product_kit",
help="True if there is at least 1 product kit in the sales order",
)
@api.model
def _is_product_kit(self, product, company):
BOM = self.env["mrp.bom"].sudo()
bom = BOM._bom_find(product=product, company_id=company.id)
return bom and bom.type == "phantom"
def _compute_has_product_kit(self):
for picking in self:
if any(
self._is_product_kit(line.product_id, line.company_id)
for line in picking.move_lines.mapped("sale_line_id")
):
picking.has_product_kit = True
def show_product_kit(self):
"""Find move_lines with product kit to create helper line."""
self.ensure_one()
BOM = self.env["mrp.bom"].sudo()
helpers = []
for sale_line in self.move_lines.mapped("sale_line_id"):
bom = BOM._bom_find(
product=sale_line.product_id, company_id=sale_line.company_id.id
)
if bom and bom.type == "phantom": # Create product kit line
helpers.append(
(
0,
0,
{
"sale_line_id": sale_line.id,
"product_id": sale_line.product_id.id,
"product_uom_qty": 0.0,
},
)
)
self.product_kit_helper_ids.unlink()
self.write({"product_kit_helper_ids": helpers})
def action_product_kit_helper(self):
"""Assign product kit's quantity to stock move."""
self.ensure_one()
if self.state in ("done", "cancel"):
raise ValidationError(
_("Product Kit Helper is not allowed on current state")
)
for helper in self.product_kit_helper_ids:
helper.action_explode_helper()
class StockPickingProductKitHelper(models.Model):
_name = "stock.picking.product.kit.helper"
_description = """
Product Kit Helper, allow user to specify quantity of product kit,
to explode as product quantity in operations tab
"""
picking_id = fields.Many2one(
comodel_name="stock.picking",
string="Picking",
required=True,
index=True,
ondelete="cascade",
)
sale_line_id = fields.Many2one(
comodel_name="sale.order.line", string="Sales Order Line", required=True
)
product_id = fields.Many2one(
comodel_name="product.product", string="Product", required=True, readonly=True
)
product_uom_qty = fields.Float(string="Quantity")
product_uom = fields.Many2one(
comodel_name="uom.uom",
string="Unit of Measure",
related="sale_line_id.product_uom",
readonly=True,
)
def action_explode_helper(self):
"""Explodes product kit quantity to detailed product in stock move."""
self.ensure_one()
# Mock stock.move, in order to resue stock.move's action_explode
StockMove = self.env["stock.move"]
mock_loc = self.env["stock.location"].sudo().search([], limit=1)
mock_pt = self.env["stock.picking.type"].sudo().search([], limit=1)
mock_stock_move = StockMove.sudo().create(
{
"name": "/",
"product_id": self.product_id.id,
"product_uom": self.product_uom.id,
"product_uom_qty": self.product_uom_qty,
"picking_type_id": mock_pt.id,
"location_id": mock_loc.id,
"location_dest_id": mock_loc.id,
}
)
# Reuse explode function and assign quantity_done in stock.move
mock_processed_moves = mock_stock_move.action_explode()
for mock_move in mock_processed_moves:
stock_move = StockMove.search(
[
("picking_id", "=", self.picking_id.id),
("sale_line_id", "=", self.sale_line_id.id),
("product_id", "=", mock_move.product_id.id),
]
)
if not stock_move:
continue
if len(stock_move) != 1:
raise ValidationError(
_("No matching detailed product %s for product kit %s")
% (mock_move.product_id.display_name, self.product_id.display_name)
)
stock_move.write({"quantity_done": mock_move.product_uom_qty})
mock_processed_moves.sudo().unlink()

View File

@@ -0,0 +1,4 @@
* `Ecosoft <https://ecosoft.co.th/>`__:
* Kitti Upariphutthiphong <kittiu@ecosoft.co.th>
* Pimolnat Suntian <pimolnats@ecosoft.co.th>

View File

@@ -0,0 +1,6 @@
When sales order contain product kits (product with BOM of type kit),
the delivery order (stock.move) created by it will be exploded to multiple product lines.
Normally, to partially deliver, user will calculate manually the quantity of each product lines to delivery.
This module add new tab "Product Kit Help" to help in calculate quantity in product line with ease.

View File

@@ -0,0 +1,9 @@
13.0.1.0.0 (2020-01-09)
~~~~~~~~~~~~~~~~~~~~~~~
Migrated to odoo 13.
12.0.1.0.0 (2019-06-17)
~~~~~~~~~~~~~~~~~~~~~~~
First version.

View File

@@ -0,0 +1,9 @@
When origin sales order of the underlining delivery order contains at least 1 product kit,
the tab "Product Kit Helper" will appear.
To use the helper, go to the "Product Kit Helper" tab,
#. Click => Show Product Kit
#. Edit and fill in required quantity
#. Click Assign Operation Quantity
#. Check result in Operations tab

View File

@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_stock_picking_product_kit_helper_user,stock.picking.product.kit.helper user,model_stock_picking_product_kit_helper,stock.group_stock_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_stock_picking_product_kit_helper_user stock.picking.product.kit.helper user model_stock_picking_product_kit_helper stock.group_stock_user 1 1 1 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 45 KiB

View File

@@ -0,0 +1,457 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Stock Picking Product Kit Helper</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="stock-picking-product-kit-helper">
<h1 class="title">Stock Picking Product Kit Helper</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/manufacture/tree/13.0/stock_picking_product_kit_helper"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/manufacture-13-0/manufacture-13-0-stock_picking_product_kit_helper"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/129/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>When sales order contain product kits (product with BOM of type kit),
the delivery order (stock.move) created by it will be exploded to multiple product lines.</p>
<p>Normally, to partially deliver, user will calculate manually the quantity of each product lines to delivery.</p>
<p>This module add new tab “Product Kit Help” to help in calculate quantity in product line with ease.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#usage" id="id3">Usage</a></li>
<li><a class="reference internal" href="#changelog" id="id4">Changelog</a><ul>
<li><a class="reference internal" href="#id1" id="id5">13.0.1.0.0 (2020-01-09)</a></li>
<li><a class="reference internal" href="#id2" id="id6">12.0.1.0.0 (2019-06-17)</a></li>
</ul>
</li>
<li><a class="reference internal" href="#bug-tracker" id="id7">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id8">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id9">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id10">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id11">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id3">Usage</a></h1>
<p>When origin sales order of the underlining delivery order contains at least 1 product kit,
the tab “Product Kit Helper” will appear.</p>
<p>To use the helper, go to the “Product Kit Helper” tab,</p>
<ol class="arabic simple">
<li>Click =&gt; Show Product Kit</li>
<li>Edit and fill in required quantity</li>
<li>Click Assign Operation Quantity</li>
<li>Check result in Operations tab</li>
</ol>
</div>
<div class="section" id="changelog">
<h1><a class="toc-backref" href="#id4">Changelog</a></h1>
<div class="section" id="id1">
<h2><a class="toc-backref" href="#id5">13.0.1.0.0 (2020-01-09)</a></h2>
<p>Migrated to odoo 13.</p>
</div>
<div class="section" id="id2">
<h2><a class="toc-backref" href="#id6">12.0.1.0.0 (2019-06-17)</a></h2>
<p>First version.</p>
</div>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id7">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/manufacture/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/manufacture/issues/new?body=module:%20stock_picking_product_kit_helper%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id8">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id9">Authors</a></h2>
<ul class="simple">
<li>Ecosoft</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id10">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://ecosoft.co.th/">Ecosoft</a>:<ul>
<li>Kitti Upariphutthiphong &lt;<a class="reference external" href="mailto:kittiu&#64;ecosoft.co.th">kittiu&#64;ecosoft.co.th</a>&gt;</li>
<li>Pimolnat Suntian &lt;<a class="reference external" href="mailto:pimolnats&#64;ecosoft.co.th">pimolnats&#64;ecosoft.co.th</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id11">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external" href="https://github.com/kittiu"><img alt="kittiu" src="https://github.com/kittiu.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/manufacture/tree/13.0/stock_picking_product_kit_helper">OCA/manufacture</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,4 @@
# Copyright 2019 Kitti U. - Ecosoft <kittiu@ecosoft.co.th>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import test_stock_picking_product_kit_helper

View File

@@ -0,0 +1,70 @@
# Copyright 2019 Kitti U. - Ecosoft <kittiu@ecosoft.co.th>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.exceptions import ValidationError
from odoo.tests import Form, common
class TestStockPickingProductKitHelper(common.TransactionCase):
def setUp(self):
super(TestStockPickingProductKitHelper, self).setUp()
self.partner = self.env.ref("base.res_partner_2")
self.table_kit = self.env.ref("mrp.product_product_table_kit")
def test_00_sale_product_kit_helper(self):
"""Test sale order with product kit, I expect,
- Product is exploded on picking
- Use helper, will assign quantity to stock.move correctly
- After picking is done, do not allow to use helper
"""
# Create sales order of 10 table kit
order_form = Form(self.env["sale.order"])
order_form.partner_id = self.partner
with order_form.order_line.new() as line:
line.product_id = self.table_kit
line.product_uom_qty = 10
order = order_form.save()
order.action_confirm()
# In the picking, product line is exploded.
picking = order.mapped("picking_ids")
self.assertEqual(len(picking), 1)
stock_moves = picking.move_lines
# 1 SO line exploded to 2 moves
moves = [
{"product": x.product_id.name, "qty": x.product_uom_qty}
for x in stock_moves
]
self.assertEqual(
moves,
[{"product": "Wood Panel", "qty": 10.0}, {"product": "Bolt", "qty": 40.0}],
)
self.assertTrue(picking.has_product_kit)
self.assertFalse(picking.product_kit_helper_ids) # Not show yet
picking.show_product_kit()
self.assertEqual(len(picking.product_kit_helper_ids), 1)
# Assign product set 4 qty and test that it apply to stock.move
picking.product_kit_helper_ids[0].write({"product_uom_qty": 4.0})
picking.action_product_kit_helper()
moves = [
{"product": x.product_id.name, "qty": x.quantity_done} for x in stock_moves
]
self.assertEqual(
moves,
[{"product": "Wood Panel", "qty": 4.0}, {"product": "Bolt", "qty": 16.0}],
)
# Assign again to 10 qty
picking.product_kit_helper_ids[0].write({"product_uom_qty": 10.0})
picking.action_product_kit_helper()
moves = [
{"product": x.product_id.name, "qty": x.quantity_done} for x in stock_moves
]
self.assertEqual(
moves,
[{"product": "Wood Panel", "qty": 10.0}, {"product": "Bolt", "qty": 40.0}],
)
# Validate Picking
picking.button_validate()
self.assertEqual(picking.state, "done")
# After done state, block the helper
with self.assertRaises(ValidationError):
picking.action_product_kit_helper()

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 Kitti U. - Ecosoft <carlos.dauden@tecnativa.com>
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_picking_form" model="ir.ui.view">
<field name="name">stock.picking.form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<xpath expr="/form/sheet/notebook/page[@name='extra']" position="before">
<page string="Kit Helper" attrs="{'invisible': [('has_product_kit', '=', False)]}">
<p class="oe_grey">
To deliver partial product kits, you can use this tab to help calculate
quantity and auto fill in "Done" column in Operations tab.<br/>
<ol>
<li>Click => Show Product Kit</li>
<li>Edit and fill in required quantity</li>
<li>Click Assign Operation Quantity</li>
<li>Check result in Operations tab</li>
</ol>
</p>
<field name="has_product_kit" invisible="1"/>
<button name="show_product_kit" type="object" string="⇒ Show Product Kit" class="oe_link"
attrs="{'invisible': ['|', ('product_kit_helper_ids', '!=', []), ('state', 'in', ['done', 'cancel'])]}"/>
<button name="action_product_kit_helper" type="object" string="Assign Operation Quantity"
class="oe_highlight" attrs="{'invisible': ['|', ('product_kit_helper_ids', '=', []), ('state', 'in', ['done', 'cancel'])]}"/>
<field name="product_kit_helper_ids" attrs="{'invisible': [('product_kit_helper_ids', '=', [])]}">
<tree editable="bottom" create="0" delete="0">
<field name="product_id"/>
<field name="product_uom_qty"/>
<field name="product_uom" groups="uom.group_uom"/>
</tree>
</field>
</page>
</xpath>
</field>
</record>
</odoo>