Compare commits
6 Commits
14.0-accou
...
14-fix-mig
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79f76c40f2 | ||
|
|
fd31627fa6 | ||
|
|
2863de99f4 | ||
|
|
16ed41187f | ||
|
|
7129dd1cce | ||
|
|
2e267d717f |
@@ -112,6 +112,16 @@ class AccountMove(models.Model):
|
|||||||
# self.invalidate_cache()
|
# self.invalidate_cache()
|
||||||
# return res
|
# return res
|
||||||
|
|
||||||
|
def _reverse_moves(self, default_values_list=None, cancel=False):
|
||||||
|
reverse_moves = super()._reverse_moves(
|
||||||
|
default_values_list=default_values_list, cancel=cancel)
|
||||||
|
# In the simple scenario 1 invoice -> 1 refund, we add a message in the chatter
|
||||||
|
# of the invoice and in the chatter of the refund
|
||||||
|
if len(self) == 1 and len(reverse_moves) == 1:
|
||||||
|
self.message_post(body=_("A reverse journal entry <a href=# data-oe-model=account.move data-oe-id=%d>%s</a> has been generated.") % (reverse_moves.id, reverse_moves.display_name))
|
||||||
|
reverse_moves.message_post(body=_("This journal entry has been generated as the reverse of <a href=# data-oe-model=account.move data-oe-id=%d>%s</a>.") % (self.id, self.display_name))
|
||||||
|
return reverse_moves
|
||||||
|
|
||||||
def delete_lines_qty_zero(self):
|
def delete_lines_qty_zero(self):
|
||||||
lines = self.env['account.move.line'].search([
|
lines = self.env['account.move.line'].search([
|
||||||
('display_type', '=', False),
|
('display_type', '=', False),
|
||||||
@@ -260,18 +270,23 @@ class AccountMoveLine(models.Model):
|
|||||||
def update_matching_number(self):
|
def update_matching_number(self):
|
||||||
records = self.search([("matching_number", "=", "P")])
|
records = self.search([("matching_number", "=", "P")])
|
||||||
_logger.info(f"Update partial reconcile number for {len(records)} lines")
|
_logger.info(f"Update partial reconcile number for {len(records)} lines")
|
||||||
records._compute_matching_number()
|
records.compute_partial_matching_number()
|
||||||
|
|
||||||
def _compute_matching_number(self):
|
def compute_partial_matching_number(self):
|
||||||
# TODO maybe it will be better to have the same maching_number for
|
# TODO maybe it will be better to have the same maching_number for
|
||||||
# all partial so it will be easier to group by
|
# all partial so it will be easier to group by
|
||||||
super()._compute_matching_number()
|
|
||||||
for record in self:
|
for record in self:
|
||||||
if record.matching_number == "P":
|
if record.matching_number == "P":
|
||||||
record.matching_number = ", ".join([
|
matching_number = ", ".join([
|
||||||
"a%d" % pr.id
|
"a%d" % pr.id
|
||||||
for pr in record.matched_debit_ids + record.matched_credit_ids
|
for pr in record.matched_debit_ids + record.matched_credit_ids
|
||||||
])
|
])
|
||||||
|
# use sql to avoid triggering python checks
|
||||||
|
self.env.cr.execute(
|
||||||
|
"""
|
||||||
|
UPDATE account_move_line SET matching_number = %s WHERE id = %s
|
||||||
|
""", (matching_number, record.id)
|
||||||
|
)
|
||||||
|
|
||||||
def _get_computed_name(self):
|
def _get_computed_name(self):
|
||||||
# This is useful when you want to have the product code in a dedicated
|
# This is useful when you want to have the product code in a dedicated
|
||||||
|
|||||||
@@ -26,18 +26,19 @@
|
|||||||
<field name="model">purchase.report</field>
|
<field name="model">purchase.report</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree>
|
<tree>
|
||||||
|
<field name="order_id" optional="show"/>
|
||||||
<field name="commercial_partner_id"/>
|
<field name="commercial_partner_id"/>
|
||||||
<field name="date_order"/>
|
<field name="date_order" optional="show"/>
|
||||||
<field name="date_approve"/>
|
<field name="date_approve" optional="show"/>
|
||||||
<field name="product_id"/>
|
<field name="product_id"/>
|
||||||
<field name="qty_ordered" sum="1"/>
|
<field name="qty_ordered" sum="1"/>
|
||||||
<field name="qty_received" sum="1"/>
|
<field name="qty_received" sum="1"/>
|
||||||
<field name="qty_billed" sum="1"/>
|
<field name="qty_billed" sum="1"/>
|
||||||
<field name="product_uom"/>
|
<field name="product_uom" groups="uom.group_uom"/>
|
||||||
<field name="price_total" sum="1"/>
|
<field name="price_total" sum="1"/>
|
||||||
<field name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
|
<field name="account_analytic_id" groups="analytic.group_analytic_accounting" optional="show"/>
|
||||||
<field name="currency_id" invisible="1"/>
|
<field name="currency_id" invisible="1"/>
|
||||||
<field name="user_id"/>
|
<field name="user_id" optional="hide"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
1
setup/account_usability/odoo/addons/account_usability
Symbolic link
1
setup/account_usability/odoo/addons/account_usability
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../../account_usability
|
||||||
6
setup/account_usability/setup.py
Normal file
6
setup/account_usability/setup.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
||||||
1
setup/base_usability/odoo/addons/base_usability
Symbolic link
1
setup/base_usability/odoo/addons/base_usability
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../../base_usability
|
||||||
6
setup/base_usability/setup.py
Normal file
6
setup/base_usability/setup.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
||||||
1
stock_move_line_auto_fill_all/__init__.py
Normal file
1
stock_move_line_auto_fill_all/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import models
|
||||||
27
stock_move_line_auto_fill_all/__manifest__.py
Normal file
27
stock_move_line_auto_fill_all/__manifest__.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# Copyright 2023 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).
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'Stock Move Line Auto-fill All',
|
||||||
|
'version': '14.0.1.0.0',
|
||||||
|
'category': 'Warehouse',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'summary': 'Add button on picking to auto-fill done qty',
|
||||||
|
'description': """
|
||||||
|
This module is an alternative to the OCA module **stock_move_line_auto_fill** from https://github.com/OCA/stock-logistics-workflow/
|
||||||
|
The OCA module doesn't auto-fill the stock move lines with lots. This module does.
|
||||||
|
|
||||||
|
This module has been written by Alexis de Lattre from Akretion
|
||||||
|
<alexis.delattre@akretion.com>.
|
||||||
|
""",
|
||||||
|
'author': 'Akretion',
|
||||||
|
'maintainers': ['alexis-via'],
|
||||||
|
"development_status": "Mature",
|
||||||
|
'website': 'https://github.com/akretion/odoo-usability',
|
||||||
|
'depends': ['stock'],
|
||||||
|
'data': [
|
||||||
|
'views/stock_picking.xml',
|
||||||
|
],
|
||||||
|
'installable': True,
|
||||||
|
}
|
||||||
1
stock_move_line_auto_fill_all/models/__init__.py
Normal file
1
stock_move_line_auto_fill_all/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import stock_picking
|
||||||
34
stock_move_line_auto_fill_all/models/stock_picking.py
Normal file
34
stock_move_line_auto_fill_all/models/stock_picking.py
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# Copyright 2023 Akretion France (http://www.akretion.com/)
|
||||||
|
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import fields, models, _
|
||||||
|
from odoo.tools import float_compare, float_is_zero
|
||||||
|
from odoo.exceptions import UserError
|
||||||
|
|
||||||
|
|
||||||
|
class StockPicking(models.Model):
|
||||||
|
_inherit = 'stock.picking'
|
||||||
|
|
||||||
|
autofill_done = fields.Boolean(readonly=True)
|
||||||
|
|
||||||
|
def button_stock_move_line_autofill(self):
|
||||||
|
self.ensure_one()
|
||||||
|
prec = self.env['decimal.precision'].precision_get(
|
||||||
|
'Product Unit of Measure')
|
||||||
|
for ml in self.move_line_ids_without_package:
|
||||||
|
if ml.product_id and float_compare(ml.product_uom_qty, 0, precision_digits=prec) > 0 and float_is_zero(ml.qty_done, precision_digits=prec):
|
||||||
|
if (
|
||||||
|
ml.product_id.tracking in ('lot', 'serial') and
|
||||||
|
not ml.lot_id and
|
||||||
|
not ml.lot_name):
|
||||||
|
raise UserError(_(
|
||||||
|
"Autofill is not possible: the lot is not set "
|
||||||
|
"on move line with product '%s' quantity %s %s.")
|
||||||
|
% (
|
||||||
|
ml.product_id.display_name,
|
||||||
|
ml.product_uom_qty,
|
||||||
|
ml.product_uom_id.display_name
|
||||||
|
))
|
||||||
|
ml.write({'qty_done': ml.product_uom_qty})
|
||||||
|
self.write({'autofill_done': True})
|
||||||
22
stock_move_line_auto_fill_all/views/stock_picking.xml
Normal file
22
stock_move_line_auto_fill_all/views/stock_picking.xml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2023 Akretion France (http://www.akretion.com/)
|
||||||
|
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record id="view_picking_form" model="ir.ui.view">
|
||||||
|
<field name="model">stock.picking</field>
|
||||||
|
<field name="inherit_id" ref="stock.view_picking_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<button name="button_validate" type="object" class="oe_highlight" position="before">
|
||||||
|
<button name="button_stock_move_line_autofill" type="object" string="Auto-Fill" attrs="{'invisible': ['|', ('state', '!=', 'assigned'), ('autofill_done', '=', True)]}" groups="stock.group_stock_user" help="This button will copy the 'Reserved' qty on the 'Done' qty for all the operations of this picking with a null 'Done' qty."/>
|
||||||
|
</button>
|
||||||
|
<field name="origin" position="after">
|
||||||
|
<field name="autofill_done" invisible="1"/>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user