@ -0,0 +1,46 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
||||
|
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
||||
|
:alt: License: AGPL-3 |
||||
|
|
||||
|
Add Multiple Products to Inventory Transfer |
||||
|
============================================ |
||||
|
Easily add multiple products to a picking directly from the product list view with this new features. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
* No additional configurations needed |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPLv3) |
||||
|
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developer: (V18) Nivedhya T, Contacts: odoo@cybrosys.com |
||||
|
|
||||
|
Contacts |
||||
|
-------- |
||||
|
* Mail Contact : odoo@cybrosys.com |
||||
|
* Website : https://cybrosys.com |
||||
|
|
||||
|
Bug Tracker |
||||
|
----------- |
||||
|
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
||||
|
|
||||
|
Maintainer |
||||
|
========== |
||||
|
.. image:: https://cybrosys.com/images/logo.png |
||||
|
:target: https://cybrosys.com |
||||
|
|
||||
|
This module is maintained by Cybrosys Technologies. |
||||
|
|
||||
|
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Further information |
||||
|
=================== |
||||
|
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,23 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import models |
||||
|
from . import wizard |
@ -0,0 +1,51 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
{ |
||||
|
'name': 'Add Multiple Products to Inventory Transfer', |
||||
|
'version': '18.0.1.0.0', |
||||
|
'category': 'Warehouse', |
||||
|
'summary': 'Easily add multiple products to a picking directly from the' |
||||
|
' product list view with this new feature', |
||||
|
'description': "This module allow you to add multiple products to the" |
||||
|
"corresponding inventory transfer. You can see all products" |
||||
|
"in kanban,list and form view.You can also view the recent" |
||||
|
"transfer history of the selected product along with the" |
||||
|
"option to update the quantity, Inventory,Add Multiple" |
||||
|
"Products.", |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': 'https://www.cybrosys.com', |
||||
|
'depends': ['stock'], |
||||
|
'data': [ |
||||
|
'security/ir.model.access.csv', |
||||
|
'views/stock_picking_views.xml', |
||||
|
'views/product_product_views.xml', |
||||
|
'wizard/transfer_products_details_views.xml', |
||||
|
'wizard/wizard_add_to_draft_picking_views.xml', |
||||
|
], |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'license': 'AGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False, |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
## Module <products_to_transfer> |
||||
|
|
||||
|
#### 11.10.2024 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
##### ADD |
||||
|
- Initial commit for Add Multiple Products to Inventory Transfer |
@ -0,0 +1,23 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import product_product |
||||
|
from . import stock_picking |
@ -0,0 +1,75 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import Command, models, _ |
||||
|
|
||||
|
|
||||
|
class ProductProduct(models.Model): |
||||
|
"""This class extends the 'product.product' model to enhance its |
||||
|
functionality. It adds features for adding the current product to a |
||||
|
stock picking and viewing product details in transfer.products.details |
||||
|
model.""" |
||||
|
_inherit = 'product.product' |
||||
|
|
||||
|
def action_add_to_picking(self): |
||||
|
"""Add the current product to the stock picking.""" |
||||
|
self.ensure_one() |
||||
|
if not self._context.get('active_id'): |
||||
|
return { |
||||
|
'type': 'ir.actions.act_window', |
||||
|
'name': _('Add Product to Draft Picking'), |
||||
|
'res_model': 'wizard.add.to.draft.picking', |
||||
|
'view_mode': 'form', |
||||
|
'target': 'new', |
||||
|
'context': {'default_product_id': self.id}, |
||||
|
} |
||||
|
picking_id = self.env['stock.picking'].browse( |
||||
|
self._context.get('active_id')) |
||||
|
existing_move = picking_id.move_ids_without_package.filtered( |
||||
|
lambda move: move.product_id == self) |
||||
|
if existing_move: |
||||
|
existing_move[0].product_uom_qty += 1 |
||||
|
else: |
||||
|
picking_id.write({ |
||||
|
'move_ids_without_package': [Command.create( |
||||
|
{'name': self.name, |
||||
|
'product_id': self.id, |
||||
|
'product_uom': self.uom_id.id, |
||||
|
'product_uom_qty': 1, |
||||
|
'location_id': picking_id.location_id.id, |
||||
|
'location_dest_id': picking_id.location_dest_id.id, })], |
||||
|
}) |
||||
|
|
||||
|
def action_view_details(self): |
||||
|
"""Open a new window to display product details.""" |
||||
|
return { |
||||
|
'name': 'Product Details', |
||||
|
'view_type': 'form', |
||||
|
'view_mode': 'form', |
||||
|
'res_model': 'transfer.products.details', |
||||
|
'type': 'ir.actions.act_window', |
||||
|
'target': 'new', |
||||
|
'context': { |
||||
|
'picking_id': self.env['stock.picking'].browse( |
||||
|
self._context.get('active_id')).id, |
||||
|
'default_product': self.name, |
||||
|
} |
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import models |
||||
|
|
||||
|
|
||||
|
class StockPicking(models.Model): |
||||
|
"""This class extends the base 'stock.picking' model to provide enhanced |
||||
|
functionality. It introduces a function to open a new window for viewing |
||||
|
products associated with a picking""" |
||||
|
_inherit = 'stock.picking' |
||||
|
|
||||
|
def action_view_products(self): |
||||
|
"""Open a new window to view products.""" |
||||
|
return { |
||||
|
'name': 'View Products', |
||||
|
'view_type': 'form', |
||||
|
'view_mode': 'kanban,list,form', |
||||
|
'res_model': 'product.product', |
||||
|
'type': 'ir.actions.act_window', |
||||
|
'domain': [('type', 'in', ['product', 'consu'])], |
||||
|
} |
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 374 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 99 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 297 KiB |
After Width: | Height: | Size: 174 KiB |
After Width: | Height: | Size: 127 KiB |
After Width: | Height: | Size: 297 KiB |
After Width: | Height: | Size: 174 KiB |
After Width: | Height: | Size: 127 KiB |
After Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 10 KiB |
@ -0,0 +1,57 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<odoo> |
||||
|
<!-- View for adding products to picking list view --> |
||||
|
<record id="product_product_tree_view" model="ir.ui.view"> |
||||
|
<field name="name"> |
||||
|
product.product.view.list.inherit.products.to.transfer |
||||
|
</field> |
||||
|
<field name="model">product.product</field> |
||||
|
<field name="inherit_id" ref="product.product_product_tree_view"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//field[@name='default_code']" position="before"> |
||||
|
<button name="action_add_to_picking" type="object" |
||||
|
icon="fa-plus" title="Add to Picking" /> |
||||
|
<button name="action_view_details" type="object" |
||||
|
icon="fa-list" title="View Details"/> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
<!-- View for adding products to picking kanban view --> |
||||
|
<record id="product_kanban_view" model="ir.ui.view"> |
||||
|
<field name="name"> |
||||
|
product.product.view.kanban.inherit.products.to.transfer |
||||
|
</field> |
||||
|
<field name="model">product.product</field> |
||||
|
<field name="inherit_id" ref="product.product_kanban_view"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//main" position="inside"> |
||||
|
<div style="display: inline-block; padding-top:10%;"> |
||||
|
<a name="action_add_to_picking" type="object"> |
||||
|
<i class="fa fa-plus"/>Add to Transfer |
||||
|
</a> |
||||
|
<a name="action_view_details" type="object"> |
||||
|
<i class="fa fa-list"/>Update Quantity |
||||
|
</a> |
||||
|
</div> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
<!-- View for adding products to picking form view --> |
||||
|
<record id="product_normal_form_view" model="ir.ui.view"> |
||||
|
<field name="name"> |
||||
|
product.product.view.form.inherit.products.to.transfer |
||||
|
</field> |
||||
|
<field name="model">product.product</field> |
||||
|
<field name="inherit_id" ref="product.product_normal_form_view"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//header" position="inside"> |
||||
|
<button name="action_add_to_picking" type="object" |
||||
|
string="Add to Transfer" class="oe_highlight" |
||||
|
icon="fa-plus"/> |
||||
|
<button name="action_view_details" type="object" |
||||
|
class="oe_highlight" icon="fa-list" |
||||
|
string="Update Quantity"/> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,20 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<odoo> |
||||
|
<!-- View for extending picking form and adding products --> |
||||
|
<record id="view_picking_form" model="ir.ui.view"> |
||||
|
<field name="name"> |
||||
|
stock.picking.view.form.inherit.products.to.transfer |
||||
|
</field> |
||||
|
<field name="model">stock.picking</field> |
||||
|
<field name="inherit_id" ref="stock.view_picking_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//button[@name='action_picking_move_tree']" |
||||
|
position="after"> |
||||
|
<button name="action_view_products" type="object" |
||||
|
class="oe_stat_button" string="Add Products" |
||||
|
icon="fa-plus" |
||||
|
invisible="state != 'draft'"/> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,24 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import product_transfer_history |
||||
|
from . import transfer_products_details |
||||
|
from . import wizard_add_to_draft_picking |
@ -0,0 +1,45 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class ProductTransferHistory(models.TransientModel): |
||||
|
"""This class represents a wizard to display the history of product |
||||
|
transfers.It provides a simple way to view information about product |
||||
|
transfers, including dates, transfer identifiers, associated contacts, |
||||
|
transferred quantities, and references to transfer product details |
||||
|
wizards.""" |
||||
|
_name = 'product.transfer.history' |
||||
|
_description = 'Product Transfer History Wizard' |
||||
|
|
||||
|
date_picking = fields.Datetime(string="Date", |
||||
|
help="Date of the transfer.") |
||||
|
picking = fields.Char(string="Transfer", |
||||
|
help="Identifier of the transfer.") |
||||
|
partner_id = fields.Many2one('res.partner', string="Contact", |
||||
|
help="Contact associated with the transfer.") |
||||
|
qty = fields.Float(string="Quantity", |
||||
|
help="Quantity of the product transferred.") |
||||
|
product_details_id = fields.Many2one('transfer.products.details', |
||||
|
string="Products Details", |
||||
|
help="Reference to the transfer " |
||||
|
"product details wizard.") |
@ -0,0 +1,99 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import api,Command, fields, models, _ |
||||
|
from odoo.exceptions import ValidationError |
||||
|
from datetime import timedelta |
||||
|
|
||||
|
|
||||
|
class TransferProductDetails(models.TransientModel): |
||||
|
"""This wizard is designed to display product details associated with |
||||
|
inventory transfers. It provides information about the transferred product, |
||||
|
its quantity, associated picking, and transfer history.""" |
||||
|
_name = 'transfer.products.details' |
||||
|
_description = 'Wizard to View Product Details from Inventory Transfer' |
||||
|
|
||||
|
def _default_product(self): |
||||
|
"""Get the default product based on the context value 'active_id'.""" |
||||
|
product_id = self.env['product.product'].browse( |
||||
|
self._context.get('active_id')) |
||||
|
return product_id if product_id.exists() else None |
||||
|
|
||||
|
def _default_picking(self): |
||||
|
"""Get the default picking based on the context value 'picking_id'.""" |
||||
|
picking_id = self.env['stock.picking'].browse( |
||||
|
self._context.get('picking_id')) |
||||
|
return picking_id if picking_id.exists() else None |
||||
|
|
||||
|
product_id = fields.Many2one('product.product', string="Product", required=True, |
||||
|
default=_default_product, |
||||
|
help="The product associated with the transfer") |
||||
|
qty = fields.Float(string="Quantity", help="The quantity of the product transferred") |
||||
|
picking_id = fields.Many2one('stock.picking', string="Picking", required=True, |
||||
|
default=_default_picking, domain="[('state', '=', 'draft')]", |
||||
|
help="The picking associated with the transfer") |
||||
|
transfer_history_ids = fields.One2many('product.transfer.history', 'product_details_id', |
||||
|
string="Transfer History", readonly=True, |
||||
|
help="The transfer history records associated with the product") |
||||
|
date_from = fields.Date(string="Transfer History From", default=fields.Date.today() - timedelta(days=30), |
||||
|
required=True, help="The starting date for the transfer history") |
||||
|
|
||||
|
@api.onchange('date_from') |
||||
|
def _onchange_date_from(self): |
||||
|
"""Update transfer history based on the selected date.""" |
||||
|
move_ids = self.env['stock.move'].sudo().search([ |
||||
|
('product_id', '=', self._context.get('active_id')), |
||||
|
('state', '=', 'done'), |
||||
|
('picking_id.date_done', '>=', self.date_from)]) |
||||
|
vals = [Command.create({ |
||||
|
'date_picking': move.date, |
||||
|
'partner_id': move.picking_id.partner_id.id, |
||||
|
'qty': move.product_uom_qty, |
||||
|
'picking': move.picking_id.name |
||||
|
}) for move in move_ids] |
||||
|
self.transfer_history_ids = vals |
||||
|
|
||||
|
def action_add_to_transfer(self): |
||||
|
"""Add the product to the inventory transfer.""" |
||||
|
picking_id = self.picking_id |
||||
|
product_id = self.product_id |
||||
|
if not picking_id: |
||||
|
raise ValidationError(_("There are no active transfers. Unable to add product.")) |
||||
|
display_name = product_id.display_name |
||||
|
if product_id.description_sale: |
||||
|
display_name += '\n' + product_id.description_sale |
||||
|
move_vals = { |
||||
|
'product_id': product_id.id, |
||||
|
'name': display_name, |
||||
|
'product_uom_qty': self.qty, |
||||
|
'product_uom': product_id.uom_id.id, |
||||
|
'location_id': picking_id.location_id.id, |
||||
|
'location_dest_id': picking_id.location_dest_id.id, |
||||
|
'picking_id': picking_id.id |
||||
|
} |
||||
|
existing_move = self.env['stock.move'].search([ |
||||
|
('picking_id', '=', picking_id.id), |
||||
|
('product_id', '=', product_id.id) |
||||
|
]) |
||||
|
if existing_move: |
||||
|
existing_move[0].product_uom_qty += self.qty |
||||
|
else: |
||||
|
self.env['stock.move'].create(move_vals) |
@ -0,0 +1,48 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<odoo> |
||||
|
<!-- View for the Product Details wizard form --> |
||||
|
<record id="transfer_products_details_view_form" model="ir.ui.view"> |
||||
|
<field name="name">transfer.products.details.view.form</field> |
||||
|
<field name="model">transfer.products.details</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form string="Product Details"> |
||||
|
<group> |
||||
|
<group> |
||||
|
<field name="product_id"/> |
||||
|
</group> |
||||
|
<group> |
||||
|
<field name="picking_id"/> |
||||
|
</group> |
||||
|
</group> |
||||
|
<group> |
||||
|
<group> |
||||
|
<field name="qty"/> |
||||
|
</group> |
||||
|
<group> |
||||
|
<field name="date_from"/> |
||||
|
</group> |
||||
|
</group> |
||||
|
<notebook> |
||||
|
<page name="transfer_history" |
||||
|
string="Products Transfer History"> |
||||
|
<field name="transfer_history_ids" readonly="1" |
||||
|
style="pointer-events:none;"> |
||||
|
<list editable="bottom"> |
||||
|
<field name="date_picking"/> |
||||
|
<field name="picking"/> |
||||
|
<field name="partner_id"/> |
||||
|
<field name="qty"/> |
||||
|
</list> |
||||
|
</field> |
||||
|
</page> |
||||
|
</notebook> |
||||
|
<footer> |
||||
|
<button name="action_add_to_transfer" |
||||
|
string="Add to Transfer" |
||||
|
type="object" class="oe_highlight"/> |
||||
|
<button string="Cancel" special="cancel"/> |
||||
|
</footer> |
||||
|
</form> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |