[MIG] sale_usability_akretion: migrate to v18

This commit is contained in:
Alexis de Lattre
2024-12-31 10:38:09 +01:00
parent bdf4a527de
commit b51c1ff7d9
16 changed files with 34 additions and 115 deletions

View File

@@ -1,2 +1 @@
from . import models
from . import wizards

View File

@@ -1,10 +1,10 @@
# Copyright 2014-2022 Akretion (http://www.akretion.com)
# Copyright 2014-2024 Akretion (https://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 Usability',
'version': '16.0.1.0.0',
'version': '18.0.1.0.0',
'category': 'Sales',
'license': 'AGPL-3',
'summary': 'Usability improvements on sale module',
@@ -17,12 +17,10 @@
],
'data': [
'views/sale_order.xml',
'views/product_category.xml',
'views/sale_report.xml',
'views/product_pricelist_item.xml',
'views/account_move.xml',
'views/res_company.xml',
"views/res_partner.xml",
'views/res_company.xml',
],
'installable': False,
'installable': True,
}

View File

@@ -1,4 +1,4 @@
# Copyright 2015-2022 Akretion (http://www.akretion.com)
# Copyright 2015-2024 Akretion France (https://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

View File

@@ -1,4 +1,4 @@
# Copyright 2017-2022 Akretion France
# Copyright 2017-2024 Akretion France (https://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@@ -10,6 +10,4 @@ class ProductTemplate(models.Model):
service_type = fields.Selection(tracking=True)
expense_policy = fields.Selection(tracking=True)
invoice_policy = fields.Selection(tracking=True)
sale_line_warn = fields.Selection(tracking=True)
expense_policy = fields.Selection(tracking=True)

View File

@@ -1,4 +1,4 @@
# Copyright 2021-2022 Akretion France (https://akretion.com/)
# Copyright 2021-2024 Akretion France (https://akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@@ -8,6 +8,6 @@ from odoo import fields, models
class ResCompany(models.Model):
_inherit = 'res.company'
# Similar to the field static_invoice_terms in account_usability
# Similar to the field static_invoice_terms in account_usability_akretion
static_sale_terms = fields.Text(
translate=True, string="Legal Terms on Quotation")

View File

@@ -1,4 +1,4 @@
# Copyright 2017-2022 Akretion France (https://akretion.com/)
# Copyright 2017-2024 Akretion France (https://akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

View File

@@ -11,7 +11,6 @@ class SaleOrder(models.Model):
date_order = fields.Datetime(tracking=True)
client_order_ref = fields.Char(tracking=True)
# for partner_id, the 'sale' module sets track_visibility='always'
amount_tax = fields.Monetary(tracking=True)
partner_shipping_id = fields.Many2one(tracking=True)
partner_invoice_id = fields.Many2one(tracking=True)

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019-2022 Akretion France (http://www.akretion.com/)
Copyright 2019-2024 Akretion France (https://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
@@ -13,7 +13,7 @@
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_line_ids']/form//field[@name='analytic_distribution']" position="after">
<field name="sale_line_ids" widget="many2many_tags" attrs="{'invisible': [('sale_line_ids', '=', [])]}"/>
<field name="sale_line_ids" widget="many2many_tags" invisible="not sale_line_ids"/>
</xpath>
</field>
</record>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2015-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).
-->
<odoo>
<!-- Add a 'Product Category' menu entry under Sales > Configuration > Products,
similar to what we have in Stock > Configuration > Products
because we need this menu entry even if the 'stock' module is not installed -->
<menuitem id="product_category_sale_menu" action="product.product_category_action_form"
parent="sale.prod_config_main" sequence="5"/>
</odoo>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017-2022 Akretion France (http://www.akretion.com/)
Copyright 2017-2024 Akretion France (https://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
@@ -12,7 +12,7 @@ because the parent menu entry is in the sale module -->
<record id="product_pricelist_item_action" model="ir.actions.act_window">
<field name="name">Price Rules</field>
<field name="res_model">product.pricelist.item</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
<field name="context">{'product_pricelist_item_main_view': True}</field>
</record>
@@ -20,8 +20,8 @@ because the parent menu entry is in the sale module -->
<menuitem id="product_pricelist_item_menu"
parent="sale.product_menu_catalog"
action="product_pricelist_item_action"
groups="product.group_sale_pricelist"
sequence="50"/>
groups="product.group_product_pricelist"
sequence="40"/>
</odoo>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2021-2022 Akretion (http://www.akretion.com/)
Copyright 2021-2024 Akretion (https://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="res_partner_view_team" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="sales_team.res_partner_view_team" />
<field name="arch" type="xml">
<!-- team_id should be visible in no developper mode -->
<field name="team_id" groups="base.group_no_one" position="attributes">
<attribute name="groups"/>
</field>
</field>
</record>
</odoo>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2015-2022 Akretion France (http://www.akretion.com/)
Copyright 2015-2024 Akretion France (https://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
@@ -12,77 +12,49 @@
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<field name="fiscal_position_id" position="attributes">
<attribute name="widget">selection</attribute>
</field>
<field name="partner_shipping_id" position="attributes">
<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>
<!-- client_order_ref is an important field, so we should put it in the top like in v8, not hidden in the second tab -->
<field name="date_order" position="after">
<!-- client_order_ref is an important field, so we should put it in the top like in v8, not in the "Other Info" tab -->
<field name="has_active_pricelist" position="before">
<field name="client_order_ref" position="move"/>
</field>
<button name="action_quotation_send" states="sent,sale" position="after">
<button name="%(sale.action_report_saleorder)d" type="action" string="Print" states="draft,sent,sale,done"/>
<button id="send_by_email_primary" position="after">
<button name="%(sale.action_report_saleorder)d" type="action" string="Print" invisible="state == 'cancel'"/>
</button>
<xpath expr="//field[@name='order_line']/tree/field[@name='product_template_id']" position="after">
<xpath expr="//field[@name='order_line']/list/field[@name='product_template_id']" position="after">
<field name="product_barcode" optional="hide"/>
</xpath>
<button name="action_quotation_send" attrs="{'invisible': ['|', ('state', '=', 'draft'), ('invoice_count','&gt;=',1)]}" position="before">
<button name="action_quotation_send" type="object" string="Send Order Acknowledgement" attrs="{'invisible': ['|', ('state', 'not in', ('sale', 'done')), ('invoice_count','&gt;=',1)]}"/>
<button id="send_proforma_primary" position="before">
<button name="action_quotation_send" type="object" string="Send Order Acknowledgement" invisible="state != 'sale' or invoice_count &gt;= 1" id="send_order_ack_by_email"/>
</button>
<xpath expr="//field[@name='order_line']/tree/field[@name='product_uom_qty']" position="attributes">
<xpath expr="//field[@name='order_line']/list/field[@name='product_uom_qty']" position="attributes">
<attribute name="sum">1</attribute>
</xpath>
<!-- it doesn't work... I don't know why ! -->
<xpath expr="//field[@name='order_line']/tree/field[@name='qty_delivered']" position="attributes">
<xpath expr="//field[@name='order_line']/list/field[@name='qty_delivered']" position="attributes">
<attribute name="sum">1</attribute>
</xpath>
<!-- it doesn't work... I don't know why ! -->
<xpath expr="//field[@name='order_line']/tree/field[@name='qty_invoiced']" position="attributes">
<xpath expr="//field[@name='order_line']/list/field[@name='qty_invoiced']" position="attributes">
<attribute name="sum">1</attribute>
</xpath>
</field>
</record>
<record id="view_quotation_tree" model="ir.ui.view">
<field name="name">usability.sale.quotation.tree</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_quotation_tree"/>
<field name="arch" type="xml">
<field name="amount_untaxed" position="attributes">
<attribute name="optional">show</attribute>
</field>
<field name="partner_id" position="after">
<field name="client_order_ref" optional="hide"/>
</field>
</field>
</record>
<record id="view_order_tree" model="ir.ui.view">
<record id="sale_order_tree" model="ir.ui.view">
<field name="name">usability.sale.order.tree</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_tree"/>
<field name="inherit_id" ref="sale.sale_order_tree"/>
<field name="arch" type="xml">
<field name="amount_untaxed" position="attributes">
<attribute name="optional">show</attribute>
</field>
<field name="state" position="attributes">
<attribute name="invisible">0</attribute>
<attribute name="optional">hide</attribute>
<attribute name="widget">badge</attribute>
<attribute name="decoration-success">state == 'done'</attribute>
<attribute name="decoration-info">state == 'sale'</attribute>
</field>
<field name="partner_id" position="after">
<field name="client_order_ref" optional="show"/>
</field>
</field>
</record>
<record id="view_sales_order_filter" model="ir.ui.view">
<field name="name">usability.sale.order.search</field>
<field name="model">sale.order</field>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018-2022 Akretion (http://www.akretion.com/)
Copyright 2018-2024 Akretion France (https://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
@@ -13,9 +13,7 @@
<field name="model">sale.report</field>
<field name="inherit_id" ref="sale.sale_report_view_tree"/>
<field name="arch" type="xml">
<field name="user_id" position="after">
<field name="product_id" optional="show"/>
<field name="product_uom_qty" sum="1" optional="show"/>
<field name="product_uom_qty" position="after">
<field name="qty_delivered" sum="1" optional="hide"/>
<field name="qty_to_invoice" sum="1" optional="hide"/>
<field name="product_uom" groups="uom.group_uom" optional="show"/>
@@ -24,8 +22,8 @@
</record>
<record id="sale.action_order_report_all" model="ir.actions.act_window">
<!-- native order is graph,pivot -->
<field name="view_mode">pivot,graph</field>
<!-- start by pivot, not by graph -->
<field name="view_mode">pivot,graph,list,form</field>
</record>
</odoo>

View File

@@ -1 +0,0 @@
from . import sale_invoice_discount_all_lines

View File

@@ -1,13 +0,0 @@
# Copyright 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).
from odoo import models, fields
class SaleInvoiceDiscountAllLines(models.TransientModel):
_name = 'sale.invoice.discount.all.lines'
_description = 'None'
# Remove because this feature is now mostly native
# TODO 04/07/2024 remove later to avoid ORM bug: it crashes when reloading module
# KeyError: 'sale.invoice.discount.all.lines'