Compare commits

..

8 Commits

Author SHA1 Message Date
Mathieu
fabd6a22ee [ADD] separator on filter view 2024-06-13 12:55:46 +02:00
Mathieu
2fe51c6d2c [UPD] code review 2024-06-12 16:25:37 +02:00
Mathieu
c530942344 [UPD] remove compute function 2024-06-12 15:36:02 +02:00
Mathieu
5afdbd02a9 [ADD] purchase_report_date_planned 2024-06-12 15:14:51 +02:00
Alexis de Lattre
73e700d2d2 delivery_usability: Move code from stock_packaging_usability_pp to delivery_usability
I don't use stock_packaging_usability_pp from OCA/stock-logistics-tracking because the feature is native since v11 (I didn't figure it out when I ported stock_packaging_usability_ul from v10 to v14 under the new name stock_packaging_usability_ul
I also improved the code to clean it up and use the native field for measured weight
2024-06-04 15:54:22 +02:00
Benoit
5144b039a5 fix report name when deleting attachment invoice with button draft 2024-05-28 11:51:11 +02:00
Florian
0e237d26cb Merge pull request #208 from akretion/14-account-usability-fix-statement-back-to-draft
Revert "account_usability: reset to draft the bank statement do not unreconcile items
2024-05-28 11:26:45 +02:00
Florian da Costa
b867dd6d01 Revert "account_usability: reset to draft the bank statement do not unreconcile"
This reverts commit 85f8fe5b30.
2024-02-08 11:27:45 +01:00
26 changed files with 732 additions and 211 deletions

View File

@@ -43,13 +43,6 @@ class AccountBankStatement(models.Model):
res.append((statement.id, name))
return res
def button_reopen(self):
self = self.with_context(skip_undo_reconciliation=True)
return super().button_reopen()
def button_undo_reconciliation(self):
self.line_ids.button_undo_reconciliation()
class AccountBankStatementLine(models.Model):
_inherit = 'account.bank.statement.line'
@@ -96,9 +89,3 @@ class AccountBankStatementLine(models.Model):
'res_id': self.move_id.id,
})
return action
def button_undo_reconciliation(self):
if self._context.get("skip_undo_reconciliation"):
return
else:
return super().button_undo_reconciliation()

View File

@@ -10,6 +10,8 @@ from odoo.exceptions import UserError, ValidationError
from odoo.osv import expression
from odoo.tools import float_is_zero
from odoo.tools.misc import format_date
from odoo.tools.safe_eval import safe_eval, time
from collections import defaultdict
_logger = logging.getLogger(__name__)
@@ -223,13 +225,11 @@ class AccountMove(models.Model):
move.suitable_journal_ids = self.env['account.journal'].search(domain)
def button_draft(self):
# Get report name before reset to draft because name can be different.
report_names = self._get_invoice_attachment_name()
super().button_draft()
# Delete attached pdf invoice
try:
report_invoice = self.env['ir.actions.report']._get_report_from_name('account.report_invoice')
except IndexError:
report_invoice = False
if report_invoice and report_invoice.attachment:
if report_names:
for move in self.filtered(lambda x: x.move_type in ('out_invoice', 'out_refund')):
# The pb is that the filename is dynamic and related to move.state
# in v12, the feature was native and they used that kind of code:
@@ -239,7 +239,7 @@ class AccountMove(models.Model):
# But do_in_draft() doesn't exists in v14
# If you know how we could do that, please update the code below
attachment = self.env['ir.attachment'].search([
('name', '=', self._get_invoice_attachment_name()),
('name', 'in', report_names[move.id]),
('res_id', '=', move.id),
('res_model', '=', self._name),
('type', '=', 'binary'),
@@ -248,8 +248,22 @@ class AccountMove(models.Model):
attachment.unlink()
def _get_invoice_attachment_name(self):
self.ensure_one()
return '%s.pdf' % (self.name and self.name.replace('/', '_') or 'INV')
report_names = defaultdict(list)
try:
report_invoice = self.env['ir.actions.report']._get_report_from_name('account.report_invoice')
except IndexError:
report_invoice = False
if report_invoice and report_invoice.attachment:
for move in self.filtered(lambda x: x.move_type in ('out_invoice', 'out_refund')):
report_names[move.id].append(safe_eval(report_invoice.print_report_name, {'object': self, 'time': time}))
try:
report_invoice = self.env['ir.actions.report']._get_report_from_name('account.report_invoice_with_payments')
except IndexError:
report_invoice = False
if report_invoice and report_invoice.attachment:
for move in self.filtered(lambda x: x.move_type in ('out_invoice', 'out_refund')):
report_names[move.id].append(safe_eval(report_invoice.print_report_name, {'object': self, 'time': time}))
return report_names
def _get_accounting_date(self, invoice_date, has_tax):
# On vendor bills/refunds, we want date = invoice_date unless

View File

@@ -16,14 +16,6 @@
<button name="button_reopen" position="attributes">
<attribute name="confirm">Are you sure ? Don't do 'Reset to New' if you just want to modify the bank journal entry of an existing statement line.</attribute>
</button>
<button name="button_reopen" position="after">
<button
name="button_undo_reconciliation"
type="object"
confirm="Are you sure to unreconcile all the entries of the bank statement?"
states="open"
string="Unreconcile All"/>
</button>
<xpath expr="//field[@name='line_ids']/tree/button[@name='button_undo_reconciliation']" position="after">
<field name="move_id" invisible="1"/>
<button name="show_account_move" type="object"

View File

@@ -22,6 +22,7 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
'depends': ['delivery'],
'data': [
'views/stock_picking.xml',
'views/product_packaging.xml',
],
'installable': True,
}

View File

@@ -1 +1,4 @@
from . import product_packaging
from . import stock_picking
from . import stock_move
from . import stock_quant_package

View File

@@ -0,0 +1,31 @@
# Copyright 2018-2021 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ProductPackaging(models.Model):
_inherit = 'product.packaging'
# product.packaging is defined in the 'product' module and enhanced in the 'delivery' module
# I used to make the improvements on the datamodel of product.packaging in the OCA module
# 'stock_packaging_usability_pp' from OCA/stock-logistics-tracking,
# but I eventually figured out that the feature provided by 'stock_packaging_usability_pp'
# was native in the 'delivery' module via the wizard choose.delivery.package.
# So I stopped using 'stock_packaging_usability_pp' and I moved the datamodel changes
# here in the module 'delivery_usability'
name = fields.Char(translate=True)
weight = fields.Float(digits="Stock Weight", string="Empty Package Weight")
active = fields.Boolean(default=True)
# packaging_type is important, in particular for pallets for which
# we need a special implementation to enter the height
packaging_type = fields.Selection(
[
("unit", "Unit"),
("pack", "Pack"),
("box", "Box"),
("pallet", "Pallet"),
],
string="Type",
)

View File

@@ -0,0 +1,23 @@
# Copyright 2019 Akretion France (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, models
class StockMove(models.Model):
_inherit = "stock.move"
# Fixing bug https://github.com/odoo/odoo/issues/34702
@api.depends("product_id", "product_uom_qty", "product_uom")
def _cal_move_weight(self):
weight_uom_categ = self.env.ref("uom.product_uom_categ_kgm")
kg_uom = self.env.ref("uom.product_uom_kgm")
for move in self:
if move.product_id.uom_id.category_id == weight_uom_categ:
move.weight = move.product_id.uom_id._compute_quantity(
move.product_qty, kg_uom
)
else:
move.weight = move.product_qty * move.product_id.weight

View File

@@ -0,0 +1,68 @@
# Copyright 2019-2024 Akretion France (https://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
from odoo.tools import float_is_zero
class StockQuantPackage(models.Model):
_inherit = "stock.quant.package"
# These 2 fields are defined in the 'delivery' module but they forgot
# the decimal precision
shipping_weight = fields.Float(digits="Stock Weight")
weight = fields.Float(digits="Stock Weight")
# Fixing bug https://github.com/odoo/odoo/issues/34702
# and take into account the weight of the packaging
# WARNING: this method _compute_weight() is also inherited by the OCA module
# base_delivery_carrier_label so if you use that module, you should copy
# that piece of code in a custom module that depend on delivery_usability
# and base_delivery_carrier_label
def _compute_weight(self):
smlo = self.env["stock.move.line"]
weight_uom_categ = self.env.ref("uom.product_uom_categ_kgm")
kg_uom = self.env.ref("uom.product_uom_kgm")
weight_prec = self.env['decimal.precision'].precision_get('Stock Weight')
for package in self:
# if the weight of the package has been measured,
# it is written in shipping_weight
if not float_is_zero(package.shipping_weight, precision_digits=weight_prec):
weight = package.shipping_weight
# otherwise, we compute the theorical weight from the weight of the products
# and the weight of the packaging
# Since Odoo v11, consu products don't create quants, so I can't loop
# on pack.quant_ids to get all the items inside a package: I have to
# get the picking, then loop on the stock.move.line of that picking
# linked to that package
else:
weight = 0.0
# the package can be seen in a return
# So I get the picking of it's first appearance
domain = [
("result_package_id", "=", package.id),
("product_id", "!=", False),
]
first_move_line = smlo.search(
domain + [('picking_id', '!=', False)], limit=1, order='id')
if first_move_line:
picking_id = first_move_line.picking_id.id
current_picking_move_line_ids = smlo.search(
domain + [("picking_id", "=", picking_id)])
for ml in current_picking_move_line_ids:
if ml.product_uom_id.category_id == weight_uom_categ:
weight += ml.product_uom_id._compute_quantity(
ml.qty_done, kg_uom
)
else:
weight += (
ml.product_uom_id._compute_quantity(
ml.qty_done, ml.product_id.uom_id
)
* ml.product_id.weight
)
if package.packaging_id:
weight += package.packaging_id.weight
package.weight = weight

View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2019-2024 Akretion France (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<!-- I don't know why the form view of product.packaging in the delivery
module has "<field name="inherit_id" eval="False"/>"
instead of a standard inherit of product.product_packaging_form_view -->
<record id="product_packaging_delivery_form" model="ir.ui.view">
<field name="name">stock_packaging_usability_pp.product.packaging.form</field>
<field name="model">product.packaging</field>
<field name="inherit_id" ref="delivery.product_packaging_delivery_form" />
<field name="arch" type="xml">
<field name="package_carrier_type" position="after">
<field name="packaging_type" />
<field name="active" invisible="1" />
</field>
<label for="max_weight" position="before">
<label for="weight" />
<div class="o_row" name="weight">
<field name="weight" />
<span><field name="weight_uom_name" /></span>
</div>
</label>
<label for="name" position="before">
<widget
name="web_ribbon"
title="Archived"
bg_color="bg-danger"
attrs="{'invisible': [('active', '=', True)]}"
/>
</label>
</field>
</record>
<record id="product_packaging_delivery_tree" model="ir.ui.view">
<field name="name">stock_packaging_usability_pp.product.packaging.tree</field>
<field name="model">product.packaging</field>
<field name="inherit_id" ref="delivery.product_packaging_delivery_tree" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="packaging_type" optional="show" />
</field>
<field name="max_weight" position="before">
<field name="weight" optional="show" />
</field>
</field>
</record>
<!-- There is no native serch view for product.packaging -->
<record id="product_packaging_search" model="ir.ui.view">
<field name="name">product.packaging.search</field>
<field name="model">product.packaging</field>
<field name="arch" type="xml">
<search>
<field name="name" />
<separator />
<filter
string="Archived"
name="inactive"
domain="[('active', '=', False)]"
/>
<group name="groupby">
<filter
name="packaging_type_groupby"
string="Packaging Type"
context="{'group_by': 'packaging_type'}"
/>
</group>
</search>
</field>
</record>
</odoo>

View File

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

View File

@@ -0,0 +1,20 @@
# Copyright 2024 Akretion (https://www.akretion.com).
# @author Mathieu Delva <mathieu.delva@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Purchase Report Date Planned",
"version": "14.0.1.1.0",
"author": "Akretion ,Odoo Community Association (OCA)",
"maintainers": ["mathieudelva"],
"website": "https://github.com/OCA/purchase-workflow",
"category": "Purchase",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"purchase_usability",
],
"data": [
"views/purchase_report.xml",
],
}

View File

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

View File

@@ -0,0 +1,15 @@
from odoo import fields, models
class PurchaseReport(models.Model):
_inherit = "purchase.report"
date_planned = fields.Datetime(store=True)
def _select(self):
select_str = super()._select()
return select_str + ", l.date_planned as date_planned"
def _group_by(self):
group_by_str = super()._group_by()
return group_by_str + ", l.date_planned"

View File

@@ -0,0 +1 @@
* Mathieu Delva <mathieu.delva@akretion.com>

View File

@@ -0,0 +1 @@
This module add the field date_planned on purchase report model, purchase report tree view and add a filter that allows you to display orders that are late for delivery

View File

@@ -0,0 +1,425 @@
<!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>Purchase Report Date Planned</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="purchase-report-date-planned">
<h1 class="title">Purchase Report Date Planned</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:5b4d315e1329bf5a241110f6470bdde81407d7bad14c0e687c590a92a80ea414
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/purchase-workflow/tree/14.0/purchase_report_date_planned"><img alt="OCA/purchase-workflow" src="https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/purchase-workflow-14-0/purchase-workflow-14-0-purchase_report_date_planned"><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/purchase-workflow&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module add the field date_planned on purchase report model, purchase report tree view and add a filter that allows you to display orders that are late for delivery</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-5">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/purchase-workflow/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/purchase-workflow/issues/new?body=module:%20purchase_report_date_planned%0Aversion:%2014.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-2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<ul class="simple">
<li>Akretion</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<ul class="simple">
<li>Mathieu Delva &lt;<a class="reference external" href="mailto:mathieu.delva&#64;akretion.com">mathieu.delva&#64;akretion.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-5">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 image-reference" href="https://github.com/mathieudelva"><img alt="mathieudelva" src="https://github.com/mathieudelva.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/purchase-workflow/tree/14.0/purchase_report_date_planned">OCA/purchase-workflow</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,41 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="purchase_report_tree_view" model="ir.ui.view">
<field name="model">purchase.report</field>
<field name="inherit_id" ref="purchase_usability.view_purchase_order_tree" />
<field name="arch" type="xml">
<field name="date_order" position="before">
<field name="date_planned" optional="hide" />
</field>
</field>
</record>
<record model="ir.ui.view" id="purchase_report_search_view">
<field name="name">purchase.report.search</field>
<field name="model">purchase.report</field>
<field name="inherit_id" ref="purchase.view_purchase_order_search" />
<field name="arch" type="xml">
<filter name="later_than_a_year_ago" position="after">
<separator/>
</filter>
<filter name="filter_date_order" position="after">
<separator/>
</filter>
<filter name="filter_date_approve" position="after">
<separator/>
</filter>
<filter name="orders" position="after">
<separator/>
<filter
name="late"
string="En Retard"
domain="[('state','=','purchase'), ('date_planned','&lt;', datetime.date.today().strftime('%Y-%m-%d'))]"
/>
<separator/>
</filter>
</field>
</record>
</odoo>

View File

@@ -1,2 +0,0 @@
from . import models
from .hooks import post_init_hook

View File

@@ -1,14 +0,0 @@
# Copyright 2024 Akretion
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Stock Location Simple",
"summary": "Simplified stock.location menu",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "Akretion",
"website": "http://akretion.com",
"depends": ["stock"],
"data": ["views/stock_location_views.xml"],
"post_init_hook": "post_init_hook",
}

View File

@@ -1,10 +0,0 @@
# Copyright 2021 Akretion (https://www.akretion.com).
# @author Sébastien BEAU <sebastien.beau@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import SUPERUSER_ID, api
def post_init_hook(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
env["stock.warehouse"].search([])._check_locations_created_by_warehouse()

View File

@@ -1,2 +0,0 @@
from . import stock_location
from . import stock_warehouse

View File

@@ -1,10 +0,0 @@
# Copyright 2024 Akretion
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
class StockLocation(models.Model):
_inherit = "stock.location"
is_created_by_warehouse = fields.Boolean()

View File

@@ -1,34 +0,0 @@
# Copyright 2024 Akretion
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
import pprint
class StockWarehouse(models.Model):
_inherit = "stock.warehouse"
def _get_location_fields(self):
location_fields = []
for field, definition in self.fields_get().items():
if definition.get("relation") == "stock.location":
location_fields.append(field)
return location_fields
def _check_locations_created_by_warehouse(self):
location_ids = self.env["stock.location"]
location_fields = self._get_location_fields()
for rec in self:
for field in location_fields:
location_ids |= getattr(rec, field)
location_ids.write({"is_created_by_warehouse": True})
@api.model
def create(self, vals):
res = super().create(vals)
res._check_locations_created_by_warehouse()
return res

View File

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

View File

@@ -1,19 +0,0 @@
# Copyright 2018-2022 Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests import TransactionCase
class TestStockLocationSimple(TransactionCase):
def setUp(self):
super().setUp()
self.env["stock.warehouse"].search([])._check_locations_created_by_warehouse()
def test_location_checked_at_warehouse_creation(self):
warehouse = self.env["stock.warehouse"].create({"name": "Test", "code": "TEST"})
self.assertTrue(warehouse.view_location_id.is_created_by_warehouse)
def test_native_location_checked(self):
location_id = self.env.ref("stock.warehouse0").view_location_id
self.assertTrue(location_id.is_created_by_warehouse)

View File

@@ -1,90 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2024 Akretion
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="stock_location_simple_form_view" model="ir.ui.view">
<field name="name">stock.location.simple.form</field>
<field name="model">stock.location</field>
<field name="arch" type="xml">
<form string="Stock Location">
<sheet>
<div class="oe_button_box" name="button_box">
<button string="Current Stock"
class="oe_stat_button"
icon="fa-cubes" name="%(stock.location_open_quants)d" type="action"/>
</div>
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name"/>
</h1>
<label for="location_id" class="oe_edit_only"/>
<h2>
<field name="location_id" required="1" domain="[('usage', '=', 'internal')]"/>
</h2>
<group>
<field name="active" invisible="1"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<field name="comment" placeholder="External note..."/>
</sheet>
</form>
</field>
</record>
<record id="stock_location_simple_tree_view" model="ir.ui.view">
<field name="name">stock.location.simple.tree</field>
<field name="model">stock.location</field>
<field name="arch" type="xml">
<!-- TODO: decoration info if lockdown, if view, if linked to a warehouse -->
<tree string="Stock Location">
<field name="active" invisible="1"/>
<field name="complete_name" string="Location"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>
<record id="stock_location_simple_act_window" model="ir.actions.act_window">
<field name="name">Stock Location</field>
<field name="res_model">stock.location</field>
<field name="view_mode">tree,form</field>
<field name="domain">[("usage", "=", "internal")]</field>
</record>
<record id="stock_location_simple_act_window_tree" model="ir.actions.act_window.view" >
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="stock_location_simple_tree_view"/>
<field name="act_window_id" ref="stock_location_simple_act_window"/>
</record>
<record id="stock_location_simple_act_window_form" model="ir.actions.act_window.view" >
<field name="sequence" eval="3"/>
<field name="view_mode">form</field>
<field name="view_id" ref="stock_location_simple_form_view"/>
<field name="act_window_id" ref="stock_location_simple_act_window"/>
</record>
<record id="stock_location_simple_menu" model="ir.ui.menu">
<field name="name">Locations</field>
<field name="parent_id" ref="stock.menu_warehouse_config"/>
<field name="action" ref="stock_location_simple_act_window"/>
<field name="sequence" eval="0"/>
<field name="groups_id" eval="[(4, ref('stock.group_stock_multi_locations'))]" />
</record>
<!-- Modify name and groups_id on original stock.location menu -->
<record id="stock.menu_action_location_form" model="ir.ui.menu">
<field name="name">Locations Technical</field>
<field name="parent_id" ref="stock.menu_warehouse_config"/>
<field name="action" ref="stock.action_location_form"/>
<field name="sequence" eval="2"/>
<field name="groups_id" eval="[(4, ref('base.group_erp_manager'))]" />
</record>
</odoo>