Purpose ======= The Contact form is one of the most used/important view. It is quite important to find the piece of information easily and to navigate in a few clicks to the related views. Specification ============= Stat buttons ------------ - Restructure stat buttons with the following order: Opportunities -> sales user Meetings -> sales users Sales -> Sales users POS Sales -> pos users Subscriptions -> Subscription users Events -> event user Tasks -> project user TIckets -> helpdesk user Purchases -> purchase user Due -> billing: user Invoiced -> billing: user Vendor Bills -> billing: user Customer/Vendor Partner Ledger -> accounting: billing Analytic Accounts -> accounting: billing Credit Cards -> sales user Direct Debit Mandates -> accounting: billing user Publish - Use better/more relevant icons - Check that the proper access rights are set - Remove the bank accounts stat buttons and replace it by a one2many tree on the Invoicing page. Fields ------ Move some res.partner fields from the "Accouting" page to the "sale & Purchase" page: - Fiscal positions - Payment terms Miscellaneous ------------- - Remove dead code. - Display nothing instead "Please complete customer's informations and email" on the popup when sending an email to a contact without email address.
20 lines
776 B
Python
20 lines
776 B
Python
# coding: utf-8
|
|
|
|
from odoo import api, fields, models
|
|
|
|
|
|
class res_partner(models.Model):
|
|
_name = 'res.partner'
|
|
_inherit = 'res.partner'
|
|
|
|
payment_token_ids = fields.One2many('payment.token', 'partner_id', 'Payment Tokens')
|
|
payment_token_count = fields.Integer('Count Payment Token', compute='_compute_payment_token_count')
|
|
|
|
@api.depends('payment_token_ids')
|
|
def _compute_payment_token_count(self):
|
|
payment_data = self.env['payment.token'].read_group([
|
|
('partner_id', 'in', self.ids)], ['partner_id'], ['partner_id'])
|
|
mapped_data = dict([(payment['partner_id'][0], payment['partner_id_count']) for payment in payment_data])
|
|
for partner in self:
|
|
partner.payment_token_count = mapped_data.get(partner.id, 0)
|