Merge pull request #12 from bakeupboys/74-16.0-add_sale_order_batch_stock

74 16.0 add sale order batch stock
This commit is contained in:
madmooose 2024-07-25 22:27:54 +02:00 committed by GitHub
commit 76a0ba86b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 1316 additions and 18 deletions

6
.vscode/launch.json vendored
View file

@ -9,11 +9,11 @@
"program": "${config:odoo.path}/odoo-bin", "program": "${config:odoo.path}/odoo-bin",
"console": "integratedTerminal", "console": "integratedTerminal",
"args": [ "args": [
"--database=nfu_sale_order_batch", "--database=nfu_sale_order_batch_packaging",
"--addons-path=${config:odoo.addons_path},${workspaceFolder}", "--addons-path=${config:odoo.addons_path},${workspaceFolder}",
"--limit-time-real=0", "--limit-time-real=0",
"--limit-time-cpu=0", "--limit-time-cpu=0",
"--init=sale_order_batch", "--update=sale_order_batch_stock",
// "--update=", // "--update=",
"--dev=xml" "--dev=xml"
] ]
@ -31,7 +31,7 @@
"--addons-path=${config:odoo.addons_path}", "--addons-path=${config:odoo.addons_path}",
"--limit-time-real=0", "--limit-time-real=0",
"--limit-time-cpu=0", "--limit-time-cpu=0",
"--init=sale_order_batch", // "--init=",
// "--update=", // "--update=",
"--dev=xml" "--dev=xml"
] ]

View file

@ -2,5 +2,6 @@
"odoo.version": "16.0", "odoo.version": "16.0",
"odoo.path": "../../versions/${config:odoo.version}/odoo", "odoo.path": "../../versions/${config:odoo.version}/odoo",
"odoo.addons_path": "${config:odoo.path}/addons", "odoo.addons_path": "${config:odoo.path}/addons",
"python.analysis.extraPaths": ["../../versions/16.0/odoo", "../../versions/16.0/OCA"] "python.analysis.extraPaths": ["../../versions/16.0/odoo", "../../versions/16.0/OCA"],
"python.languageServer": "None"
} }

View file

@ -0,0 +1,67 @@
========================
NFU Sale Order Packaging
========================
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:cf35c3a80aa0718148099036cd6a3dd60afb61acdb420573b1bd129be3ea2cf1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-bruecksen%2Fife_nfu-lightgray.png?logo=github
:target: https://github.com/bruecksen/ife_nfu/tree/16.0/nfu_sale_order_packaging
:alt: bruecksen/ife_nfu
|badge1| |badge2| |badge3|
This module adds a minium and a maximum order quantity field to Sale Orders
and adds a packaging default to sale order batch.
**Table of contents**
.. contents::
:local:
Changelog
=========
:1.0.0: Initial module.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/bruecksen/ife_nfu/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/bruecksen/ife_nfu/issues/new?body=module:%20nfu_sale_order_packaging%0Aversion:%2016.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
~~~~~~~
* BAKEUP
Contributors
~~~~~~~~~~~~
* Niels Göttsch <niels@ziemlichoptimal.de>
* Matthias Brück <hi@brueck.io>
Maintainers
~~~~~~~~~~~
This module is part of the `bruecksen/ife_nfu <https://github.com/bruecksen/ife_nfu/tree/16.0/nfu_sale_order_packaging>`_ project on GitHub.
You are welcome to contribute.

View file

@ -0,0 +1 @@
from . import models

View file

@ -0,0 +1,15 @@
{
"name": "NFU Sale Order Packaging",
"summary": "Add minimum and maximum order quantities to sale orders and use default packaging",
"author": "BAKEUP",
"website": "https://www.bakeup.org",
"category": "Sale",
"version": "16.0.0.0.1",
"depends": ["sale", "sale_order_batch"],
"data": [
"views/sale_order_views.xml",
"views/sale_order_batch_views.xml",
"views/sale_order_batch_product_views.xml",
],
"license": "LGPL-3",
}

View file

@ -0,0 +1,2 @@
from . import sale_order_line
from . import sale_order_batch_product

View file

@ -0,0 +1,27 @@
from odoo import api, fields, models
class SaleOrderBatchProduct(models.Model):
_inherit = "sale.order.batch.product"
open_packaging_qty = fields.Float(compute="_compute_open_packagin_qty")
@api.depends("sale_order_line_ids.product_uom_qty")
def _compute_open_packagin_qty(self):
for product in self:
open_packaging_qty = product.product_packaging_qty - (
sum(product.sale_order_line_ids.mapped("product_uom_qty")) % product.product_packaging_qty
)
product.open_packaging_qty = (
0 if open_packaging_qty == product.product_packaging_qty else open_packaging_qty
)
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if vals.get("product_id") and not vals.get("product_packaging_id"):
product_id = vals.get("product_id")
packaging = self.env["product.packaging"].search([("product_id", "=", product_id)], limit=1)
vals["product_packaging_id"] = packaging.id
return super().create(vals_list)

View file

@ -0,0 +1,20 @@
from odoo import _, api, fields, models
from odoo.exceptions import UserError
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
product_uom_ordered_qty = fields.Float(string="Ordered Qty", digits="Product Unit of Measure", default=1.0)
product_uom_max_qty = fields.Float(string="Max Qty", digits="Product Unit of Measure")
@api.constrains("product_uom_qty", "product_uom_max_qty")
def _check_product_uom_qty(self):
for order_line in self:
if order_line.product_uom_max_qty != 0 and order_line.product_uom_qty > order_line.product_uom_max_qty:
raise UserError(
_(
f"{order_line.order_id.name},{order_line.product_id.name}:"
"The quantity must be less than or equal to the maximum quantity."
)
)

View file

@ -0,0 +1,2 @@
* Niels Göttsch <niels@ziemlichoptimal.de>
* Matthias Brück <hi@brueck.io>

View file

@ -0,0 +1,2 @@
This module adds a minium and a maximum order quantity field to Sale Orders
and adds a packaging default to sale order batch.

View file

@ -0,0 +1 @@
:1.0.0: Initial module.

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -0,0 +1,430 @@
<!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>NFU Sale Order Packaging</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
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: gray; } /* 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, pre.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="nfu-sale-order-packaging">
<h1 class="title">NFU Sale Order Packaging</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:cf35c3a80aa0718148099036cd6a3dd60afb61acdb420573b1bd129be3ea2cf1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/bruecksen/ife_nfu/tree/16.0/nfu_sale_order_packaging"><img alt="bruecksen/ife_nfu" src="https://img.shields.io/badge/github-bruecksen%2Fife_nfu-lightgray.png?logo=github" /></a></p>
<p>This module adds a minium and a maximum order quantity field to Sale Orders
and adds a packaging default to sale order batch.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#changelog" id="toc-entry-1">Changelog</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="changelog">
<h1><a class="toc-backref" href="#toc-entry-1">Changelog</a></h1>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">1.0.0:</th><td class="field-body">Initial module.</td>
</tr>
</tbody>
</table>
</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/bruecksen/ife_nfu/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/bruecksen/ife_nfu/issues/new?body=module:%20nfu_sale_order_packaging%0Aversion:%2016.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>BAKEUP</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<ul class="simple">
<li>Niels Göttsch &lt;<a class="reference external" href="mailto:niels&#64;ziemlichoptimal.de">niels&#64;ziemlichoptimal.de</a>&gt;</li>
<li>Matthias Brück &lt;<a class="reference external" href="mailto:hi&#64;brueck.io">hi&#64;brueck.io</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/bruecksen/ife_nfu/tree/16.0/nfu_sale_order_packaging">bruecksen/ife_nfu</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_order_batch_product_form" model="ir.ui.view">
<field name="name">sale.order.batch.product.form.nfu</field>
<field name="model">sale.order.batch.product</field>
<field name="inherit_id" ref="sale_order_batch.view_order_batch_product_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='product_info']" position="inside">
<field name="open_packaging_qty" decoration-warning="(open_packaging_qty != 0)"/>
</xpath>
<xpath
expr="//field[@name='sale_order_line_ids']/tree/field[@name='product_uom_qty']"
position="before"
>
<field name="product_uom_ordered_qty" optional="hide"/>
</xpath>
<xpath
expr="//field[@name='sale_order_line_ids']/tree/field[@name='product_uom_qty']"
position="after"
>
<field name="product_uom_max_qty"/>
</xpath>
</field>
</record>
</odoo>

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_order_batch_form" model="ir.ui.view">
<field name="name">sale.order.batch.form.product.min_max_qty</field>
<field name="model">sale.order.batch</field>
<field name="inherit_id" ref="sale_order_batch.view_order_batch_form"/>
<field name="arch" type="xml">
<xpath
expr="//field[@name='sale_order_line_ids']/tree/field[@name='product_uom_qty']"
position="before"
>
<field name="product_uom_ordered_qty" optional="hide"/>
</xpath>
<xpath
expr="//field[@name='sale_order_line_ids']/tree/field[@name='product_uom_qty']"
position="after"
>
<field name="product_uom_max_qty"/>
</xpath>
<xpath expr="//field[@name='product_ids']/tree" position="inside">
<field name="open_packaging_qty" invisiable="True"/>
</xpath>
<xpath
expr="//field[@name='product_ids']/tree/field[@name='product_template_id']"
position="attributes"
>
<attribute name="decoration-warning">(open_packaging_qty != 0)</attribute>
</xpath>
</field>
</record>
</odoo>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_order_form_inherit_product_min_max_qty" model="ir.ui.view">
<field name="name">sale.order.form.product.min_max_qty</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='order_line']/tree/field[@name='product_uom_qty']" position="before">
<field name="product_uom_ordered_qty" optional="hide"/>
</xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='product_uom_qty']" position="after">
<field name="product_uom_max_qty"/>
</xpath>
</field>
</record>
</odoo>

View file

@ -9,6 +9,7 @@
"data": [ "data": [
"data/ir_sequence_data.xml", "data/ir_sequence_data.xml",
"views/sale_order_batch_views.xml", "views/sale_order_batch_views.xml",
"views/sale_order_batch_product_views.xml",
"views/sale_order_views.xml", "views/sale_order_views.xml",
"views/sale_menus.xml", "views/sale_menus.xml",
"security/ir.model.access.csv", "security/ir.model.access.csv",

View file

@ -47,6 +47,8 @@ class SaleOrderBatch(models.Model):
sale_order_ids = fields.One2many("sale.order", "batch_id") sale_order_ids = fields.One2many("sale.order", "batch_id")
sale_order_count = fields.Integer(compute="_compute_sale_order_count") sale_order_count = fields.Integer(compute="_compute_sale_order_count")
sale_order_line_ids = fields.Many2many("sale.order.line", compute="_compute_sale_order_line_ids", store=True) sale_order_line_ids = fields.Many2many("sale.order.line", compute="_compute_sale_order_line_ids", store=True)
invoice_ids = fields.Many2many("account.move", compute="_compute_invoice_ids")
invoice_count = fields.Integer(compute="_compute_invoice_ids")
amount_total = fields.Float(compute="_compute_amount_total", string="Total") amount_total = fields.Float(compute="_compute_amount_total", string="Total")
product_ids = fields.One2many("sale.order.batch.product", "batch_id") product_ids = fields.One2many("sale.order.batch.product", "batch_id")
product_count = fields.Integer(compute="_compute_product_count") product_count = fields.Integer(compute="_compute_product_count")
@ -60,17 +62,24 @@ class SaleOrderBatch(models.Model):
else: else:
batch.validity_date = False batch.validity_date = False
@api.depends("sale_order_ids")
def _compute_sale_order_count(self):
for batch in self:
batch.sale_order_count = len(batch.sale_order_ids)
@api.depends("sale_order_ids.order_line") @api.depends("sale_order_ids.order_line")
def _compute_sale_order_line_ids(self): def _compute_sale_order_line_ids(self):
for batch in self: for batch in self:
order_lines = self.env["sale.order.line"].search([("order_id", "in", batch.sale_order_ids.ids)]) order_lines = self.env["sale.order.line"].search([("order_id", "in", batch.sale_order_ids.ids)])
batch.sale_order_line_ids = order_lines batch.sale_order_line_ids = order_lines
@api.depends("sale_order_ids")
def _compute_sale_order_count(self):
for batch in self:
batch.sale_order_count = len(batch.sale_order_ids)
@api.depends("sale_order_ids.invoice_ids")
def _compute_invoice_ids(self):
for batch in self:
invoices = batch.sale_order_ids.mapped("invoice_ids")
batch.invoice_ids = invoices
batch.invoice_count = len(invoices)
@api.depends("sale_order_ids.amount_total") @api.depends("sale_order_ids.amount_total")
def _compute_amount_total(self): def _compute_amount_total(self):
for batch in self: for batch in self:
@ -113,6 +122,25 @@ class SaleOrderBatch(models.Model):
result = {"type": "ir.actions.act_window_close"} result = {"type": "ir.actions.act_window_close"}
return result return result
def action_view_invoice(self):
invoices = self.mapped("invoice_ids")
action = self.env["ir.actions.actions"]._for_xml_id("account.action_move_out_invoice_type")
if len(invoices) > 1:
action["domain"] = [("id", "in", invoices.ids)]
elif len(invoices) == 1:
form_view = [(self.env.ref("account.view_move_form").id, "form")]
if "views" in action:
action["views"] = form_view + [(state, view) for state, view in action["views"] if view != "form"]
else:
action["views"] = form_view
action["res_id"] = invoices.id
else:
action = {"type": "ir.actions.act_window_close"}
context = {"default_move_type": "out_invoice"}
action["context"] = context
return action
def action_confirm(self): def action_confirm(self):
for batch in self: for batch in self:
orders = batch.with_context(bypass_batch=True).sale_order_ids orders = batch.with_context(bypass_batch=True).sale_order_ids

View file

@ -14,16 +14,19 @@ class SaleOrderBatchProduct(models.Model):
ondelete="cascade", ondelete="cascade",
index=True, index=True,
copy=False, copy=False,
readonly=True,
) )
product_id = fields.Many2one(comodel_name="product.product", required=True, readonly=False) product_id = fields.Many2one(comodel_name="product.product", required=True, readonly=True)
product_template_id = fields.Many2one( product_template_id = fields.Many2one(
"product.template", related="product_id.product_tmpl_id", string="Product Template" "product.template", related="product_id.product_tmpl_id", string="Product Template"
) )
sale_order_line_ids = fields.Many2many("sale.order.line", compute="_compute_sale_order_line_ids") sale_order_line_ids = fields.Many2many(
"sale.order.line", compute="_compute_sale_order_line_ids", store=True, readonly=False
)
product_uom_category_id = fields.Many2one(related="product_id.uom_id.category_id", depends=["product_id"]) product_uom_category_id = fields.Many2one(related="product_id.uom_id.category_id", depends=["product_id"])
product_uom_qty = fields.Float(compute="_compute_uom_qty") product_uom_qty = fields.Float(compute="_compute_uom_qty", string="Quantity")
product_uom = fields.Many2one(related="product_id.uom_id") product_uom = fields.Many2one(related="product_id.uom_id")
product_packaging_id = fields.Many2one("product.packaging") product_packaging_id = fields.Many2one("product.packaging")
product_packaging_qty = fields.Float(compute="_compute_product_packaging_qty") product_packaging_qty = fields.Float(compute="_compute_product_packaging_qty")
@ -35,7 +38,7 @@ class SaleOrderBatchProduct(models.Model):
lambda o: o.product_id == product.product_id lambda o: o.product_id == product.product_id
) )
@api.depends("batch_id.sale_order_line_ids") @api.depends("sale_order_line_ids.product_uom_qty")
def _compute_uom_qty(self): def _compute_uom_qty(self):
for product in self: for product in self:
product.product_uom_qty = sum(product.sale_order_line_ids.mapped("product_uom_qty")) product.product_uom_qty = sum(product.sale_order_line_ids.mapped("product_uom_qty"))

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_order_batch_product_form" model="ir.ui.view">
<field name="name">sale.order.batch.product.form</field>
<field name="model">sale.order.batch.product</field>
<field name="arch" type="xml">
<form>
<sheet>
<div class="oe_button_box" name="button_box">
</div>
<h1>
<field name="product_id"/>
</h1>
<group>
<group name="product_info">
<field name="batch_id"/>
<field name="product_uom_qty"/>
</group>
<group name="packaging_info">
<field name="product_packaging_id"/>
<field name="product_packaging_qty"/>
</group>
</group>
<notebook>
<page string="Sale Order Lines" name="order_line">
<field name="sale_order_line_ids" widget="section_and_note_one2many">
<tree editable="bottom" create="0">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="order_partner_id"/>
<field name="product_uom_qty"/>
<field name="price_unit"/>
<field name="price_subtotal"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
</odoo>

View file

@ -29,6 +29,19 @@
type="object" type="object"
attrs="{'invisible': [('state', '!=','open')]}" attrs="{'invisible': [('state', '!=','open')]}"
/> />
<button
id="create_invoices"
name="%(sale.action_view_sale_advance_payment_inv)d"
string="Create Invoices"
type="action"
class="btn-primary"
context="{
'default_sale_order_ids': sale_order_ids,
}"
data-hotkey="q"
attrs="{'invisible': [('state', '!=', 'closed')]}"
/>
<field name="state" widget="statusbar" options="{'clickable': 'true'}"/> <field name="state" widget="statusbar" options="{'clickable': 'true'}"/>
</header> </header>
<div <div
@ -58,6 +71,15 @@
> >
<field string="Products" name="product_count" widget="statinfo"/> <field string="Products" name="product_count" widget="statinfo"/>
</button> </button>
<button
name="action_view_invoice"
type="object"
class="oe_stat_button"
icon="fa-pencil-square-o"
attrs="{'invisible': [('invoice_count', '=', 0)]}"
>
<field name="invoice_count" widget="statinfo" string="Invoices"/>
</button>
</div> </div>
<h1> <h1>
<field name="name"/> <field name="name"/>
@ -76,13 +98,21 @@
<field <field
name="sale_order_ids" name="sale_order_ids"
domain="[('state','in',['draft','sent']),('batch_id','=',False)]" domain="[('state','in',['draft','sent']),('batch_id','=',False)]"
attrs="{'readonly': [('state', 'in', ('closed'))]}"
> >
<tree> <tree>
<field name="name"/>
<field name="partner_id"/> <field name="partner_id"/>
<field name="date_order"/> <field name="date_order"/>
<field name="amount_untaxed"/> <field name="amount_untaxed"/>
<field name="amount_total"/> <field name="amount_total"/>
<field
name="invoice_status"
decoration-success="invoice_status == 'invoiced'"
decoration-info="invoice_status == 'to invoice'"
decoration-warning="invoice_status == 'upselling'"
widget="badge"
optional="show"
/>
</tree> </tree>
</field> </field>
</page> </page>
@ -94,8 +124,9 @@
> >
<tree editable="bottom"> <tree editable="bottom">
<field name="sequence" widget="handle"/> <field name="sequence" widget="handle"/>
<field name="order_id"/>
<field name="order_partner_id"/> <field name="order_partner_id"/>
<field name="product_template_id"/> <field name="product_template_id" optional="hide"/>
<field name="name"/> <field name="name"/>
<field name="product_uom_qty"/> <field name="product_uom_qty"/>
<field name="price_unit"/> <field name="price_unit"/>
@ -105,7 +136,7 @@
</page> </page>
<page string="Products" name="products"> <page string="Products" name="products">
<field name="product_ids"> <field name="product_ids">
<tree create="0" editable="1"> <tree create="0">
<field name="product_template_id"/> <field name="product_template_id"/>
<field name="product_uom_qty"/> <field name="product_uom_qty"/>
<field name="product_packaging_qty" groups="product.group_stock_packaging"/> <field name="product_packaging_qty" groups="product.group_stock_packaging"/>

View file

@ -0,0 +1,65 @@
==============================
Sale Order Batch Stock Binding
==============================
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c32b4440b58e98f3bea5539d78dfa2916d64aebc757c140d78b67b2a2ce288da
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-bruecksen%2Fife_nfu-lightgray.png?logo=github
:target: https://github.com/bruecksen/ife_nfu/tree/16.0/sale_order_batch_stock
:alt: bruecksen/ife_nfu
|badge1| |badge2| |badge3|
This module adds Deliverys to Sale ORder Batch Views.
**Table of contents**
.. contents::
:local:
Changelog
=========
:0.0.1: Initial module.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/bruecksen/ife_nfu/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/bruecksen/ife_nfu/issues/new?body=module:%20sale_order_batch_stock%0Aversion:%2016.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
~~~~~~~
* BAKEUP
Contributors
~~~~~~~~~~~~
* Niels Göttsch <niels@ziemlichoptimal.de>
Maintainers
~~~~~~~~~~~
This module is part of the `bruecksen/ife_nfu <https://github.com/bruecksen/ife_nfu/tree/16.0/sale_order_batch_stock>`_ project on GitHub.
You are welcome to contribute.

View file

@ -0,0 +1 @@
from . import models

View file

@ -0,0 +1,12 @@
{
"name": "Sale Order Batch Stock Binding",
"summary": "Sale Order Batch Stock Bindingh",
"author": "BAKEUP",
"website": "https://www.bakeup.org",
"category": "hidden",
"version": "16.0.0.0.1",
"depends": ["sale_order_batch", "sale_stock"],
"data": ["views/sale_order_batch_views.xml"],
"autoinstall": "True",
"license": "LGPL-3",
}

View file

@ -0,0 +1 @@
from . import sale_order_batch

View file

@ -0,0 +1,21 @@
from odoo import api, fields, models
STATES = [("open", "Open"), ("close", "Close")]
class SaleOrderBatch(models.Model):
_inherit = "sale.order.batch"
picking_ids = fields.Many2many("stock.picking", compute="_compute_picking_ids", string="Transfers")
delivery_count = fields.Integer(string="Delivery Orders", compute="_compute_picking_ids")
@api.depends("sale_order_ids.picking_ids")
def _compute_picking_ids(self):
for batch in self:
pickings = batch.sale_order_ids.mapped("picking_ids")
batch.picking_ids = pickings
batch.delivery_count = len(pickings)
def action_view_delivery(self):
return self.env["sale.order"]._get_action_view_picking(self.picking_ids)

View file

@ -0,0 +1 @@
* Niels Göttsch <niels@ziemlichoptimal.de>

View file

@ -0,0 +1 @@
This module adds Deliverys to Sale ORder Batch Views.

View file

@ -0,0 +1 @@
:0.0.1: Initial module.

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -0,0 +1,428 @@
<!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>Sale Order Batch Stock Binding</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
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: gray; } /* 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, pre.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="sale-order-batch-stock-binding">
<h1 class="title">Sale Order Batch Stock Binding</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c32b4440b58e98f3bea5539d78dfa2916d64aebc757c140d78b67b2a2ce288da
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/bruecksen/ife_nfu/tree/16.0/sale_order_batch_stock"><img alt="bruecksen/ife_nfu" src="https://img.shields.io/badge/github-bruecksen%2Fife_nfu-lightgray.png?logo=github" /></a></p>
<p>This module adds Deliverys to Sale ORder Batch Views.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#changelog" id="toc-entry-1">Changelog</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="changelog">
<h1><a class="toc-backref" href="#toc-entry-1">Changelog</a></h1>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">0.0.1:</th><td class="field-body">Initial module.</td>
</tr>
</tbody>
</table>
</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/bruecksen/ife_nfu/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/bruecksen/ife_nfu/issues/new?body=module:%20sale_order_batch_stock%0Aversion:%2016.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>BAKEUP</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<ul class="simple">
<li>Niels Göttsch &lt;<a class="reference external" href="mailto:niels&#64;ziemlichoptimal.de">niels&#64;ziemlichoptimal.de</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/bruecksen/ife_nfu/tree/16.0/sale_order_batch_stock">bruecksen/ife_nfu</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_order_batch_form" model="ir.ui.view">
<field name="name">sale.order.batch.form.stock</field>
<field name="model">sale.order.batch</field>
<field name="inherit_id" ref="sale_order_batch.view_order_batch_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_view_invoice']" position="before">
<button
type="object"
name="action_view_delivery"
class="oe_stat_button"
icon="fa-truck"
attrs="{'invisible': [('delivery_count', '=', 0)]}"
groups="stock.group_stock_user"
>
<field name="delivery_count" widget="statinfo" string="Delivery"/>
</button>
</xpath>
</field>
</record>
</odoo>