Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
299 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
============== | ||
sale_allotment | ||
============== | ||
Module to create sale order line wise shipment based on address defined on sale order line. | ||
|
||
Usage | ||
===== | ||
Using this module you may enter an allotment partner on each line of the | ||
quotations, even if you don't use the advanced features. | ||
|
||
When you confirm the quotation, one shipment will be created for each | ||
different allotment partner you entered. | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/sale-workflow/8.0 | ||
|
||
For further information, please visit: | ||
|
||
* https://www.odoo.com/forum/help-1 | ||
|
||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/{project_repo}/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback | ||
`here <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_allotment%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Initial contribution by Openies.com | ||
* Lionel Sausin <ls@numerigraphe.com> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
To contribute to this module, please visit http://odoo-community.org. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (C) 2015 Odoo.com. | ||
# Copyright (C) 2015 Openies.com. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# 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 for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (C) 2015 Odoo.com. | ||
# Copyright (C) 2015 Openies.com. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# 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 for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
{ | ||
'name': 'Allotment on sale orders', | ||
'version': '8.0.1.1', | ||
'category': 'Sales', | ||
'summary': "Separate the shipment according to allotment partner", | ||
'author': u'Openies,Numérigraphe,Odoo Community Association (OCA)', | ||
'website': 'http://www.Openies.com/', | ||
'depends': ['sale_stock'], | ||
'data': [ | ||
'views/sale_order_line_view.xml' | ||
], | ||
'installable': True, | ||
'auto_install': False, | ||
'license': 'AGPL-3', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (C) 2015 Odoo.com. | ||
# Copyright (C) 2015 Openies.com. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# 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 for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
from . import procurement_order | ||
from . import stock_move |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (C) 2015 Odoo.com. | ||
# Copyright (C) 2015 Openies.com. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# 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 for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
from openerp import models | ||
|
||
|
||
class ProcurementOrder(models.Model): | ||
_inherit = 'procurement.order' | ||
|
||
def _run_move_create(self, cr, uid, procurement, context=None): | ||
vals = super(ProcurementOrder, self)._run_move_create( | ||
cr, uid, procurement, context=context) | ||
partner_id = (procurement.sale_line_id and | ||
procurement.sale_line_id.address_allotment_id) | ||
if partner_id: | ||
vals['partner_id'] = \ | ||
procurement.sale_line_id.address_allotment_id.id | ||
return vals |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (C) 2015 Odoo.com. | ||
# Copyright (C) 2015 Openies.com. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# 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 for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
############################################################################## | ||
|
||
from openerp import models | ||
|
||
|
||
class StockMove(models.Model): | ||
_inherit = 'stock.move' | ||
|
||
# Kept in API v7 to maintain compatibility with the upstream code | ||
def _picking_assign(self, cr, uid, move_ids, procurement_group, | ||
location_from, location_to, context=None): | ||
'''Assign the moves to one picking per partner | ||
This method lets the upstream code create the first picking, | ||
and duplicates its header as required for each partner, dispatching | ||
the stock moves among all the pickings. | ||
@return: the value of the super() method. | ||
''' | ||
res = super(StockMove, self)._picking_assign( | ||
cr, uid, move_ids, procurement_group, location_from, location_to, | ||
context=context) | ||
pick_obj = self.pool.get('stock.picking') | ||
move_obj = self.pool.get('stock.move') | ||
|
||
# We'll gather the pickings and moves per partner | ||
move_iter = iter(self.browse(cr, uid, move_ids, context=context)) | ||
# The first move is obvious: we keep super's values | ||
first_move = next(move_iter) | ||
first_picking_id = first_move.picking_id.id | ||
pick_obj.write( | ||
cr, uid, first_picking_id, | ||
{'partner_id': first_move.partner_id.id}, | ||
context=context) | ||
picking_move_dict = { | ||
first_move.partner_id.id: (first_picking_id, [first_move.id]) | ||
} | ||
# Process the other moves | ||
for move in move_iter: | ||
if picking_move_dict.get(move.partner_id.id, False): | ||
# Known partner: enlist the stock move | ||
picking_move_dict[move.partner_id.id][1].append(move.id) | ||
else: | ||
# First time we get this partner: create the related picking | ||
new_picking_id = pick_obj.copy( | ||
cr, uid, first_picking_id, | ||
{'partner_id': move.partner_id.id, | ||
'move_lines': False}, | ||
context=context) | ||
picking_move_dict[move.partner_id.id] = (new_picking_id, | ||
[move.id]) | ||
|
||
# Attach the moves to the right pickings (1 query per picking) | ||
for picking_id, move_ids in picking_move_dict.values(): | ||
move_obj.write( | ||
cr, uid, move_ids, {'picking_id': picking_id}, | ||
context=context) | ||
pick_obj.action_confirm(cr, uid, [picking_id], context=context) | ||
return res |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<openerp> | ||
<data> | ||
<record model="ir.ui.view" id="view_order_form"> | ||
<field name="name">Add the allotment to lines' list view</field> | ||
<field name="model">sale.order</field> | ||
<field name="inherit_id" ref="sale.view_order_form" /> | ||
<field name="type">form</field> | ||
<field name="arch" type="xml"> | ||
<data> | ||
<xpath | ||
expr="//field[@name='order_line']//form//field[@name='address_allotment_id']" | ||
position="attributes"> | ||
<attribute name="context"> | ||
{ | ||
'default_parent_id': parent.partner_id, | ||
'default_use_parent_address': True, | ||
'default_type':'other', | ||
} | ||
</attribute> | ||
<attribute name="domain"> | ||
[ | ||
('parent_id','child_of', parent.partner_id), | ||
('type','=','other') | ||
]</attribute> | ||
</xpath> | ||
<xpath | ||
expr="//field[@name='order_line']//tree//field[@name='product_id']" | ||
position="after"> | ||
<field name="address_allotment_id" | ||
context="{'default_parent_id': parent.partner_id, | ||
'default_use_parent_address': True, | ||
'default_type':'other'}" | ||
domain="[('parent_id','child_of', parent.partner_id), | ||
('type','=','other')]"/> | ||
</xpath> | ||
</data> | ||
</field> | ||
</record> | ||
</data> | ||
</openerp> |