Improve list view of res.partner.bank

Improve name_get of res.bank
Add filter on product categ on pos_sale_report
This commit is contained in:
Alexis de Lattre
2019-02-27 17:30:36 +01:00
parent e33bee1f05
commit aec54baec5
4 changed files with 28 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
from . import users
from . import partner
from . import bank
from . import company
from . import mail
from . import misc

20
base_usability/bank.py Normal file
View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, api
class ResBank(models.Model):
_inherit = 'res.bank'
@api.multi
@api.depends('name', 'bic')
def name_get(self):
result = []
for bank in self:
name = bank.name
if bank.bic:
name = u'[%s] %s' % (bank.bic, name)
result.append((bank.id, name))
return result

View File

@@ -16,6 +16,12 @@
<attribute name="invisible">0</attribute>
<attribute name="widget">handle</attribute>
</field>
<field name="bank_name" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="bank_name" position="after">
<field name="bank_id"/>
</field>
</field>
</record>

View File

@@ -9,6 +9,7 @@
<search string="POS orders and Sale orders aggregated report">
<field name="product_tmpl_id"/>
<field name="product_id"/>
<field name="product_categ_id"/>
<filter name="today" string="Today"
domain="[('date', '=', context_today().strftime('%Y-%m-%d'))]"/>
<filter name="yesterday" string="Yesterday"