Merge branch 'develop' into website
commit
e81ef06fa2
|
|
@ -22,5 +22,8 @@ server_wide_modules = web,base_sparse_field,queue_job
|
|||
portal_url = https://erp.tzaustria.info
|
||||
portal_secret = secret
|
||||
|
||||
imos_base_url = https://2138.testshop.imos3d.com
|
||||
imos_pass = 8io4u39ruhiz378uih
|
||||
|
||||
[queue_job]
|
||||
channels = root:4
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
'views/commission_account.xml',
|
||||
'wizards/wizard_confirm_production.xml',
|
||||
'wizards/wizard_import_tzbox.xml',
|
||||
'wizards/wizard_reset_order.xml',
|
||||
'wizards/portal_assign_company.xml',
|
||||
'wizards/wizard_confirm_print_invoice.xml',
|
||||
'security/security.xml',
|
||||
|
|
|
|||
|
|
@ -514,7 +514,7 @@ class SaleOrderLine(models.Model):
|
|||
self.ensure_one()
|
||||
allowed_write = True
|
||||
precision_digits = self.env['decimal.precision'].precision_get('Product Price')
|
||||
if self.from_designbox and set(vals.keys()).intersection(not_allowed_designbox_keys):
|
||||
if (self.from_designbox and self.product_id.default_code!='TZ_PLATTE') and set(vals.keys()).intersection(not_allowed_designbox_keys):
|
||||
for val_key in not_allowed_designbox_keys:
|
||||
if val_key in list(vals.keys()) and type(self.__getattribute__(val_key)) is float:
|
||||
if float_compare(self.__getattribute__(val_key), vals[val_key],
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
<field name="user_id" position="after">
|
||||
<field name="commission_account_ids" widget="many2many_tags"/>
|
||||
</field>
|
||||
<xpath expr="//div[@class='oe_kanban_details']" position="inside">
|
||||
<xpath expr="//div[hasclass('oe_kanban_details')]" position="inside">
|
||||
<div>
|
||||
<span>KD-Nr: </span><field name="ref"/>
|
||||
<span t-if="record.portal_id.raw_value"> / P-ID: </span><field t-if="record.portal_id.raw_value" name="portal_id"/>
|
||||
|
|
@ -180,7 +180,7 @@
|
|||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.res_partner_kanban_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@class='oe_kanban_details']" position="inside">
|
||||
<xpath expr="//div[hasclass('oe_kanban_details')]" position="inside">
|
||||
<div>
|
||||
<span>KD-Nr: </span><field name="ref"/>
|
||||
<span t-if="record.portal_id.raw_value"> / P-ID: </span><field t-if="record.portal_id.raw_value" name="portal_id"/>
|
||||
|
|
|
|||
|
|
@ -2,3 +2,5 @@ from . import wizard_confirm_production
|
|||
from . import wizard_import_tzbox
|
||||
from . import wizard_confirm_print_invoice
|
||||
from . import portal_assign_company
|
||||
from . import wizard_reset_order
|
||||
|
||||
|
|
|
|||
|
|
@ -53,14 +53,14 @@ class PortalAssignCompany(models.TransientModel):
|
|||
if error_content and error_msg.get('errors'):
|
||||
raise UserError(_('%s') % (error_msg.get('errors')[0]))
|
||||
else:
|
||||
raise UserError(_('Die Odoo id konnte für den partner nicht gesetzt werden. '
|
||||
raise UserError(_('Die Odoo id konnte für den Partner nicht gesetzt werden. '
|
||||
'Status Code: %s, Reason: %s') % (response.status_code, response.reason))
|
||||
|
||||
def button_activate(self):
|
||||
self.ensure_one()
|
||||
partner = self.env['res.partner'].browse(self.env.context.get('active_ids', []))
|
||||
if not partner:
|
||||
raise ValidationError(_('Der Partner konnte nicht gefuden werden.'))
|
||||
raise ValidationError(_('Der Partner konnte nicht gefunden werden.'))
|
||||
|
||||
# Wichtig hier ist, dass dieser Call vor dem ersten Write stattfindet, da das Portal
|
||||
# parallel einen Call absetzt, dann dann blockieren würde.
|
||||
|
|
@ -74,7 +74,7 @@ class PortalAssignCompany(models.TransientModel):
|
|||
if self.main_partner_id:
|
||||
partner = self.env['res.partner'].browse(self.env.context.get('active_ids', []))
|
||||
if not partner:
|
||||
raise ValidationError(_('Der Partner konnte nicht gefuden werden.'))
|
||||
raise ValidationError(_('Der Partner konnte nicht gefunden werden.'))
|
||||
portal_id = partner.portal_id
|
||||
|
||||
# Wichtig hier ist, dass dieser Call vor dem ersten Write stattfindet, da das Portal
|
||||
|
|
|
|||
|
|
@ -0,0 +1,90 @@
|
|||
# Copyright 2018-Today datenpol gmbh (<http://www.datenpol.at>)
|
||||
# License OPL-1 or later (https://www.odoo.com/documentation/user/11.0/legal/licenses/licenses.html#licenses).
|
||||
|
||||
from odoo import tools, api, fields, models, _
|
||||
from odoo.exceptions import ValidationError, UserError, Warning
|
||||
|
||||
import json
|
||||
import requests
|
||||
|
||||
class WizardResetOrder(models.TransientModel):
|
||||
_name = 'wizard.reset_order'
|
||||
_description = 'Reset imos-Order'
|
||||
|
||||
# name = fields.Char()
|
||||
#
|
||||
# @api.onchange('name')
|
||||
# def _onchange_name(self):
|
||||
# return {
|
||||
# 'warning': {
|
||||
# 'title': _('Warning!'),
|
||||
# 'message': _("Achtung, es gab Fehler"),
|
||||
# }
|
||||
# }
|
||||
|
||||
@api.multi
|
||||
def button_reset_order(self):
|
||||
for wizard in self:
|
||||
error_at_quotation = False
|
||||
info = 'Bitte prüfen Sie den Angebotsstatus & Auftragsart folgender Angebote:'
|
||||
active_ids = self.env.context.get('active_ids', [])
|
||||
sale_orders = self.env['sale.order'].browse(active_ids)
|
||||
if sale_orders.exists():
|
||||
for so in sale_orders:
|
||||
if so.state == 'cancel' and so.order_type == 'D':
|
||||
info += "\n %s -- OK" % so.name
|
||||
else:
|
||||
info += "\n %s state='%s',order_type='%s'" % (so.name,so.state,so.order_type)
|
||||
error_at_quotation = True
|
||||
if error_at_quotation:
|
||||
raise ValidationError(_(info))
|
||||
|
||||
info = 'Mindestens ein Warenkorb konnte nicht zurückgesetzt werden:'
|
||||
for so in sale_orders:
|
||||
order_info = self.reset_order_status(so.origin)
|
||||
if order_info != '':
|
||||
error_at_quotation = True
|
||||
info += "\n%s" % order_info
|
||||
so.message_post(body='Warenkorb konnte im DesignBox-Portal nicht zurückgesetzt werden!\n %s' % order_info)
|
||||
else:
|
||||
info += "\n%s --> OK" % so.name
|
||||
so.message_post(body='Warenkorb im DesignBox-Portal zurückgesetzt!\n%s --> OK' % so.origin)
|
||||
|
||||
if error_at_quotation:
|
||||
raise Warning(_(info))
|
||||
# self.name = _(info)
|
||||
|
||||
action = self.env.ref('sale.action_orders').read()[0]
|
||||
action['domain'] = [('id', 'in', active_ids)]
|
||||
return action
|
||||
|
||||
def reset_order_status(self, order_id):
|
||||
self.ensure_one()
|
||||
imos_base_url = tools.config.get('imos_base_url')
|
||||
imos_pass = tools.config.get('imos_pass')
|
||||
imos_url = imos_base_url + r'&tx_imosnetpublic_api[controller]=Basket&tx_imosnetpublic_api[action]=update'
|
||||
idata = {"uid" : int(order_id[-6:]), "status" : 0}
|
||||
data = {
|
||||
'pass' : imos_pass,
|
||||
'user' : 'publicapiuser',
|
||||
'pid' : 5,
|
||||
'logintype' : 'login',
|
||||
'tx_imosnetpublic_api[data]' : json.dumps(idata)
|
||||
}
|
||||
response = requests.post(imos_url, data=data)
|
||||
|
||||
info = ''
|
||||
try:
|
||||
lRes = json.loads(response.content.decode())
|
||||
except Exception as e:
|
||||
info = 'unexpected error %s' % e
|
||||
raise ValidationError(_(info))
|
||||
|
||||
if response.status_code == 200:
|
||||
if lRes.get('status') != 0:
|
||||
info = "Warenkorb: %s, Fehler='%s'" % (order_id,lRes)
|
||||
else:
|
||||
if lRes.get('status') != 0:
|
||||
info = "Warenkorb: %s, Fehler='%s'" % (order_id,lRes.get('data'))
|
||||
|
||||
return info
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright 2018-Today datenpol gmbh(<http://www.datenpol.at>)
|
||||
License OPL-1 or later (https://www.odoo.com/documentation/user/11.0/legal/licenses/licenses.html#licenses). -->
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="view_wizard_reset_order_form" model="ir.ui.view">
|
||||
<field name="name">view_wizard_reset_order_form</field>
|
||||
<field name="model">wizard.reset_order</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Wizard Reset Order">
|
||||
<group>
|
||||
<p>Wollen Sie die imos-Bestellung für die markierten Aufträge zurücksetzen?</p>
|
||||
</group>
|
||||
|
||||
<!--
|
||||
<group>
|
||||
<field name="name"/>
|
||||
</group>
|
||||
-->
|
||||
<footer>
|
||||
<button name="button_reset_order"
|
||||
string="imos-Bestellung zurücksetzen"
|
||||
class="btn-primary"
|
||||
type="object"/>
|
||||
<button string="Abbrechen"
|
||||
class="btn-default"
|
||||
special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window id="action_wizard_reset_order"
|
||||
name="imos-Bestellung zurücksetzen"
|
||||
src_model="sale.order"
|
||||
res_model="wizard.reset_order"
|
||||
view_type="form"
|
||||
view_mode="form"
|
||||
key2="client_action_multi"
|
||||
target="new"/>
|
||||
</odoo>
|
||||
|
|
@ -1 +1,2 @@
|
|||
from . import models
|
||||
from . import wizards
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
# noinspection PyStatementEffect
|
||||
{
|
||||
'name': 'dp Order line comments',
|
||||
'name': 'dp line comments',
|
||||
'summary': 'Comments templates on invoice and sale lines',
|
||||
'version': '11.0.1.0.0',
|
||||
'license': 'OPL-1',
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
'data': [
|
||||
'views/account_invoice_view.xml',
|
||||
'views/sale_order_view.xml',
|
||||
'wizards/wizard_add_line_comment.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
|
|
|
|||
|
|
@ -15,3 +15,14 @@ class AccountInvoice(models.Model):
|
|||
comment = self.comment_line_template_id
|
||||
if comment:
|
||||
self.note_line = comment.get_value(self.partner_id.id)
|
||||
|
||||
|
||||
class AccountInvoiceLine(models.Model):
|
||||
_inherit = "account.invoice.line"
|
||||
|
||||
@api.multi
|
||||
def add_line_comment(self):
|
||||
self.ensure_one()
|
||||
action = self.env.ref('dp_line_comment_template.action_wizard_line_comment').read()[0]
|
||||
action['context'] = str({"model_name": 'account.invoice.line', "model_id": self.id})
|
||||
return action
|
||||
|
|
|
|||
|
|
@ -24,3 +24,14 @@ class SaleOrder(models.Model):
|
|||
'note_line': self.note_line,
|
||||
})
|
||||
return values
|
||||
|
||||
|
||||
class SaleOrderLine(models.Model):
|
||||
_inherit = "sale.order.line"
|
||||
|
||||
@api.multi
|
||||
def add_line_comment(self):
|
||||
self.ensure_one()
|
||||
action = self.env.ref('dp_line_comment_template.action_wizard_line_comment').read()[0]
|
||||
action['context'] = str({"model_name": 'sale.order.line', "model_id": self.id})
|
||||
return action
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@
|
|||
<field name="note_line" nolabel="1" colspan="2"/>
|
||||
</group>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='name']" position="after">
|
||||
<!--<label for="add_line_comment">TB</label>-->
|
||||
<button name="add_line_comment" string="Textbaustein" icon="fa-plus-square" type="object"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@
|
|||
<field name="note_line" nolabel="1" colspan="2"/>
|
||||
</group>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="after">
|
||||
<!--<label for="add_line_comment">TB</label>-->
|
||||
<button name="add_line_comment" string="Textbaustein" icon="fa-plus-square" type="object"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
from . import wizard_add_line_comment
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
# Copyright 2018-Today datenpol gmbh (<http://www.datenpol.at>)
|
||||
# License OPL-1 or later (https://www.odoo.com/documentation/user/11.0/legal/licenses/licenses.html#licenses).
|
||||
|
||||
import re
|
||||
|
||||
from odoo import fields, models, api
|
||||
|
||||
|
||||
class AddLineComment(models.TransientModel):
|
||||
_name = 'wizard.add_line_comment'
|
||||
_description = 'Zeilentextbaustein hinzufügen'
|
||||
|
||||
comment_line_template_id = fields.Many2one('base.comment.template', string='Line Comment Template')
|
||||
note_line = fields.Html('Line Comment')
|
||||
|
||||
@api.onchange('comment_line_template_id')
|
||||
def _onchange_note_line(self):
|
||||
comment = self.comment_line_template_id
|
||||
if comment:
|
||||
model_name = self.env.context.get('model_name')
|
||||
model_id = self.env.context.get('model_id')
|
||||
if model_name == 'sale.order.line':
|
||||
self.note_line = comment.get_value(self.env[model_name].browse([model_id]).order_id.partner_id.id)
|
||||
if model_name == 'account.invoice.line':
|
||||
self.note_line = comment.get_value(self.env[model_name].browse([model_id]).invoice_id.partner_id.id)
|
||||
|
||||
def add_line_comment(self):
|
||||
self.ensure_one()
|
||||
regex = re.compile(r"(?i)<[^>]*>", re.IGNORECASE)
|
||||
name = regex.sub('', self.note_line)
|
||||
self.env[self.env.context.get('model_name')].browse([self.env.context.get('model_id')]).name += "\n" + name
|
||||
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright 2018-Today datenpol gmbh(<http://www.datenpol.at>)
|
||||
License OPL-1 or later (https://www.odoo.com/documentation/user/11.0/legal/licenses/licenses.html#licenses). -->
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="wizard_add_line_comment_form_view" model="ir.ui.view">
|
||||
<field name="name">wizard_add_line_comment_form_view</field>
|
||||
<field name="model">wizard.add_line_comment</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Zeilentextbaustein hinzufügen">
|
||||
<group>
|
||||
<field name="comment_line_template_id"/>
|
||||
<field name="note_line"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="add_line_comment" string="Zeilentextbaustein hinzufügen" class="btn-primary" type="object"/>
|
||||
<button string="Abbrechen" class="btn-default" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_wizard_line_comment" model="ir.actions.act_window">
|
||||
<field name="name">Zeilentextbaustein hinzufügen</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">wizard.add_line_comment</field>
|
||||
<field name="target">new</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -273,6 +273,9 @@
|
|||
<span t-esc="o.payment_term_id.name"/>
|
||||
<br/>
|
||||
</p>
|
||||
<p class="col-xs-12" t-if="o.partner_id.property_account_position_id.name=='IG-Ausland'">
|
||||
Dies ist eine steuerfreie innergemeinschaftliche Lieferung
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@
|
|||
</tbody>
|
||||
</table>
|
||||
<t t-set="total_ordered_qty" t-value="0"/>
|
||||
<t t-set="total_dlv_qty" t-value="0"/>
|
||||
<table class="table table-condensed mt48" t-if="not o.move_line_ids">
|
||||
<thead class="table-header">
|
||||
<tr>
|
||||
|
|
@ -140,6 +141,8 @@
|
|||
<td>
|
||||
<t t-set="ordered_qty" t-value="int(o._formatLang(move_line.ordered_qty).strip('0').strip(',').strip('.'))"/>
|
||||
<t t-set="total_ordered_qty" t-value="total_ordered_qty+ordered_qty"/>
|
||||
<t t-set="dlv_qty" t-value="int(move_line.qty_done)"/>
|
||||
<t t-set="total_dlv_qty" t-value="total_dlv_qty+dlv_qty"/>
|
||||
<span t-esc="ordered_qty"/>
|
||||
<span t-field="move.product_uom"/>
|
||||
</td>
|
||||
|
|
@ -204,8 +207,14 @@
|
|||
<td class="text-center">
|
||||
<span t-field="move_line.package_id"/>
|
||||
<span t-if="move_line.package_id">:</span>
|
||||
<!--
|
||||
<t t-set="ordered_qty" t-value="int(o._formatLang(move_line.ordered_qty).strip('0').strip(',').strip('.'))"/>
|
||||
<t t-set="total_ordered_qty" t-value="total_ordered_qty+ordered_qty"/>
|
||||
-->
|
||||
<t t-set="ordered_qty" t-value="int(move_line.ordered_qty)"/>
|
||||
<t t-set="total_ordered_qty" t-value="total_ordered_qty+ordered_qty"/>
|
||||
<t t-set="dlv_qty" t-value="int(move_line.qty_done)"/>
|
||||
<t t-set="total_dlv_qty" t-value="total_dlv_qty+dlv_qty"/>
|
||||
<span t-esc="ordered_qty"/>
|
||||
<span t-field="move_line.product_uom_id"/>
|
||||
</td>
|
||||
|
|
@ -230,7 +239,12 @@
|
|||
<div class="col-xs-6">
|
||||
<span class="pull-right" style="padding-top: 5px; border-top: 1px solid;">
|
||||
<strong>Total Amount:</strong>
|
||||
<span t-esc="total_ordered_qty"/>
|
||||
<!--
|
||||
<span t-esc="total_ordered_qty" t-if="total_dlv_qty==0"/>
|
||||
<span t-esc="total_dlv_qty" t-if="total_dlv_qty>0"/>
|
||||
-->
|
||||
<span t-esc="total_ordered_qty" t-if="not backorder"/>
|
||||
<span t-esc="total_dlv_qty" t-if="backorder"/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue