Fall 5430: Änderungswünsche - Andruck Zolltarifnummer

develop
Ahmed Aly 2018-04-11 15:17:12 +02:00
parent 923a7a2efa
commit 8532166c1e
8 changed files with 85 additions and 7 deletions

View File

@ -43,6 +43,7 @@
'views/commission_account.xml',
'wizards/wizard_confirm_production.xml',
'wizards/portal_assign_company.xml',
'wizards/wizard_confirm_print_invoice.xml',
'security/security.xml',
'data/dp_custom_data.xml',
'data/glaser_company_data.xml',

View File

@ -121,3 +121,21 @@ class AccountInvoice(models.Model):
elif currency_obj and currency_obj.position == 'before':
res = '%s %s' % (currency_obj.symbol, res)
return res
@api.multi
def print_intrastat_invoice(self):
self.ensure_one()
info = "Bei folgenden Produkten fehlt die Zolltarifnummer:\n"
intrastrat_not_set = False
for invoice_line in self.invoice_line_ids:
if invoice_line.product_id and invoice_line.product_id.type != 'service':
if not invoice_line.intrastat_id:
info += invoice_line.name + "\n"
intrastrat_not_set = True
if intrastrat_not_set:
action = self.env.ref('dp_custom.action_wizard_confirm_print_invoice').read()[0]
action['context'] = '{"default_info": "'+info+'"}'
return action
return self.env.ref('dp_reports_account.account_invoices_with_intrastat').report_action(self)

View File

@ -1,4 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="action_print_intrastat_invoice" model="ir.actions.server">
<field name="name">Rechnung mit Zolltarifnummer</field>
<field name="type">ir.actions.server</field>
<field name="model_id" ref="account.model_account_invoice"/>
<field name="binding_model_id" ref="account.model_account_invoice"/>
<field name="state">code</field>
<field name="code">action = record.print_intrastat_invoice()</field>
<field name="binding_type">report</field>
</record>
</odoo>

View File

@ -1,2 +1,3 @@
from . import wizard_confirm_production
from . import wizard_confirm_print_invoice
from . import portal_assign_company

View File

@ -0,0 +1,18 @@
# 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 fields, models
class ConfirmPrintInvoice(models.TransientModel):
_name = 'wizard.confirm_print_invoice'
_description = 'Bestätige Rechnungsdruck'
_order = 'name'
info = fields.Text('Info', readonly=True)
def print_invoice(self):
self.ensure_one()
invoice = self.env['account.invoice'].browse(self.env.context.get('active_ids', []))
return self.env.ref('dp_reports_account.account_invoices_with_intrastat').report_action(invoice)

View File

@ -0,0 +1,32 @@
<?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_confirm_print_invoice_form_view" model="ir.ui.view">
<field name="name">wizard_confirm_print_invoice_form_view</field>
<field name="model">wizard.confirm_print_invoice</field>
<field name="arch" type="xml">
<form string="Bestätige Rechnungsdruck">
<group>
<field name="info"/>
</group>
<footer>
<button name="print_invoice" string="Rechnung trotzdem drucken" class="btn-primary" type="object"/>
<button string="Abbrechen" class="btn-default" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_wizard_confirm_print_invoice" model="ir.actions.act_window">
<field name="name">Bestätige Rechnungsdruck</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">wizard.confirm_print_invoice</field>
<field name="target">new</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
</record>
</odoo>

View File

@ -32,10 +32,6 @@ class AccountInvoiceWithIntrastat(models.AbstractModel):
def get_report_values(self, docids, data=None):
model = 'account.invoice'
docs = self.env[model].browse(docids)
for doc in docs:
for line in doc.invoice_line_ids:
if not line.intrastat_id:
raise ValidationError(_('Es muss bei allen Produkten/Lots eine Zolltarifnummer hinterlegt sein!'))
return {
'doc_ids': docids,
'doc_model': model,

View File

@ -107,7 +107,7 @@
<t t-esc="layout_category['name']"/>
-
<t t-esc="o.partner_id.ref"/>
<t t-if="layout_category['order_id']">
<t t-if="layout_category.get('order_id')">
<t t-if="layout_category['order_id'].origin">
-
<t t-esc="layout_category['order_id'].origin"/>
@ -152,7 +152,7 @@
</strong>
<br/>
</t>
<span t-if="with_intrastat">
<span t-if="with_intrastat and invoice_line.intrastat_id">
<strong>Zolltarif Nr.:</strong>
<span t-field="invoice_line.intrastat_id"/>
<br/>
@ -163,7 +163,8 @@
<span t-field="invoice_line.price_unit"/>
</td>
<td class="text-right" t-if="discount_is_set">
<span t-if="not invoice_line.hide_discount" t-field="invoice_line.discount"/>
<span t-if="not invoice_line.hide_discount"
t-field="invoice_line.discount"/>
</td>
<td class="text-right">
<span t-field="invoice_line.price_subtotal"/>
@ -273,6 +274,7 @@
attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
print_report_name="(object._get_printed_report_name())"
paperformat="dp_reports.paperformat_a4_european"
menu="False"
/>
<record id="account.account_invoices_without_payment" model="ir.actions.report">