[MIG] sale_confirm_wizard and sale_quotation_title

Update sale_usability to take advantage of base_view_inheritance_extension in v16
This commit is contained in:
Alexis de Lattre
2022-12-08 08:40:53 +01:00
parent 767c6a7fd9
commit 6d69bc659e
8 changed files with 30 additions and 40 deletions

View File

@@ -1,10 +1,10 @@
# Copyright 2017-2021 Akretion France (http://www.akretion.com/)
# Copyright 2017-2022 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 Confirm Wizard',
'version': '14.0.1.0.0',
'version': '16.0.1.0.0',
'category': 'Sales',
'license': 'AGPL-3',
'summary': 'Open a wizard when you confirm a sale order to update important info',
@@ -34,5 +34,5 @@ This module has been written by Alexis de Lattre from Akretion
'views/sale_order.xml',
'security/ir.model.access.csv',
],
'installable': False,
'installable': True,
}

View File

@@ -18,14 +18,8 @@ class SaleConfirm(models.TransientModel):
'account.payment.term', string='Payment Terms')
partner_invoice_id = fields.Many2one(
'res.partner', 'Invoice Address', required=True)
show_partner_invoice_id = fields.Many2one(
related='partner_invoice_id',
string='Detailed Invoice Address')
partner_shipping_id = fields.Many2one(
'res.partner', 'Delivery Address', required=True)
show_partner_shipping_id = fields.Many2one(
related='partner_shipping_id',
string='Detailed Delivery Address')
sale_warn = fields.Selection(
WARNING_MESSAGE, 'Sale Warning Type', readonly=True)
sale_warn_msg = fields.Text(string='Sale Warning Message', readonly=True)
@@ -78,4 +72,3 @@ class SaleConfirm(models.TransientModel):
self.sale_id.write(vals)
# confirm sale order
self.sale_id.action_confirm()
return True

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017-2021 Akretion France (http://www.akretion.com/)
Copyright 2017-2022 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).
-->
@@ -13,26 +13,24 @@
<field name="arch" type="xml">
<form string="Confirm Order">
<div><p>At this stage, you have received the Purchase Order from the customer and you are about to convert the related quotation to an order.</p></div>
<group name="warn" groups="sale.group_warning_sale" attrs="{'invisible': ['|', ('sale_warn', '=', False), ('sale_warn', '=', 'no-message')]}" string="Warning" col="4">
<field name="sale_warn" nolabel="1"/>
<field name="sale_warn_msg" nolabel="1" colspan="3"/>
</group>
<div class="alert alert-warning" role="alert" attrs="{'invisible': [('sale_warn', '!=', 'warning')]}">
<field name="sale_warn_msg"/>
</div>
<div class="alert alert-danger" role="alert" attrs="{'invisible': [('sale_warn', '!=', 'block')]}">
<field name="sale_warn_msg"/>
</div>
<group name="main" attrs="{'invisible': [('sale_warn', '=', 'block')]}">
<field name="sale_id" invisible="1"/>
<field name="sale_warn" invisible="1"/>
<field name="client_order_ref"/>
<field name="partner_invoice_id" context="{'default_type': 'invoice'}"
groups="sale.group_delivery_invoice_address"/>
<!-- partner_invoice_id can't show the full address because
we are in edit mode -->
<field name="show_partner_invoice_id" options="{'always_reload': True}"
context="{'show_address': 1}"
groups="sale.group_delivery_invoice_address"/>
<field name="partner_invoice_id"
context="{'default_type': 'invoice', 'show_address': 1}"
options="{'always_reload': True}"
groups="account.group_delivery_invoice_address"/>
<field name="partner_shipping_id"
context="{'default_type': 'delivery'}"
groups="sale.group_delivery_invoice_address"/>
<field name="show_partner_shipping_id" options="{'always_reload': True}"
context="{'show_address': 1}"
groups="sale.group_delivery_invoice_address"/>
context="{'default_type': 'delivery', 'show_address': 1}"
options="{'always_reload': True}"
groups="account.group_delivery_invoice_address"/>
<field name="commitment_date"/>
<field name="payment_term_id"/>
</group>

View File

@@ -1,10 +1,10 @@
# Copyright 2016-2019 Akretion (http://www.akretion.com)
# Copyright 2016-2022 Akretion (http://www.akretion.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# @author Alexis de Lattre <alexis.delattre@akretion.com>
{
'name': 'Sale Quotation Title',
'version': '12.0.1.0.0',
'version': '16.0.1.0.0',
'category': 'Sales',
'license': 'AGPL-3',
'summary': 'Adds a title field on quotations',
@@ -21,5 +21,5 @@ This module has been written by Alexis de Lattre from Akretion
'website': 'http://www.akretion.com',
'depends': ['sale'],
'data': ['sale_view.xml'],
'installable': False,
'installable': True,
}

View File

@@ -1,11 +1,11 @@
# Copyright 2016-2019 Akretion (http://www.akretion.com)
# Copyright 2016-2022 Akretion (http://www.akretion.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# @author Alexis de Lattre <alexis.delattre@akretion.com>
from odoo import models, fields
from odoo import fields, models
class SaleOrder(models.Model):
_inherit = 'sale.order'
quotation_title = fields.Char(string="Quotation Title")
quotation_title = fields.Char(tracking=True)

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2016-2019 Akretion (http://www.akretion.com/)
Copyright 2016-2022 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).
-->
@@ -14,7 +14,7 @@
<field name="inherit_id" ref="sale.view_order_tree"/>
<field name="arch" type="xml">
<field name="user_id" position="before">
<field name="quotation_title"/>
<field name="quotation_title" optional="show"/>
</field>
</field>
</record>
@@ -25,7 +25,7 @@
<field name="inherit_id" ref="sale.view_quotation_tree"/>
<field name="arch" type="xml">
<field name="user_id" position="before">
<field name="quotation_title"/>
<field name="quotation_title" optional="show"/>
</field>
</field>
</record>

View File

@@ -13,7 +13,7 @@
'depends': [
'sale',
# 'account_usability', # for company view
# 'base_view_inheritance_extension',
'base_view_inheritance_extension',
],
'data': [
'views/sale_order.xml',

View File

@@ -15,10 +15,9 @@
<field name="fiscal_position_id" position="attributes">
<attribute name="widget">selection</attribute>
</field>
<!-- TODO uncomment when base_extended_view is avail on v16
<field name="partner_shipping_id" position="attributes">
<attribute name="context" operation="python_dict" key="show_address">1</attribute>
</field> -->
<attribute name="context" operation="update">{"show_address": 1}</attribute>
</field>
<button name="action_cancel" type="object" position="attributes">
<attribute name="confirm">Are you sure you want to cancel this sale order?</attribute>
</button>