Add traking on warn fields

WORK IN PROGRESS: port hr_holidays_usability
This commit is contained in:
Alexis de Lattre
2017-04-05 19:22:01 +02:00
parent b6accd6edd
commit a5bd385e45
11 changed files with 70 additions and 24 deletions

View File

@@ -41,26 +41,3 @@ class StockPicking(models.Model):
purchase_id = fields.Many2one(
related='move_lines.purchase_line_id.order_id', readonly=True,
string='Purchase Order')
class ResPartner(models.Model):
_inherit = 'res.partner'
# Fix an access right issue when accessing partner form without being
# a member of the purchase/User group
@api.multi
def _purchase_invoice_count(self):
poo = self.env['purchase.order']
aio = self.env['account.invoice']
for partner in self:
try:
partner.purchase_order_count = poo.search_count(
[('partner_id', 'child_of', partner.id)])
except:
pass
try:
partner.supplier_invoice_count = aio.search_count([
('partner_id', 'child_of', partner.id),
('type', '=', 'in_invoice')])
except:
pass