mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
@@ -0,0 +1 @@
|
||||
../../../../stock_putaway_product_template
|
||||
6
setup/stock_putaway_product_template/setup.py
Normal file
6
setup/stock_putaway_product_template/setup.py
Normal file
@@ -0,0 +1,6 @@
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['setuptools-odoo'],
|
||||
odoo_addon=True,
|
||||
)
|
||||
103
stock_putaway_product_template/README.rst
Normal file
103
stock_putaway_product_template/README.rst
Normal file
@@ -0,0 +1,103 @@
|
||||
======================================
|
||||
Product template in putaway strategies
|
||||
======================================
|
||||
|
||||
..
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:5ed24cf34b102af6f5f1b910da78370cb7158cb7f2923fb0ac245e03c6dffac8
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |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%2Fstock--logistics--warehouse-lightgray.png?logo=github
|
||||
:target: https://github.com/OCA/stock-logistics-warehouse/tree/15.0/stock_putaway_product_template
|
||||
:alt: OCA/stock-logistics-warehouse
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-15-0/stock-logistics-warehouse-15-0-stock_putaway_product_template
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
||||
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=15.0
|
||||
:alt: Try me on Runboat
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
This module add product template in putaway strategies from the product view to not need defined putaway strategies for all variants.
|
||||
|
||||
**Table of contents**
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
* In Inventory Settings, set "Storage Locations" to True
|
||||
* User should be in "Manage push and pull inventory flows"
|
||||
* Inside a product go to "Putaway rules"
|
||||
* It's possible to define record to template
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/issues>`_.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_putaway_product_template%0Aversion:%2015.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
|
||||
~~~~~~~
|
||||
|
||||
* Akretion
|
||||
|
||||
Contributors
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* `Akretion <https://www.akretion.com>`_:
|
||||
|
||||
* Kevin Khao <kevin.khao@akretion.com>
|
||||
|
||||
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||
|
||||
* Sergio Teruel
|
||||
* Víctor Martínez
|
||||
* César A. Sánchez
|
||||
|
||||
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-kevinkhao| image:: https://github.com/kevinkhao.png?size=40px
|
||||
:target: https://github.com/kevinkhao
|
||||
:alt: kevinkhao
|
||||
.. |maintainer-sebastienbeau| image:: https://github.com/sebastienbeau.png?size=40px
|
||||
:target: https://github.com/sebastienbeau
|
||||
:alt: sebastienbeau
|
||||
|
||||
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
|
||||
|
||||
|maintainer-kevinkhao| |maintainer-sebastienbeau|
|
||||
|
||||
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/15.0/stock_putaway_product_template>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
3
stock_putaway_product_template/__init__.py
Normal file
3
stock_putaway_product_template/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import models
|
||||
14
stock_putaway_product_template/__manifest__.py
Normal file
14
stock_putaway_product_template/__manifest__.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# Copyright 2023 Tecnativa - Carolina Fernandez
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
{
|
||||
"name": "Product template in putaway strategies",
|
||||
"summary": "Add product template in putaway strategies from the product view",
|
||||
"version": "16.0.1.0.0",
|
||||
"category": "Inventory",
|
||||
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
||||
"author": "Akretion, Odoo Community Association (OCA)",
|
||||
"license": "AGPL-3",
|
||||
"depends": ["stock"],
|
||||
"data": ["views/stock_putaway_rule_views.xml"],
|
||||
"maintainers": ["kevinkhao", "sebastienbeau"],
|
||||
}
|
||||
59
stock_putaway_product_template/i18n/es.po
Normal file
59
stock_putaway_product_template/i18n/es.po
Normal file
@@ -0,0 +1,59 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * stock_putaway_product_template
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-11-11 09:02+0000\n"
|
||||
"PO-Revision-Date: 2023-07-27 11:14+0000\n"
|
||||
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
|
||||
"Language-Team: \n"
|
||||
"Language: es\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: Weblate 4.17\n"
|
||||
|
||||
#. module: stock_putaway_product_template
|
||||
#: model:ir.model.fields,field_description:stock_putaway_product_template.field_product_template__display_name
|
||||
#: model:ir.model.fields,field_description:stock_putaway_product_template.field_stock_location__display_name
|
||||
#: model:ir.model.fields,field_description:stock_putaway_product_template.field_stock_putaway_rule__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "Nombre mostrado"
|
||||
|
||||
#. module: stock_putaway_product_template
|
||||
#: model:ir.model.fields,field_description:stock_putaway_product_template.field_product_template__id
|
||||
#: model:ir.model.fields,field_description:stock_putaway_product_template.field_stock_location__id
|
||||
#: model:ir.model.fields,field_description:stock_putaway_product_template.field_stock_putaway_rule__id
|
||||
msgid "ID"
|
||||
msgstr "ID (identificación)"
|
||||
|
||||
#. module: stock_putaway_product_template
|
||||
#: model:ir.model,name:stock_putaway_product_template.model_stock_location
|
||||
msgid "Inventory Locations"
|
||||
msgstr "Ubicaciones de inventario"
|
||||
|
||||
#. module: stock_putaway_product_template
|
||||
#: model:ir.model.fields,field_description:stock_putaway_product_template.field_product_template____last_update
|
||||
#: model:ir.model.fields,field_description:stock_putaway_product_template.field_stock_location____last_update
|
||||
#: model:ir.model.fields,field_description:stock_putaway_product_template.field_stock_putaway_rule____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr "Última modificación el"
|
||||
|
||||
#. module: stock_putaway_product_template
|
||||
#: model:ir.model,name:stock_putaway_product_template.model_product_template
|
||||
msgid "Product Template"
|
||||
msgstr "Plantilla de producto"
|
||||
|
||||
#. module: stock_putaway_product_template
|
||||
#: model:ir.model.fields,field_description:stock_putaway_product_template.field_stock_putaway_rule__product_tmpl_id
|
||||
msgid "Product Tmpl"
|
||||
msgstr "Plantilla de producto"
|
||||
|
||||
#. module: stock_putaway_product_template
|
||||
#: model:ir.model,name:stock_putaway_product_template.model_stock_putaway_rule
|
||||
msgid "Putaway Rule"
|
||||
msgstr "Regla de Estrategia de Traslado"
|
||||
@@ -0,0 +1,34 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * stock_putaway_product_template
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 15.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_putaway_product_template
|
||||
#: model:ir.model,name:stock_putaway_product_template.model_stock_location
|
||||
msgid "Inventory Locations"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_putaway_product_template
|
||||
#: model:ir.model,name:stock_putaway_product_template.model_product_template
|
||||
msgid "Product Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_putaway_product_template
|
||||
#: model:ir.model.fields,field_description:stock_putaway_product_template.field_stock_putaway_rule__product_tmpl_id
|
||||
msgid "Product Tmpl"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_putaway_product_template
|
||||
#: model:ir.model,name:stock_putaway_product_template.model_stock_putaway_rule
|
||||
msgid "Putaway Rule"
|
||||
msgstr ""
|
||||
3
stock_putaway_product_template/models/__init__.py
Normal file
3
stock_putaway_product_template/models/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from . import product
|
||||
from . import stock_location
|
||||
from . import stock_putaway_rule
|
||||
19
stock_putaway_product_template/models/product.py
Normal file
19
stock_putaway_product_template/models/product.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
# Copyright 2021 Tecnativa - Víctor Martínez
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = "product.template"
|
||||
|
||||
def action_view_related_putaway_rules(self):
|
||||
self.ensure_one()
|
||||
domain = [
|
||||
"|",
|
||||
"|",
|
||||
("product_tmpl_id", "=", self.id),
|
||||
("category_id", "=", self.categ_id.id),
|
||||
("product_id.product_tmpl_id", "=", self.id),
|
||||
]
|
||||
return self._get_action_view_related_putaway_rules(domain)
|
||||
21
stock_putaway_product_template/models/stock_location.py
Normal file
21
stock_putaway_product_template/models/stock_location.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
# Copyright 2020 Tecnativa - Sergio Teruel
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class StockLocation(models.Model):
|
||||
_inherit = "stock.location"
|
||||
|
||||
def _get_putaway_strategy(
|
||||
self, product, quantity=0, package=None, packaging=None, additional_qty=None
|
||||
):
|
||||
return super(
|
||||
StockLocation, self.with_context(filter_putaway_rule=True)
|
||||
)._get_putaway_strategy(
|
||||
product,
|
||||
quantity=quantity,
|
||||
package=package,
|
||||
packaging=packaging,
|
||||
additional_qty=additional_qty,
|
||||
)
|
||||
50
stock_putaway_product_template/models/stock_putaway_rule.py
Normal file
50
stock_putaway_product_template/models/stock_putaway_rule.py
Normal file
@@ -0,0 +1,50 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
# Copyright 2020 Sergio Teruel - Tecnativa
|
||||
# Copyright 2020 Víctor Martínez - Tecnativa
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class StockPutawayRule(models.Model):
|
||||
_inherit = "stock.putaway.rule"
|
||||
|
||||
product_tmpl_id = fields.Many2one(
|
||||
comodel_name="product.template",
|
||||
compute="_compute_product_tmpl_id",
|
||||
store=True,
|
||||
readonly=False,
|
||||
ondelete="cascade",
|
||||
)
|
||||
|
||||
@api.depends("product_id")
|
||||
def _compute_product_tmpl_id(self):
|
||||
for rec in self:
|
||||
if rec.product_id:
|
||||
rec.product_tmpl_id = rec.product_id.product_tmpl_id
|
||||
else:
|
||||
params = self.env.context.get("params", {})
|
||||
if params.get("model", "") == "product.template" and params.get("id"):
|
||||
rec.product_tmpl_id = params.get("id")
|
||||
|
||||
def filtered(self, func):
|
||||
res = super().filtered(func)
|
||||
if res or not self.env.context.get("filter_putaway_rule"):
|
||||
return res
|
||||
if isinstance(func, str):
|
||||
name = func
|
||||
|
||||
def func(rec):
|
||||
any(rec.mapped(name))
|
||||
|
||||
# populate cache
|
||||
self.mapped(name)
|
||||
product = func.__closure__[0].cell_contents
|
||||
if isinstance(product, str):
|
||||
return res
|
||||
if product._name != "product.product":
|
||||
return res
|
||||
return self.with_context(filter_putaway_rule=False).filtered(
|
||||
lambda x: (
|
||||
x.product_tmpl_id == product.product_tmpl_id and not x.product_id
|
||||
)
|
||||
)
|
||||
10
stock_putaway_product_template/readme/CONTRIBUTORS.rst
Normal file
10
stock_putaway_product_template/readme/CONTRIBUTORS.rst
Normal file
@@ -0,0 +1,10 @@
|
||||
* `Akretion <https://www.akretion.com>`_:
|
||||
|
||||
* Kevin Khao <kevin.khao@akretion.com>
|
||||
|
||||
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||
|
||||
* Sergio Teruel
|
||||
* Víctor Martínez
|
||||
* César A. Sánchez
|
||||
* Carolina Fernandez
|
||||
1
stock_putaway_product_template/readme/DESCRIPTION.rst
Normal file
1
stock_putaway_product_template/readme/DESCRIPTION.rst
Normal file
@@ -0,0 +1 @@
|
||||
This module add product template in putaway strategies from the product view to not need defined putaway strategies for all variants.
|
||||
4
stock_putaway_product_template/readme/USAGE.rst
Normal file
4
stock_putaway_product_template/readme/USAGE.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
* In Inventory Settings, set "Storage Locations" to True
|
||||
* User should be in "Manage push and pull inventory flows"
|
||||
* Inside a product go to "Putaway rules"
|
||||
* It's possible to define record to template
|
||||
BIN
stock_putaway_product_template/static/description/icon.png
Normal file
BIN
stock_putaway_product_template/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
443
stock_putaway_product_template/static/description/index.html
Normal file
443
stock_putaway_product_template/static/description/index.html
Normal file
@@ -0,0 +1,443 @@
|
||||
<?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: https://docutils.sourceforge.io/" />
|
||||
<title>Product template in putaway strategies</title>
|
||||
<style type="text/css">
|
||||
|
||||
/*
|
||||
:Author: David Goodger (goodger@python.org)
|
||||
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
|
||||
See https://docutils.sourceforge.io/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="product-template-in-putaway-strategies">
|
||||
<h1 class="title">Product template in putaway strategies</h1>
|
||||
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:5ed24cf34b102af6f5f1b910da78370cb7158cb7f2923fb0ac245e03c6dffac8
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/stock-logistics-warehouse/tree/15.0/stock_putaway_product_template"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-15-0/stock-logistics-warehouse-15-0-stock_putaway_product_template"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module add product template in putaway strategies from the product view to not need defined putaway strategies for all variants.</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="toc-entry-1">Usage</a></li>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="usage">
|
||||
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
|
||||
<ul class="simple">
|
||||
<li>In Inventory Settings, set “Storage Locations” to True</li>
|
||||
<li>User should be in “Manage push and pull inventory flows”</li>
|
||||
<li>Inside a product go to “Putaway rules”</li>
|
||||
<li>It’s possible to define record to template</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/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 to smash it by providing a detailed and welcomed
|
||||
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_putaway_product_template%0Aversion:%2015.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="#toc-entry-3">Credits</a></h1>
|
||||
<div class="section" id="authors">
|
||||
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Akretion</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="contributors">
|
||||
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
|
||||
<ul class="simple">
|
||||
<li><a class="reference external" href="https://www.akretion.com">Akretion</a>:<ul>
|
||||
<li>Kevin Khao <<a class="reference external" href="mailto:kevin.khao@akretion.com">kevin.khao@akretion.com</a>></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
|
||||
<li>Sergio Teruel</li>
|
||||
<li>Víctor Martínez</li>
|
||||
<li>César A. Sánchez</li>
|
||||
<li>Carolina Fernandez</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h2><a class="toc-backref" href="#toc-entry-6">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">maintainers</a>:</p>
|
||||
<p><a class="reference external image-reference" href="https://github.com/kevinkhao"><img alt="kevinkhao" src="https://github.com/kevinkhao.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/sebastienbeau"><img alt="sebastienbeau" src="https://github.com/sebastienbeau.png?size=40px" /></a></p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/15.0/stock_putaway_product_template">OCA/stock-logistics-warehouse</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>
|
||||
3
stock_putaway_product_template/tests/__init__.py
Normal file
3
stock_putaway_product_template/tests/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import test_stock_putaway_rule
|
||||
110
stock_putaway_product_template/tests/test_stock_putaway_rule.py
Normal file
110
stock_putaway_product_template/tests/test_stock_putaway_rule.py
Normal file
@@ -0,0 +1,110 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
# Copyright 2020 Tecnativa - Sergio Teruel
|
||||
# Copyright 2020-2021 Víctor Martínez - Tecnativa
|
||||
|
||||
from odoo.tests import common
|
||||
|
||||
|
||||
class TestStockPutawayRule(common.TransactionCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.putawayRuleObj = cls.env["stock.putaway.rule"]
|
||||
ProductTemplate = cls.env["product.template"]
|
||||
ProductAttribute = cls.env["product.attribute"]
|
||||
ProductAttributeValue = cls.env["product.attribute.value"]
|
||||
TemplateAttributeLine = cls.env["product.template.attribute.line"]
|
||||
# Add a product with variants
|
||||
cls.template = ProductTemplate.create({"name": "Product test", "type": "consu"})
|
||||
cls.size_attribute = ProductAttribute.create(
|
||||
{"name": "Test size", "sequence": 1}
|
||||
)
|
||||
cls.size_m = ProductAttributeValue.create(
|
||||
{"name": "Size M", "attribute_id": cls.size_attribute.id, "sequence": 1}
|
||||
)
|
||||
cls.size_l = ProductAttributeValue.create(
|
||||
{"name": "Size L", "attribute_id": cls.size_attribute.id, "sequence": 2}
|
||||
)
|
||||
cls.size_xl = ProductAttributeValue.create(
|
||||
{"name": "Size XL", "attribute_id": cls.size_attribute.id, "sequence": 3}
|
||||
)
|
||||
cls.template_attribute_lines = TemplateAttributeLine.create(
|
||||
{
|
||||
"product_tmpl_id": cls.template.id,
|
||||
"attribute_id": cls.size_attribute.id,
|
||||
"value_ids": [(6, 0, [cls.size_m.id, cls.size_l.id, cls.size_xl.id])],
|
||||
}
|
||||
)
|
||||
cls.template._create_variant_ids()
|
||||
cls.view_id = cls.env.ref("stock.stock_putaway_list").id
|
||||
|
||||
def _stock_putaway_rule_product(self, location, product):
|
||||
rule = self.putawayRuleObj.create(
|
||||
{
|
||||
"company_id": location.company_id.id,
|
||||
"product_id": product.id,
|
||||
"location_in_id": location.id,
|
||||
"location_out_id": location.id,
|
||||
}
|
||||
)
|
||||
self.assertEqual(rule.location_in_id, location)
|
||||
self.assertEqual(rule.product_tmpl_id, product.product_tmpl_id)
|
||||
self.assertEqual(rule.product_id, product)
|
||||
return rule
|
||||
|
||||
def _get_product_rules(self, product):
|
||||
return self.putawayRuleObj.search(
|
||||
product.action_view_related_putaway_rules()["domain"]
|
||||
)
|
||||
|
||||
def test_apply_putaway(self):
|
||||
# Create one strategy line for product template and other with a
|
||||
# specific variant
|
||||
location = self.env.ref("stock.stock_location_shop0")
|
||||
location1 = location.copy(
|
||||
{"name": "Location test 1", "location_id": location.id}
|
||||
)
|
||||
location2 = location.copy(
|
||||
{"name": "Location test 2", "location_id": location.id}
|
||||
)
|
||||
# Create rule according to product_tmpl_id
|
||||
rule_product = self.putawayRuleObj.create(
|
||||
{
|
||||
"company_id": location1.company_id.id,
|
||||
"product_tmpl_id": self.template.id,
|
||||
"location_in_id": location1.id,
|
||||
"location_out_id": location1.id,
|
||||
}
|
||||
)
|
||||
self.assertEqual(rule_product.location_in_id, location1)
|
||||
self.assertEqual(rule_product.product_tmpl_id, self.template)
|
||||
self.assertEqual(rule_product.product_id.id, False)
|
||||
# Create rules related to variants and diferente locations
|
||||
variant1 = self.template.product_variant_ids[0]
|
||||
variant2 = self.template.product_variant_ids[1]
|
||||
variant3 = self.template.product_variant_ids[2]
|
||||
self._stock_putaway_rule_product(location1, variant1)
|
||||
self._stock_putaway_rule_product(location2, variant2)
|
||||
# Create rule according to category
|
||||
rule_category = self.putawayRuleObj.create(
|
||||
{
|
||||
"company_id": location1.company_id.id,
|
||||
"category_id": self.template.categ_id.id,
|
||||
"location_in_id": location1.id,
|
||||
"location_out_id": location1.id,
|
||||
}
|
||||
)
|
||||
self.assertEqual(rule_category.category_id, self.template.categ_id)
|
||||
self.assertEqual(rule_category.location_in_id, location1)
|
||||
self.assertEqual(rule_category.product_tmpl_id.id, False)
|
||||
self.assertEqual(rule_category.product_id.id, False)
|
||||
# Check rules related
|
||||
self.assertEqual(len(self._get_product_rules(self.template)), 4)
|
||||
self.assertEqual(len(self._get_product_rules(variant1)), 2)
|
||||
self.assertEqual(len(self._get_product_rules(variant2)), 2)
|
||||
self.assertEqual(len(self._get_product_rules(variant3)), 1)
|
||||
# Check _get_putaway_strategy
|
||||
locations = location + location.child_ids
|
||||
self.assertEqual(locations._get_putaway_strategy(variant1), location1)
|
||||
self.assertEqual(locations._get_putaway_strategy(variant2), location2)
|
||||
self.assertEqual(locations._get_putaway_strategy(variant3), location1)
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3). -->
|
||||
<odoo>
|
||||
<record id="stock_putaway_list" model="ir.ui.view">
|
||||
<field name="name">Add product_tmpl_id field</field>
|
||||
<field name="model">stock.putaway.rule</field>
|
||||
<field name="inherit_id" ref="stock.stock_putaway_list" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_id" position="attributes">
|
||||
<attribute name="readonly">False</attribute>
|
||||
<attribute
|
||||
name="attrs"
|
||||
>{'readonly': [('category_id', '!=', False)], 'required': [('category_id', '=', False),('product_tmpl_id', '=', False)]}</attribute>
|
||||
</field>
|
||||
<field name="category_id" position="attributes">
|
||||
<attribute name="readonly">False</attribute>
|
||||
<attribute
|
||||
name="attrs"
|
||||
>{'readonly': ['|', ('product_id', '!=', False), ('product_tmpl_id', '!=', False)], 'required': [('product_id', '=', False),('product_tmpl_id', '=', False)]}</attribute>
|
||||
</field>
|
||||
<field name="product_id" position="before">
|
||||
<field
|
||||
name="product_tmpl_id"
|
||||
attrs="{'readonly': [('category_id', '!=', False)], 'required': [('category_id', '=', False), ('product_id', '=', False)]}"
|
||||
options="{'no_create': True, 'no_open': True}"
|
||||
force_save="1"
|
||||
/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user