purchase_stock_generic_product and sale_stock_generic_product: allows the use of generic products
This commit is contained in:
3
sale_stock_generic_product/README.rst
Normal file
3
sale_stock_generic_product/README.rst
Normal 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**.
|
||||
1
sale_stock_generic_product/__init__.py
Normal file
1
sale_stock_generic_product/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
18
sale_stock_generic_product/__manifest__.py
Normal file
18
sale_stock_generic_product/__manifest__.py
Normal 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,
|
||||
}
|
||||
3
sale_stock_generic_product/models/__init__.py
Normal file
3
sale_stock_generic_product/models/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from . import sale_order_line
|
||||
from . import stock_rule
|
||||
from . import stock_move
|
||||
14
sale_stock_generic_product/models/sale_order_line.py
Normal file
14
sale_stock_generic_product/models/sale_order_line.py
Normal 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
|
||||
14
sale_stock_generic_product/models/stock_move.py
Normal file
14
sale_stock_generic_product/models/stock_move.py
Normal 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
|
||||
18
sale_stock_generic_product/models/stock_rule.py
Normal file
18
sale_stock_generic_product/models/stock_rule.py
Normal 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
|
||||
21
sale_stock_generic_product/views/stock_move_line.xml
Normal file
21
sale_stock_generic_product/views/stock_move_line.xml
Normal 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>
|
||||
Reference in New Issue
Block a user