purchase_stock_generic_product and sale_stock_generic_product: allows the use of generic products

This commit is contained in:
Alexis de Lattre
2024-06-15 12:24:12 +02:00
parent d07e38e1f3
commit 740d167331
13 changed files with 132 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
This module **sale_stock_generic_product** allows the use of generic products whose exact properties is written in the description. With this module, the exact product description written in the *name* field of sale.order.line is written in the field *description_picking* of stock.move and stock.move.line.
The module has a twin module for purchase: **purchase_stock_generic_product**.

View File

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

View File

@@ -0,0 +1,18 @@
# Copyright 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).
{
'name': 'Sale Stock Generic Product',
'version': '16.0.1.0.0',
'category': 'Sales',
'license': 'AGPL-3',
'summary': 'Generic products for sale orders',
'author': 'Akretion',
'maintainers': ['alexis-via'],
"development_status": "Mature",
'website': 'https://github.com/akretion/odoo-usability',
'depends': ['sale_stock'],
'data': ['views/stock_move_line.xml'],
'installable': True,
}

View File

@@ -0,0 +1,3 @@
from . import sale_order_line
from . import stock_rule
from . import stock_move

View File

@@ -0,0 +1,14 @@
# Copyright 2024 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 models
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
def _prepare_procurement_values(self, group_id=False):
vals = super()._prepare_procurement_values(group_id=group_id)
vals['description_picking'] = self.name
return vals

View File

@@ -0,0 +1,14 @@
# Copyright 2024 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 models
class StockMove(models.Model):
_inherit = 'stock.move'
def _prepare_move_line_vals(self, quantity=None, reserved_quant=None):
vals = super()._prepare_move_line_vals(quantity=quantity, reserved_quant=reserved_quant)
vals['description_picking'] = self.description_picking
return vals

View File

@@ -0,0 +1,18 @@
# Copyright 2024 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 models
class StockRule(models.Model):
_inherit = 'stock.rule'
def _get_stock_move_values(
self, product_id, product_qty, product_uom, location_dest_id, name,
origin, company_id, values):
move_vals = super()._get_stock_move_values(
product_id, product_qty, product_uom, location_dest_id, name,
origin, company_id, values)
move_vals['description_picking'] = values.get('description_picking')
return move_vals

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 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>
<record id="view_stock_move_line_detailed_operation_tree" model="ir.ui.view">
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree"/>
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="description_picking" optional="show"/>
</field>
</field>
</record>
</odoo>