[MIG] purchase_usability_akretion to v18

This commit is contained in:
Alexis de Lattre
2024-12-30 00:06:13 +01:00
parent 88f6521964
commit 37fb616524
8 changed files with 22 additions and 25 deletions

View File

@@ -1,20 +1,20 @@
# 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': 'Purchase Usability',
'version': '16.0.1.0.0',
'version': '18.0.1.0.0',
'category': 'Purchases',
'license': 'AGPL-3',
'summary': 'Usability improvements on purchase module',
'author': 'Akretion',
'website': 'http://www.akretion.com',
'website': 'https://github.com/akretion/odoo-usability',
'depends': ['purchase'],
'data': [
'views/purchase_order.xml',
'views/purchase_report.xml',
'views/account_move.xml',
],
'installable': False,
'installable': True,
}

View File

@@ -1,4 +1,4 @@
# Copyright 2022 Akretion France (http://www.akretion.com/)
# Copyright 2022-2024 Akretion France (https://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
@@ -16,6 +16,6 @@ class AccountMove(models.Model):
lines = self.env['account.move.line'].search([
('move_id', '=', self.id),
('quantity', '=', 0),
('display_type', '=', False),
('display_type', '=', 'product'),
])
lines.unlink()

View File

@@ -1,4 +1,4 @@
# Copyright 2016-2022 Akretion France
# Copyright 2016-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

@@ -24,19 +24,17 @@ class PurchaseOrder(models.Model):
for order in self:
order.delivery_partner_id = order.dest_address_id
# Re-write native name_get() to use amount_untaxed instead of amount_total
@api.depends('name', 'partner_ref', 'amount_untaxed')
def name_get(self):
result = []
# Re-write native _compute_display_name to use amount_untaxed instead of amount_total
@api.depends('name', 'partner_ref', 'amount_total', 'currency_id')
@api.depends_context('show_total_amount')
def _compute_display_name(self):
for po in self:
name = po.name
if po.partner_ref:
name += ' (' + po.partner_ref + ')'
if self.env.context.get('show_total_amount') and po.amount_untaxed:
name += ': ' + format_amount(
self.env, po.amount_untaxed, po.currency_id)
result.append((po.id, name))
return result
name += ': ' + formatLang(self.env, po.amount_untaxed, currency_obj=po.currency_id)
po.display_name = name
# for report
def py3o_lines_layout(self):

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).

View File

@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2022 Akretion France (http://www.akretion.com/)
Copyright 2022-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).
-->
<odoo>
<!-- TODO check if it's still needed
<record id="view_move_form" model="ir.ui.view">
<field name="model">account.move</field>
@@ -17,6 +18,7 @@
</button>
</field>
</record>
-->
</odoo>

View File

@@ -13,16 +13,13 @@
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<button name="action_rfq_send" states="purchase" position="after">
<button name="%(purchase.action_report_purchase_order)d" states="purchase,done" string="Print" type="action"/>
<button name="action_rfq_send" type="object" context="{'send_rfq':False}" position="after">
<button name="%(purchase.action_report_purchase_order)d" invisible="state not in ('purchase', 'done')" string="Print" type="action"/>
</button>
<field name="fiscal_position_id" position="attributes">
<attribute name="widget">selection</attribute>
</field>
<button name="button_cancel" type="object" position="attributes">
<attribute name="confirm">Are you sure you want to cancel this purchase order?</attribute>
</button>
<xpath expr="//field[@name='order_line']/tree//field[@name='product_id']" position="after">
<xpath expr="//field[@name='order_line']/list//field[@name='product_id']" position="after">
<field name="product_supplier_code" optional="hide"/>
<field name="product_barcode" optional="hide"/>
</xpath>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
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).
-->
@@ -8,7 +8,7 @@
<odoo>
<record id="purchase.action_purchase_order_report_all" model="ir.actions.act_window">
<field name="view_mode">pivot,graph,tree</field> <!--- native order is graph,pivot. Switch order and add tree -->
<field name="view_mode">pivot,graph,list</field> <!--- native order is graph,pivot. Switch order and add list -->
</record>
</odoo>