Commit 6f4929c2 authored by Patrick's avatar Patrick

Django 1.9.11, CMS 3.4.1

parent c36d88d9
This diff is collapsed.
# -*- coding: utf-8 -*-
from django.core.cache import cache
from django.core.management.base import BaseCommand
from menus.menu_pool import menu_pool
from repanier.const import *
......@@ -10,10 +11,11 @@ class Command(BaseCommand):
help = 'Back to send'
def handle(self, *args, **options):
permanence = Permanence.objects.filter(id=6).order_by().first()
permanence = Permanence.objects.filter(id=6).order_by('?').first()
if PERMANENCE_PLANNED == permanence.status and permanence.highest_status == PERMANENCE_SEND:
OfferItem.objects.filter(permanence_id=permanence.id).update(is_active=True)
permanence.status = PERMANENCE_SEND
permanence.save(update_fields=['status'])
menu_pool.clear()
cache.clear()
......@@ -47,7 +47,7 @@ class Command(BaseCommand):
for product in Product.objects.all():
if product.picture is not None:
self.move(record=product, to_subdir="product" + os.sep + str(product.producer.id), size="M")
for obj in OfferItem.objects.filter(product_id=product.id).order_by():
for obj in OfferItem.objects.filter(product_id=product.id).order_by('?'):
obj.picture2 = product.picture2
obj.save()
......
# -*- coding: utf-8
# non proxies
from bankaccount import BankAccount
from configuration import Configuration
from customer import Customer
from deliveryboard import DeliveryBoard
from invoice import CustomerInvoice, ProducerInvoice, CustomerProducerInvoice
from lut import LUT_ProductionMode, LUT_DeliveryPoint, LUT_DepartmentForCustomer, LUT_PermanenceRole
from offeritem import OfferItem
from permanence import Permanence
from permanenceboard import PermanenceBoard
from producer import Producer
from product import Product, Product_Translation
from purchase import Purchase
from staff import Staff
# after Producer and Product
from box import BoxContent
# proxies
from box import Box
from invoice import CustomerSend
from offeritem import OfferItemSend, OfferItemClosed
from permanence import PermanenceInPreparation, PermanenceDone
\ No newline at end of file
# -*- coding: utf-8
from __future__ import unicode_literals
from django.core.validators import MinValueValidator
from django.db import models
from django.db.models.signals import pre_save
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _
from repanier.apps import REPANIER_SETTINGS_PERMANENCE_NAME
from repanier.const import *
from repanier.fields.RepanierMoneyField import ModelMoneyField
class BankAccount(models.Model):
permanence = models.ForeignKey(
'Permanence', verbose_name=REPANIER_SETTINGS_PERMANENCE_NAME,
on_delete=models.PROTECT, blank=True, null=True)
producer = models.ForeignKey(
'Producer', verbose_name=_("producer"),
on_delete=models.PROTECT, blank=True, null=True)
customer = models.ForeignKey(
'Customer', verbose_name=_("customer"),
on_delete=models.PROTECT, blank=True, null=True)
operation_date = models.DateField(_("operation_date"),
db_index=True)
operation_comment = models.CharField(
_("operation_comment"), max_length=100, null=True, blank=True)
operation_status = models.CharField(
max_length=3,
choices=LUT_BANK_TOTAL,
default=BANK_NOT_LATEST_TOTAL,
verbose_name=_("Bank balance status"),
db_index=True
)
bank_amount_in = ModelMoneyField(
_("bank_amount_in"), help_text=_('payment_on_the_account'),
max_digits=8, decimal_places=2, default=DECIMAL_ZERO,
validators=[MinValueValidator(0)])
bank_amount_out = ModelMoneyField(
_("bank_amount_out"), help_text=_('payment_from_the_account'),
max_digits=8, decimal_places=2, default=DECIMAL_ZERO,
validators=[MinValueValidator(0)])
producer_invoice = models.ForeignKey(
'ProducerInvoice', verbose_name=_("producer_invoice"),
blank=True, null=True, on_delete=models.PROTECT, db_index=True)
customer_invoice = models.ForeignKey(
'CustomerInvoice', verbose_name=_("customer_invoice"),
blank=True, null=True, on_delete=models.PROTECT, db_index=True)
is_updated_on = models.DateTimeField(
_("is_updated_on"), auto_now=True)
def get_bank_amount_in(self):
if self.operation_status in [BANK_PROFIT, BANK_TAX]:
return "<i>%s</i>" % (self.bank_amount_in if self.bank_amount_in.amount != DECIMAL_ZERO else EMPTY_STRING)
else:
return self.bank_amount_in if self.bank_amount_in.amount != DECIMAL_ZERO else EMPTY_STRING
get_bank_amount_in.short_description = (_("bank_amount_in"))
get_bank_amount_in.allow_tags = True
get_bank_amount_in.admin_order_field = 'bank_amount_in'
def get_bank_amount_out(self):
if self.operation_status in [BANK_PROFIT, BANK_TAX]:
return "<i>%s</i>" % (self.bank_amount_out if self.bank_amount_out.amount != DECIMAL_ZERO else EMPTY_STRING)
else:
return self.bank_amount_out if self.bank_amount_out.amount != DECIMAL_ZERO else EMPTY_STRING
get_bank_amount_out.short_description = (_("bank_amount_out"))
get_bank_amount_out.allow_tags = True
get_bank_amount_out.admin_order_field = 'bank_amount_out'
def get_producer(self):
if self.producer is not None:
return self.producer.short_profile_name
else:
if self.customer is None:
# This is a total, show it
from repanier.apps import REPANIER_SETTINGS_GROUP_NAME
if self.operation_status == BANK_LATEST_TOTAL:
return "<b>%s</b>" % "=== %s" % REPANIER_SETTINGS_GROUP_NAME
else:
return "<b>%s</b>" % "--- %s" % REPANIER_SETTINGS_GROUP_NAME
return EMPTY_STRING
get_producer.short_description = (_("producer"))
get_producer.allow_tags = True
get_producer.admin_order_field = 'producer'
def get_customer(self):
if self.customer is not None:
return self.customer.short_basket_name
else:
if self.producer is None:
# This is a total, show it
from repanier.apps import REPANIER_SETTINGS_BANK_ACCOUNT
if self.operation_status == BANK_LATEST_TOTAL:
if REPANIER_SETTINGS_BANK_ACCOUNT is not None:
return "<b>%s</b>" % REPANIER_SETTINGS_BANK_ACCOUNT
else:
return "<b>%s</b>" % "=============="
else:
if REPANIER_SETTINGS_BANK_ACCOUNT is not None:
return "<b>%s</b>" % REPANIER_SETTINGS_BANK_ACCOUNT
else:
return "<b>%s</b>" % "--------------"
return EMPTY_STRING
get_customer.short_description = (_("customer"))
get_customer.allow_tags = True
get_customer.admin_order_field = 'customer'
class Meta:
verbose_name = _("bank account movement")
verbose_name_plural = _("bank account movements")
ordering = ('-operation_date', '-id')
index_together = [
['operation_date', 'id'],
['customer_invoice', 'operation_date', 'id'],
['producer_invoice', 'operation_date', 'operation_date', 'id'],
['permanence', 'customer', 'producer', 'operation_date', 'id'],
]
@receiver(pre_save, sender=BankAccount)
def bank_account_pre_save(sender, **kwargs):
bank_account = kwargs["instance"]
if bank_account.producer is None and bank_account.customer is None:
initial_balance = BankAccount.objects.filter(
producer__isnull=True, customer__isnull=True).order_by('?').first()
if initial_balance is None:
bank_account.operation_status = BANK_LATEST_TOTAL
bank_account.permanence = None
bank_account.operation_comment = _("Initial balance")
bank_account.producer_invoice = None
bank_account.customer_invoice = None
# -*- coding: utf-8
from __future__ import unicode_literals
from django.core.validators import MinValueValidator
from django.db import models
from django.db.models.signals import pre_save
from django.dispatch import receiver
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from repanier.const import *
from repanier.fields.RepanierMoneyField import ModelMoneyField
from repanier.models.producer import Producer
from repanier.models.product import Product, product_pre_save
@python_2_unicode_compatible
class Box(Product):
def save_update_stock(self):
# stock : max_digits=9, decimal_places=3 => 1000000 > max(stock)
stock = 1000000
for box_content in BoxContent.objects.filter(
box_id=self.id,
product__limit_order_quantity_to_stock=True,
content_quantity__gt=DECIMAL_ZERO,
product__is_box=False # Disallow recursivity
).prefetch_related(
"product"
).only(
"content_quantity", "product__stock", "product__limit_order_quantity_to_stock"
).order_by('?'):
stock = min(stock, box_content.product.stock // box_content.content_quantity)
if stock < 1000000:
self.stock = stock
else:
self.stock = DECIMAL_ZERO
self.limit_order_quantity_to_stock = True
self.save(update_fields=['stock', 'limit_order_quantity_to_stock'])
class Meta:
proxy = True
verbose_name = _("box")
verbose_name_plural = _("boxes")
# ordering = ("sort_order",)
def __str__(self):
return '%s' % self.long_name
@receiver(pre_save, sender=Box)
def box_pre_save(sender, **kwargs):
box = kwargs["instance"]
box.is_box = True
box.producer_id = Producer.objects.filter(
represent_this_buyinggroup=True
).order_by('?').only('id').first().id
box.order_unit = PRODUCT_ORDER_UNIT_PC
box.producer_unit_price = box.customer_unit_price
box.producer_vat = box.customer_vat
# ! Important to initialise all fields of the box. Remember : a box is a product.
product_pre_save(sender, **kwargs)
@python_2_unicode_compatible
class BoxContent(models.Model):
box = models.ForeignKey(
'Box', verbose_name=_("box"),
null=True, blank=True, db_index=True, on_delete=models.PROTECT)
product = models.ForeignKey(
'Product', verbose_name=_("product"), related_name='box_content',
null=True, blank=True, db_index=True, on_delete=models.PROTECT)
content_quantity = models.DecimalField(
_("content quantity"),
default=DECIMAL_ZERO, max_digits=6, decimal_places=3,
validators=[MinValueValidator(0)])
calculated_customer_content_price = ModelMoneyField(
_("customer content price"),
default=DECIMAL_ZERO, max_digits=8, decimal_places=2)
calculated_content_deposit = ModelMoneyField(
_("content deposit"),
help_text=_('deposit to add to the original content price'),
default=DECIMAL_ZERO, max_digits=8, decimal_places=2)
def get_calculated_customer_content_price(self):
# workaround for a display problem with Money field in the admin list_display
return self.calculated_customer_content_price + self.calculated_content_deposit
get_calculated_customer_content_price.short_description = (_("customer content price"))
get_calculated_customer_content_price.allow_tags = False
# def get_calculated_content_deposit(self):
# workaround for a display problem with Money field in the admin list_display
# return self.calculated_content_deposit
#
# get_calculated_content_deposit.short_description = (_("content deposit"))
# get_calculated_content_deposit.allow_tags = False
class Meta:
verbose_name = _("box content")
verbose_name_plural = _("boxes content")
unique_together = ("box", "product",)
index_together = [
# ["box", "product"],
["product", "box"],
]
def __str__(self):
return EMPTY_STRING
@receiver(pre_save, sender=BoxContent)
def box_content_pre_save(sender, **kwargs):
box_content = kwargs["instance"]
product_id = box_content.product_id
if product_id is not None:
product = Product.objects.filter(id=product_id).order_by('?').only(
'customer_unit_price',
'unit_deposit'
).first()
if product is not None:
box_content.calculated_customer_content_price.amount = box_content.content_quantity * product.customer_unit_price.amount
box_content.calculated_content_deposit.amount = int(box_content.content_quantity) * product.unit_deposit.amount
This diff is collapsed.
This diff is collapsed.
# -*- coding: utf-8
from __future__ import unicode_literals
from django.conf import settings
from django.core.cache import cache
from django.db import models
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from menus.menu_pool import menu_pool
from parler.models import TranslatableModel, TranslatedFields, TranslationDoesNotExist
import invoice
import purchase
from repanier.apps import REPANIER_SETTINGS_PERMANENCE_NAME
from repanier.const import LUT_PERMANENCE_STATUS, PERMANENCE_PLANNED, PERMANENCE_SEND, EMPTY_STRING
@python_2_unicode_compatible
class DeliveryBoard(TranslatableModel):
translations = TranslatedFields(
delivery_comment=models.CharField(_("comment"), max_length=50, blank=True),
)
delivery_point = models.ForeignKey(
'LUT_DeliveryPoint', verbose_name=_("delivery point"),
null=True, blank=True, db_index=True, on_delete=models.PROTECT)
permanence = models.ForeignKey(
'Permanence', verbose_name=REPANIER_SETTINGS_PERMANENCE_NAME)
delivery_date = models.DateField(_("delivery date"), blank=True, null=True, db_index=True)
status = models.CharField(
max_length=3,
choices=LUT_PERMANENCE_STATUS,
default=PERMANENCE_PLANNED,
verbose_name=_("permanence_status"))
is_updated_on = models.DateTimeField(
_("is_updated_on"), auto_now=True)
highest_status = models.CharField(
max_length=3,
choices=LUT_PERMANENCE_STATUS,
default=PERMANENCE_PLANNED,
verbose_name=_("highest permanence_status"),
help_text=_('status of the permanence from planned, orders opened, orders closed, send, done'))
def set_status(self, new_status, all_producers=True, producers_id=None):
if all_producers:
now = timezone.now()
self.is_updated_on = now
self.status = new_status
if self.highest_status < new_status:
self.highest_status = new_status
self.save(update_fields=['status', 'is_updated_on', 'highest_status'])
invoice.CustomerInvoice.objects.filter(
delivery_id=self.id
).order_by('?').update(
status=new_status
)
purchase.Purchase.objects.filter(
customer_invoice__delivery_id=self.id
).order_by('?').update(
status=new_status)
menu_pool.clear()
cache.clear()
else:
purchase.Purchase.objects.filter(
customer_invoice__delivery_id=self.id,
producer__in=producers_id
).order_by('?').update(
status=new_status
)
def __str__(self):
try:
if self.delivery_comment != EMPTY_STRING:
comment = "%s " % self.delivery_comment
else:
comment = EMPTY_STRING
except TranslationDoesNotExist:
comment = EMPTY_STRING
if self.delivery_date is not None:
label = "%s %s%s" % (
self.delivery_date.strftime(settings.DJANGO_SETTINGS_DATE), comment, self.delivery_point.short_name)
else:
label = "%s%s" % (comment, self.delivery_point.short_name)
return label
def get_delivery_display(self):
return "%s - %s" % (self, self.get_status_display())
def get_delivery_customer_display(self):
if self.status != PERMANENCE_SEND:
return "%s - %s" % (self, self.get_status_display())
else:
return "%s - %s" % (self, _('orders closed'))
class Meta:
verbose_name = _("delivery board")
verbose_name_plural = _("deliveries board")
# ordering = ("id",)
# unique_together = ("permanence", "delivery_point", "delivery_date",)
# index_together = [
# ["permanence", "delivery_point", "delivery_date"],
# ]
This diff is collapsed.
# -*- coding: utf-8
from __future__ import unicode_literals
from django.core.validators import MinValueValidator, MaxValueValidator
from django.db import models
from django.db.models.signals import pre_save
from django.dispatch import receiver
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from djangocms_text_ckeditor.fields import HTMLField
from mptt.managers import TreeManager
from mptt.models import MPTTModel, TreeForeignKey
from parler.managers import TranslatableManager, TranslatableQuerySet
from parler.models import TranslatableModel, TranslatedFields
from repanier.fields.RepanierMoneyField import ModelMoneyField
from repanier.const import *
from repanier.picture.const import SIZE_XS
from repanier.picture.fields import AjaxPictureField
class LUT_ProductionModeQuerySet(TranslatableQuerySet):
pass
class LUT_ProductionModeManager(TreeManager, TranslatableManager):
queryset_class = LUT_ProductionModeQuerySet
@python_2_unicode_compatible
class LUT_ProductionMode(MPTTModel, TranslatableModel):
parent = TreeForeignKey('self', null=True, blank=True, related_name='children')
translations = TranslatedFields(
short_name=models.CharField(_("short_name"), max_length=50, db_index=True, unique=True, default=EMPTY_STRING),
description=HTMLField(_("description"), blank=True, default=EMPTY_STRING),
)
# picture = FilerImageField(
# verbose_name=_("picture"), related_name="production_mode_picture",
# null=True, blank=True)
picture2 = AjaxPictureField(
verbose_name=_("picture"),
null=True, blank=True,
upload_to="label", size=SIZE_XS)
is_active = models.BooleanField(_("is_active"), default=True)
objects = LUT_ProductionModeManager()
def __str__(self):
return self.short_name
class Meta:
verbose_name = _("production mode")
verbose_name_plural = _("production modes")
class LUT_DeliveryPointQuerySet(TranslatableQuerySet):
pass
class LUT_DeliveryPointManager(TreeManager, TranslatableManager):
queryset_class = LUT_DeliveryPointQuerySet
@python_2_unicode_compatible
class LUT_DeliveryPoint(MPTTModel, TranslatableModel):
parent = TreeForeignKey('self', null=True, blank=True, related_name='children')
translations = TranslatedFields(
short_name=models.CharField(_("short_name"), max_length=50, db_index=True, unique=True, default=EMPTY_STRING),
description=HTMLField(_("description"), blank=True, default=EMPTY_STRING),
)
is_active = models.BooleanField(_("is_active"), default=True)
customer_responsible = models.ForeignKey(
'Customer', verbose_name=_("customer_responsible"),
help_text=_("Invoices are sent to this consumer who is responsible for collecting the payments."),
on_delete=models.PROTECT, blank=True, null=True, default=None)
# with_entitled_customer = models.BooleanField(_("with entitled customer"), default=False)
closed_group = models.BooleanField(_("with entitled customer"), default=False)
price_list_multiplier = models.DecimalField(
_("Delivery point price list multiplier"),
help_text=_("This multiplier is applied once for groups with entitled customer."),
default=DECIMAL_ONE, max_digits=5, decimal_places=4, blank=True,
validators=[MinValueValidator(0)])
transport = ModelMoneyField(
_("Delivery point transport"),
help_text=_("This amount is added once for groups with entitled customer or at each customer for open groups."),
default=DECIMAL_ZERO, max_digits=5, decimal_places=2,
validators=[MinValueValidator(0)])
min_transport = ModelMoneyField(
_("Minium order amount for free shipping cost"),
help_text=_("This is the minimum order amount to avoid shipping cost."),
default=DECIMAL_ZERO, max_digits=5, decimal_places=2,
validators=[MinValueValidator(0)])
objects = LUT_DeliveryPointManager()
def __str__(self):
return self.short_name
class Meta:
verbose_name = _("delivery point")
verbose_name_plural = _("deliveries points")
class LUT_DepartmentForCustomerQuerySet(TranslatableQuerySet):
pass
class LUT_DepartmentForCustomerManager(TreeManager, TranslatableManager):
queryset_class = LUT_DepartmentForCustomerQuerySet
@python_2_unicode_compatible
class LUT_DepartmentForCustomer(MPTTModel, TranslatableModel):
parent = TreeForeignKey('self', null=True, blank=True, related_name='children')
translations = TranslatedFields(
short_name=models.CharField(_("short_name"), max_length=50, db_index=True, unique=True, default=EMPTY_STRING),
description=HTMLField(_("description"), blank=True, default=EMPTY_STRING),
)
is_active = models.BooleanField(_("is_active"), default=True)
objects = LUT_ProductionModeManager()
def __str__(self):
return self.short_name
class Meta:
verbose_name = _("department for customer")
verbose_name_plural = _("departments for customer")
class LUT_PermanenceRoleQuerySet(TranslatableQuerySet):
pass
class LUT_PermanenceRoleManager(TreeManager, TranslatableManager):
queryset_class = LUT_PermanenceRoleQuerySet
@python_2_unicode_compatible
class LUT_PermanenceRole(MPTTModel, TranslatableModel):
parent = TreeForeignKey('self', null=True, blank=True, related_name='children')
translations = TranslatedFields(
short_name=models.CharField(_("short_name"), max_length=50, db_index=True, unique=True, default=EMPTY_STRING),
description=HTMLField(_("description"), blank=True, default=EMPTY_STRING),
)
# delivery_points = models.ManyToManyField(
# LUT_DeliveryPoint,
# verbose_name=_("delivery points"),
# blank=True)
is_counted_as_participation = models.BooleanField(_("is_counted_as_participation"), default=True)
customers_may_register = models.BooleanField(_("customers_may_register"), default=True)
is_active = models.BooleanField(_("is_active"), default=True)
objects = LUT_ProductionModeManager()
def __str__(self):
return self.short_name
class Meta:
verbose_name = _("permanence role")
verbose_name_plural = _("permanences roles")
@receiver(pre_save, sender=LUT_PermanenceRole)
def lut_permanence_role_pre_save(sender, **kwargs):
permanence_role = kwargs["instance"]
if not permanence_role.is_active:
permanence_role.automatically_added = False
This diff is collapsed.
This diff is collapsed.
# -*- coding: utf-8
from __future__ import unicode_literals
from django.db import models
from django.db.models.signals import pre_save
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _
import repanier.apps
from repanier.const import EMPTY_STRING
class PermanenceBoard(models.Model):
customer = models.ForeignKey(
'Customer', verbose_name=_("customer"),
null=True, blank=True, db_index=True, on_delete=models.PROTECT)
permanence = models.ForeignKey(
'Permanence', verbose_name=repanier.apps.REPANIER_SETTINGS_PERMANENCE_NAME)
# permanence_date duplicated to quickly calculate # participation of lasts 12 months
permanence_date = models.DateField(_("permanence_date"), db_index=True)
permanence_role = models.ForeignKey(
'LUT_PermanenceRole', verbose_name=_("permanence_role"),
on_delete=models.PROTECT)
is_registered_on = models.DateTimeField(
_("is_registered_on"), null=True, blank=True)
class Meta:
verbose_name = _("permanence board")
verbose_name_plural = _("permanences board")
# ordering = ("permanence", "permanence_role", "customer",)
unique_together = ("permanence", "permanence_role", "customer",)
index_together = [
# ["permanence", "permanence_role", "customer"],
["permanence_date", "permanence", "permanence_role"],
]
def __str__(self):
return EMPTY_STRING
@receiver(pre_save, sender=PermanenceBoard)
def permanence_board_pre_save(sender, **kwargs):
permanence_board = kwargs["instance"]
permanence_board.permanence_date = permanence_board.permanence.permanence_date
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# -*- coding: utf-8
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.auth.models import Group
from django.db import models
from django.db.models.signals import post_delete
from django.db.models.signals import post_save
from django.db.models.signals import pre_save
from django.dispatch import receiver
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from djangocms_text_ckeditor.fields import HTMLField
from parler.models import TranslatableModel, TranslatedFields
from repanier.const import *
@python_2_unicode_compatible
class Staff(TranslatableModel):
user = models.OneToOneField(
settings.AUTH_USER_MODEL, verbose_name=_("login"))
customer_responsible = models.ForeignKey(
'Customer', verbose_name=_("customer_responsible"),
on_delete=models.PROTECT, blank=True, null=True, default=None)
login_attempt_counter = models.DecimalField(
_("login attempt counter"),
default=DECIMAL_ZERO, max_digits=2, decimal_places=0)
translations = TranslatedFields(
long_name=models.CharField(_("long_name"), max_length=100, db_index=True, null=True, default=EMPTY_STRING),
function_description=HTMLField(_("function_description"), blank=True, default=EMPTY_STRING),
)
is_reply_to_order_email = models.BooleanField(_("is_reply_to_order_email"),
default=False)
is_reply_to_invoice_email = models.BooleanField(_("is_reply_to_invoice_email"),
default=False)
is_contributor = models.BooleanField(_("is_contributor"),
default=False)
is_webmaster = models.BooleanField(_("is_webmaster"),
default=False)
is_coordinator = models.BooleanField(_("is_coordinator"),
default=False)
password_reset_on = models.DateTimeField(
_("password_reset_on"), null=True, blank=True, default=None)
is_active = models.BooleanField(_("is_active"), default=True)
def natural_key(self):
return self.user.natural_key()
natural_key.dependencies = ['auth.user']
def get_customer_phone1(self):
try:
return self.customer_responsible.phone1
except:
return "----"
get_customer_phone1.short_description = (_("phone1"))