update app-odoo , app base

This commit is contained in:
ivan deng
2019-10-28 04:38:00 +08:00
parent 54a4d59a6a
commit 27e1306476
9 changed files with 62 additions and 161 deletions

View File

@@ -24,7 +24,41 @@ from odoo.tools import pycompat
class Partner(models.Model):
_inherit = 'res.partner'
customer = fields.Boolean(string='Is a Customer', default=True,
def _get_default_customer(self):
search_partner_mode = self.env.context.get('res_partner_search_mode')
is_customer = search_partner_mode == 'customer'
if is_customer and not self.env.context.get('default_customer'):
return is_customer
else:
return None
def _get_default_supplier(self):
search_partner_mode = self.env.context.get('res_partner_search_mode')
is_supplier = search_partner_mode == 'supplier'
if is_supplier and not self.env.context.get('default_supplier'):
return is_supplier
else:
return None
customer = fields.Boolean(string='Is a Customer', default=_get_default_customer, inverse='_set_customer',
help="Check this box if this contact is a customer. It can be selected in sales orders.")
supplier = fields.Boolean(string='Is a Vendor',
supplier = fields.Boolean(string='Is a Vendor', default=_get_default_supplier, inverse='_set_supplier',
help="Check this box if this contact is a vendor. It can be selected in purchase orders.")
def _set_customer(self):
for rec in self:
if rec.customer:
if rec.customer_rank < 1 or not rec.customer_rank:
rec.customer_rank = 1
else:
rec.customer_rank = 0
def _set_supplier(self):
for rec in self:
if rec.supplier:
if rec.supplier_rank < 1 or not rec.supplier_rank:
rec.supplier_rank = 1
else:
rec.supplier_rank = 0