[IMP] pre-commit: first run on whole repo
This commit is contained in:
@@ -3,20 +3,20 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Sale Order Route',
|
||||
'version': '14.0.1.0.0',
|
||||
'category': 'Sales',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Set route on sale order',
|
||||
'description': """
|
||||
"name": "Sale Order Route",
|
||||
"version": "14.0.1.0.0",
|
||||
"category": "Sales",
|
||||
"license": "AGPL-3",
|
||||
"summary": "Set route on sale order",
|
||||
"description": """
|
||||
This small module adds the possibility to set a route on a sale order. Upon sale order confirmation, the route will be copied to all the sale order lines.
|
||||
|
||||
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'],
|
||||
'data': ['views/sale_order.xml'],
|
||||
'installable': True,
|
||||
"author": "Akretion",
|
||||
"website": "https://github.com/OCA/odoo-usability",
|
||||
"depends": ["sale_stock"],
|
||||
"data": ["views/sale_order.xml"],
|
||||
"installable": True,
|
||||
}
|
||||
|
||||
@@ -6,21 +6,25 @@ from odoo import fields, models
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = 'sale.order'
|
||||
_inherit = "sale.order"
|
||||
|
||||
route_id = fields.Many2one(
|
||||
'stock.location.route', string='Route',
|
||||
ondelete='restrict', readonly=True, tracking=True,
|
||||
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
|
||||
"stock.location.route",
|
||||
string="Route",
|
||||
ondelete="restrict",
|
||||
readonly=True,
|
||||
tracking=True,
|
||||
states={"draft": [("readonly", False)], "sent": [("readonly", False)]},
|
||||
check_company=True,
|
||||
domain="['|', ('company_id', '=', company_id), ('company_id', '=', False), ('sale_selectable', '=', True)]")
|
||||
domain="['|', ('company_id', '=', company_id), ('company_id', '=', False), ('sale_selectable', '=', True)]",
|
||||
)
|
||||
|
||||
def _action_confirm(self):
|
||||
# Takes into account the scenario where route_id has a value, then SO is
|
||||
# cancelled+back to draft, then route_id = False and SO is confirmed again
|
||||
for order in self:
|
||||
vals = {'route_id': order.route_id.id or False}
|
||||
vals = {"route_id": order.route_id.id or False}
|
||||
order.order_line.filtered(
|
||||
lambda l:
|
||||
l.product_id and l.product_id.type in ('product', 'consu')).write(vals)
|
||||
lambda l: l.product_id and l.product_id.type in ("product", "consu")
|
||||
).write(vals)
|
||||
return super()._action_confirm()
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright 2019-2021 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_order_form_inherit_sale_stock" model="ir.ui.view">
|
||||
<field name="name">sale.order.route.form</field>
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale_stock.view_order_form_inherit_sale_stock"/>
|
||||
<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="route_id" options="{'no_create_edit': True}"/>
|
||||
<field name="route_id" options="{'no_create_edit': True}" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user