@ -0,0 +1,47 @@ |
|||
.. 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 |
|||
|
|||
Delivery Split |
|||
============== |
|||
This app allows you to split delivery to different recipients added in |
|||
each sale order line. |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configurations needed |
|||
|
|||
License |
|||
------- |
|||
General Public License, Version 3 (AGPL v3). |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
Credits |
|||
------- |
|||
Developer: (V17) Ayana KP, |
|||
(V18) Gayathri V |
|||
Contact : 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,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Gayathri V (Contact : odoo@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 |
@ -0,0 +1,41 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Gayathri V (Contact : odoo@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': "Delivery Split", |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Sales', |
|||
'summary': """Delivery can be split to different recipients""", |
|||
'description': """ In Odoo,currently delivery will be created to the customer |
|||
of sale order. Using Delivery Split,we can split the delivery to |
|||
different recipients added in each sale order line.""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': "https://www.cybrosys.com", |
|||
'depends': ['sale_management', 'stock'], |
|||
'data': ['views/sale_order_views.xml'], |
|||
'images': ['static/description/banner.png'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,6 @@ |
|||
## Module <delivery_split> |
|||
|
|||
#### 04.11.2024 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
- Initial commit for Delivery Split |
@ -0,0 +1,24 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Gayathri V (Contact : odoo@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 sale_order |
|||
from . import sale_order_line |
|||
from . import stock_move |
@ -0,0 +1,44 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Gayathri V(Contact : odoo@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, fields, models |
|||
|
|||
|
|||
class SaleOrder(models.Model): |
|||
"""inherits 'sale.order' and adds new field""" |
|||
_inherit = 'sale.order' |
|||
|
|||
delivery_split = fields.Boolean(string='Delivery Split', |
|||
help='Enable the option to add recipients ' |
|||
'to each sale order line to split ' |
|||
'delivery') |
|||
is_consolidate = fields.Boolean(string='Consolidate Orders', |
|||
help='Enable the option to consolidate ' |
|||
'orders if choose same recipients in ' |
|||
'split delivery') |
|||
|
|||
@api.onchange("partner_id") |
|||
def _onchange_product_template_id(self): |
|||
""" Update recipients in order lines with the customer of sale order |
|||
is changed """ |
|||
if self.delivery_split: |
|||
for line in self.order_line: |
|||
line.recipient_id = self.partner_id.id |
@ -0,0 +1,76 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author:Gayathri V(Contact : odoo@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, fields, models |
|||
from datetime import timedelta |
|||
from odoo.addons.sale_stock.models.sale_order_line import SaleOrderLine |
|||
|
|||
|
|||
class SaleOrderLine(models.Model): |
|||
""" Inherits model 'sale.order.line' and added field 'recipient' """ |
|||
_inherit = 'sale.order.line' |
|||
|
|||
recipient_id = fields.Many2one('res.partner', string='Recipient', |
|||
help='Choose a recipient for splitting ' |
|||
'delivery', |
|||
domain=['|', ('company_id', '=', lambda |
|||
self: self.env.company.id), |
|||
('company_id', '=', False)]) |
|||
|
|||
@api.onchange("product_template_id") |
|||
def _onchange_product_template_id(self): |
|||
"""Update recipients in order lines with the customer of sale order as |
|||
default recipient""" |
|||
if self.order_id.delivery_split: |
|||
for line in self: |
|||
if not line.recipient_id: |
|||
line.recipient_id = self.order_id.partner_id.id |
|||
|
|||
def _prepare_procurement_values(self, group_id=False): |
|||
""" Prepare specific key for moves or other components that will be |
|||
created from a stock rule coming from a sale order line. This method |
|||
could be override in order to add other custom key that could be used |
|||
in move/po creation.""" |
|||
date_deadline = self.order_id.commitment_date or ( |
|||
self.order_id.date_order + timedelta( |
|||
days=self.customer_lead or 0.0)) |
|||
date_planned = date_deadline - timedelta( |
|||
days=self.order_id.company_id.security_lead) |
|||
values = { |
|||
'group_id': group_id, |
|||
'sale_line_id': self.id, |
|||
'date_planned': date_planned, |
|||
'date_deadline': date_deadline, |
|||
'route_ids': self.route_id, |
|||
'warehouse_id': self.order_id.warehouse_id or False, |
|||
'product_description_variants': self.with_context( |
|||
lang=self.order_id.partner_id.lang). |
|||
_get_sale_order_line_multiline_description_variants(), |
|||
'company_id': self.order_id.company_id, |
|||
'product_packaging_id': self.product_packaging_id, |
|||
'sequence': self.sequence, |
|||
} |
|||
if not self.recipient_id: |
|||
self.recipient_id = self.order_id.partner_id.id |
|||
if self.order_id.delivery_split: |
|||
values.update({"partner_id": self.recipient_id.id}) |
|||
return values |
|||
SaleOrderLine._prepare_procurement_values = _prepare_procurement_values |
@ -0,0 +1,93 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Gayathri V (Contact : odoo@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 |
|||
from odoo.tools import float_compare |
|||
from odoo.tools.misc import groupby |
|||
from odoo.addons.stock.models.stock_move import StockMove |
|||
|
|||
|
|||
class StockMove(models.Model): |
|||
"""inheriting the stock move model""" |
|||
_inherit = 'stock.move' |
|||
|
|||
def _assign_picking(self): |
|||
""" Try to assign the moves to an existing picking that has not been |
|||
reserved yet and has the same procurement group, locations and picking |
|||
type (moves should already have them identical). Otherwise, create a |
|||
new picking to assign them to. """ |
|||
grouped_moves = groupby(self, key=lambda m: m._key_assign_picking()) |
|||
for group, moves in grouped_moves: |
|||
moves = self.env['stock.move'].concat(*moves) |
|||
new_picking = False |
|||
# Could pass the arguments contained in group but they are the same |
|||
# for each move that why moves[0] is acceptable |
|||
picking = moves[0]._search_picking_for_assignation() |
|||
if picking: |
|||
# If a picking is found, we'll append `move` to its move list |
|||
# and thus its `partner_id` and `ref` field will refer to |
|||
# multiple records. |
|||
# In this case, we chose to wipe them. |
|||
vals = {} |
|||
if any(picking.partner_id.id != m.partner_id.id |
|||
for m in moves): |
|||
vals['partner_id'] = False |
|||
if any(picking.origin != m.origin for m in moves): |
|||
vals['origin'] = False |
|||
if vals: |
|||
picking.write(vals) |
|||
else: |
|||
# Don't create picking for negative moves since they will be |
|||
# reverse and assign to another picking |
|||
moves = moves.filtered(lambda m: float_compare( |
|||
m.product_uom_qty, 0.0, precision_rounding= |
|||
m.product_uom.rounding) >= 0) |
|||
if not moves: |
|||
continue |
|||
new_picking = True |
|||
pick_values = moves._get_new_picking_values() |
|||
sale_order = self.env['sale.order'].search([ |
|||
('name', '=', pick_values['origin'])]) |
|||
if sale_order.delivery_split and not sale_order.is_consolidate: |
|||
for move in moves: |
|||
picking = picking.create( |
|||
move._get_new_picking_values()) |
|||
move.write({'picking_id': picking.id}) |
|||
move._assign_picking_post_process(new=new_picking) |
|||
elif sale_order.delivery_split and sale_order.is_consolidate: |
|||
move_line = sorted(moves, |
|||
key=lambda x: x.partner_id.id) |
|||
for partner_id, lines in groupby(move_line, |
|||
key=lambda |
|||
x: x.partner_id): |
|||
new_moves = self.env['stock.move'].concat(*lines) |
|||
picking = picking.create( |
|||
new_moves._get_new_picking_values()) |
|||
new_moves.write({'picking_id': picking.id}) |
|||
new_moves._assign_picking_post_process(new=new_picking) |
|||
|
|||
else: |
|||
picking = picking.create(moves._get_new_picking_values()) |
|||
moves.write({'picking_id': picking.id, |
|||
'partner_id': sale_order.partner_id.id}) |
|||
moves._assign_picking_post_process(new=new_picking) |
|||
return True |
|||
StockMove._assign_picking = _assign_picking |
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: 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: 191 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.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: 11 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: 80 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 565 B |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 912 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 95 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 164 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 85 KiB |