odoo/ext/custom-addons/dp_retail_invoice/models/res_partner.py

40 lines
1.6 KiB
Python

# -*- coding: utf-8 -*-
##############################################################################
#
# datenpol gmbh
# Copyright (C) 2013-TODAY datenpol gmbh (<http://www.datenpol.at/>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from odoo import api, fields, models
class Partner(models.Model):
_inherit = 'res.partner'
retailer = fields.Boolean(string='Ist ein Händler')
retail_partner_id = fields.Many2one(comodel_name='res.partner', string='Händler', domain=[('retailer', '=', True)],
help='Wenn ein Händler existiert, dann passiert die Verrechnung über den Händler')
@api.multi
def address_get(self, adr_pref=None):
res = super(Partner, self).address_get(adr_pref=adr_pref)
for record in self:
if record.commercial_partner_id.retail_partner_id:
pass
return res