Indicator for overdue Portal-Customer; automatic selection of 'Auftragsbearbeiter'

develop
Andreas Osim 2020-05-27 10:23:29 +02:00
parent f68aad6173
commit f271d981cc
3 changed files with 29 additions and 0 deletions

View File

@ -84,6 +84,7 @@ class Partner(models.Model):
partner_sector_id = fields.Many2one(comodel_name='res.partner.sector', string='Branche')
active = fields.Boolean(track_visibility='onchange')
portal_export_pending = fields.Boolean(string='Portal Export ausständig')
warn_portal_date = fields.Boolean(compute='_get_warn_portal_date', store=False, default=False)
date_vat_check = fields.Date(string='Datum der letzten UID-Prüfung')
warn_vat_date = fields.Boolean(compute='_get_warn_date', store=False, default=False)
collective_bill = fields.Boolean(string='Sammelrechnung', default=True)
@ -114,6 +115,24 @@ class Partner(models.Model):
# Here we have to set partner_id.property_product_pricelist if it es empty and a parent_id is existing - else we rise an error
raise ValidationError(_("Ungültige Preisliste!"))
@api.multi
def _get_warn_portal_date(self):
for record in self:
if not record.active and record.portal_pending:
date_today = fields.Date.from_string(fields.Date.context_today(self))
warn_date = date_today - relativedelta(days=+2)
try:
check_date = dateutil.parser.parse(record.create_date).date()
except:
check_date = date_today
if check_date < warn_date:
record.warn_portal_date = True
else:
record.warn_portal_date = False
else:
record.warn_portal_date = False
@api.multi
def _get_warn_date(self):
for record in self:

View File

@ -504,6 +504,9 @@ class SaleOrder(models.Model):
@api.multi
def write(self, vals):
if not self.editor_id.id and self.env.user.editor_name:
vals['editor_id'] = self.env.user.id
if self.desired_delivery_date:
if not self.delivery_date:
vals['delivery_date'] = self.desired_delivery_date

View File

@ -104,7 +104,14 @@
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_tree"/>
<field name="arch" type="xml">
<tree position="attributes">
<attribute name="decoration-bf">portal_pending and create_date &lt; current_date</attribute>
<attribute name="decoration-danger">warn_portal_date</attribute>
</tree>
<field name="display_name" position="after">
<field name="warn_portal_date" invisible="1"/>
<field name="portal_pending" invisible="1"/>
<field name="create_date" invisible="1"/>
<field name="street"/>
<field name="zip"/>
<field name="city"/>