diff --git a/ext/custom-addons/dp_custom/__manifest__.py b/ext/custom-addons/dp_custom/__manifest__.py index 896995ef..8eadd909 100644 --- a/ext/custom-addons/dp_custom/__manifest__.py +++ b/ext/custom-addons/dp_custom/__manifest__.py @@ -54,6 +54,7 @@ 'data/product_data.xml', 'data/tz_tax_data.xml', 'data/cron_job.xml', + 'views/dp_template.xml', 'views/dp_custom_views.xml', 'views/res_line_views.xml', 'views/res_partner_views.xml', diff --git a/ext/custom-addons/dp_custom/models/sale.py b/ext/custom-addons/dp_custom/models/sale.py index f884f304..166c7eec 100644 --- a/ext/custom-addons/dp_custom/models/sale.py +++ b/ext/custom-addons/dp_custom/models/sale.py @@ -27,6 +27,8 @@ from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT from odoo.tools import float_compare from odoo.tools import float_is_zero +from dateutil.relativedelta import relativedelta +import dateutil.parser class SaleOrder(models.Model): _name = 'sale.order' @@ -71,6 +73,10 @@ class SaleOrder(models.Model): order_type = fields.Selection(ORDER_TYPES, string='Auftragsart', default='M') clerk_id = fields.Many2one('res.users', string='Sachbearbeiter', domain=[('clerk_name', '!=', '')]) desired_delivery_date = fields.Date(string='Wunschlieferdatum') + delivery_date_warning = fields.Boolean(compute='_compute_dlv_date_warn', store=False) + warn_vat_date = fields.Boolean(compute='_get_vat_warn_date', store=False, default=False) + date_vat_check = fields.Date(related='partner_invoice_id.date_vat_check') + vat = fields.Char(related='partner_invoice_id.vat') # pg9_call = fields.Char(string='PG9-Auftrag', compute='_pg9_call', store=False) pg9_call_D = fields.Char(string='PG9-Auftrag_D', compute='_pg9_call', store=False) @@ -79,6 +85,30 @@ class SaleOrder(models.Model): pg9_complete = fields.Boolean(string='PG9-Komplett', compute='_compute_positions', store=False, default=False) # partner_flash = fields.Char(store=False) + @api.multi + def _get_vat_warn_date(self): + for record in self: + if record.partner_invoice_id.date_vat_check: + date_today = fields.Date.from_string(fields.Date.context_today(self)) + warn_date = date_today - relativedelta(months=+3) + try: + check_date = dateutil.parser.parse(record.date_vat_check).date() + except: + check_date = date_today - relativedelta(months=+36) + if check_date < warn_date: + record.warn_vat_date = True + else: + record.warn_vat_date = False + else: + record.warn_vat_date = True + + @api.multi + def _compute_dlv_date_warn(self): + for record in self: + record.delivery_date_warning = False + if record.desired_delivery_date > record.delivery_date: + record.delivery_date_warning = True + @api.multi def _reset_sequence(self): for rec in self: diff --git a/ext/custom-addons/dp_custom/static/src/less/special_effects.less b/ext/custom-addons/dp_custom/static/src/less/special_effects.less new file mode 100644 index 00000000..eb363c88 --- /dev/null +++ b/ext/custom-addons/dp_custom/static/src/less/special_effects.less @@ -0,0 +1,17 @@ +.oe_highlight_blink { + .animation-blink(blink, rgb(0,0,255) + 200, rgb(0,0,255), ); + &.urgent { + .animation-blink(urgent, rgb(0,255,0), rgb(0,255,0) + 200); + } +} + +.animation-blink(@name_, @color1, @color2, @color3: red, @time: .5s) { + + @name: ~"animation-blink-@{name_}"; + animation: @name @time ease-in-out infinite alternate; + + @keyframes @name { + 0% {color: @color1 ; background-color: transparent} + to {color: @color2 ; background-color: @color3} + } +} diff --git a/ext/custom-addons/dp_custom/views/dp_template.xml b/ext/custom-addons/dp_custom/views/dp_template.xml new file mode 100644 index 00000000..4b74e23a --- /dev/null +++ b/ext/custom-addons/dp_custom/views/dp_template.xml @@ -0,0 +1,8 @@ + + + + diff --git a/ext/custom-addons/dp_custom/views/sale_views.xml b/ext/custom-addons/dp_custom/views/sale_views.xml index 9ec9ce8e..e7b82744 100644 --- a/ext/custom-addons/dp_custom/views/sale_views.xml +++ b/ext/custom-addons/dp_custom/views/sale_views.xml @@ -18,10 +18,16 @@ + + +
- + + +