[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> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
'name': 'Purchase Usability', 'name': 'Purchase Usability',
'version': '16.0.1.0.0', 'version': '18.0.1.0.0',
'category': 'Purchases', 'category': 'Purchases',
'license': 'AGPL-3', 'license': 'AGPL-3',
'summary': 'Usability improvements on purchase module', 'summary': 'Usability improvements on purchase module',
'author': 'Akretion', 'author': 'Akretion',
'website': 'http://www.akretion.com', 'website': 'https://github.com/akretion/odoo-usability',
'depends': ['purchase'], 'depends': ['purchase'],
'data': [ 'data': [
'views/purchase_order.xml', 'views/purchase_order.xml',
'views/purchase_report.xml', 'views/purchase_report.xml',
'views/account_move.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> # @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). # 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([ lines = self.env['account.move.line'].search([
('move_id', '=', self.id), ('move_id', '=', self.id),
('quantity', '=', 0), ('quantity', '=', 0),
('display_type', '=', False), ('display_type', '=', 'product'),
]) ])
lines.unlink() 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> # @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # 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: for order in self:
order.delivery_partner_id = order.dest_address_id order.delivery_partner_id = order.dest_address_id
# Re-write native name_get() to use amount_untaxed instead of amount_total # Re-write native _compute_display_name to use amount_untaxed instead of amount_total
@api.depends('name', 'partner_ref', 'amount_untaxed') @api.depends('name', 'partner_ref', 'amount_total', 'currency_id')
def name_get(self): @api.depends_context('show_total_amount')
result = [] def _compute_display_name(self):
for po in self: for po in self:
name = po.name name = po.name
if po.partner_ref: if po.partner_ref:
name += ' (' + po.partner_ref + ')' name += ' (' + po.partner_ref + ')'
if self.env.context.get('show_total_amount') and po.amount_untaxed: if self.env.context.get('show_total_amount') and po.amount_untaxed:
name += ': ' + format_amount( name += ': ' + formatLang(self.env, po.amount_untaxed, currency_obj=po.currency_id)
self.env, po.amount_untaxed, po.currency_id) po.display_name = name
result.append((po.id, name))
return result
# for report # for report
def py3o_lines_layout(self): 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> # @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # 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"?> <?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> @author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
<odoo> <odoo>
<!-- TODO check if it's still needed
<record id="view_move_form" model="ir.ui.view"> <record id="view_move_form" model="ir.ui.view">
<field name="model">account.move</field> <field name="model">account.move</field>
@@ -17,6 +18,7 @@
</button> </button>
</field> </field>
</record> </record>
-->
</odoo> </odoo>

View File

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

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?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> @author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
@@ -8,7 +8,7 @@
<odoo> <odoo>
<record id="purchase.action_purchase_order_report_all" model="ir.actions.act_window"> <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> </record>
</odoo> </odoo>