Add module sale_order_full_dropship
This commit is contained in:
3
sale_order_full_dropship/__init__.py
Normal file
3
sale_order_full_dropship/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import sale
|
||||||
30
sale_order_full_dropship/__manifest__.py
Normal file
30
sale_order_full_dropship/__manifest__.py
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright 2018 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 Order Full Dropship',
|
||||||
|
'version': '10.0.1.0.0',
|
||||||
|
'category': 'Sales',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'summary': 'Adds an option full dropship on sale orders',
|
||||||
|
'description': """
|
||||||
|
Sale Order Full Dropship
|
||||||
|
========================
|
||||||
|
|
||||||
|
This module adds a boolean field *Full Dropship* on sale order form. If enabled on a quotation, Odoo will enable the *Dropship* route on all sale order lines of that order. That way, for a full dropship order, the user won't have to open each order line to set the Dropship route.
|
||||||
|
|
||||||
|
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
|
||||||
|
""",
|
||||||
|
'author': 'Akretion',
|
||||||
|
'website': 'http://www.akretion.com',
|
||||||
|
'depends': [
|
||||||
|
'sale_stock',
|
||||||
|
'stock_dropshipping',
|
||||||
|
],
|
||||||
|
'data': [
|
||||||
|
'sale_view.xml',
|
||||||
|
],
|
||||||
|
'installable': True,
|
||||||
|
}
|
||||||
29
sale_order_full_dropship/sale.py
Normal file
29
sale_order_full_dropship/sale.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright 2018 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).
|
||||||
|
|
||||||
|
from odoo import fields, models, _
|
||||||
|
from odoo.exceptions import UserError
|
||||||
|
|
||||||
|
|
||||||
|
class SaleOrder(models.Model):
|
||||||
|
_inherit = 'sale.order'
|
||||||
|
|
||||||
|
dropship = fields.Boolean(
|
||||||
|
string='Dropship', readonly=True,
|
||||||
|
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
|
||||||
|
help="If enabled, all the order lines will be set with the "
|
||||||
|
"'Drop Shipping' route upon confirmation of the order.")
|
||||||
|
|
||||||
|
def action_confirm(self):
|
||||||
|
try:
|
||||||
|
ds_route = self.env.ref('stock_dropshipping.route_drop_shipping')
|
||||||
|
except ValueError:
|
||||||
|
raise UserError(_("Drop shipping route not found."))
|
||||||
|
for order in self:
|
||||||
|
if order.dropship:
|
||||||
|
# no need to exclude service lines
|
||||||
|
# by default, the don't generate a procurement
|
||||||
|
order.order_line.write({'route_id': ds_route.id})
|
||||||
|
return super(SaleOrder, self).action_confirm()
|
||||||
23
sale_order_full_dropship/sale_view.xml
Normal file
23
sale_order_full_dropship/sale_view.xml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2018 Akretion (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_order_form_inherit_sale_stock" model="ir.ui.view">
|
||||||
|
<field name="name">sale_order_full_dropship.sale.order.form</field>
|
||||||
|
<field name="model">sale.order</field>
|
||||||
|
<field name="inherit_id" ref="sale_stock.view_order_form_inherit_sale_stock"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="partner_shipping_id" position="after">
|
||||||
|
<field name="dropship"/>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user