diff --git a/ext/custom-addons/dp_custom/models/account.py b/ext/custom-addons/dp_custom/models/account.py index e07385a7..5c5f09cb 100644 --- a/ext/custom-addons/dp_custom/models/account.py +++ b/ext/custom-addons/dp_custom/models/account.py @@ -150,6 +150,11 @@ class AccountInvoice(models.Model): res = '%s %s' % (currency_obj.symbol, res) return res + @api.multi + def print_invoice_short(self): + self.ensure_one() + return self.env.ref('dp_reports_account.account_invoices_short').report_action(self) + @api.multi def print_intrastat_invoice(self): self.ensure_one() @@ -170,3 +175,24 @@ class AccountInvoice(models.Model): action['context'] = str({"default_info": info, "invoice_ids": self.env.context.get("active_ids")}) return action return self.env.ref('dp_reports_account.account_invoices_with_intrastat').report_action(self) + + @api.multi + def print_intrastat_invoice_short(self): + self.ensure_one() + info = "Bei folgenden Produkten fehlt die Zolltarifnummer:\n" + intrastrat_not_set = False + position = 1 + 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 and not invoice_line.hide_intrastat_code: + info += "Zeile: "+str(position) + if invoice_line.product_id.default_code: + info += "\tProduktcode: " + invoice_line.product_id.default_code + info += "\n" + intrastrat_not_set = True + position += 1 + if intrastrat_not_set: + action = self.env.ref('dp_custom.action_wizard_confirm_print_invoice_short').read()[0] + action['context'] = str({"default_info": info, "invoice_ids": self.env.context.get("active_ids")}) + return action + return self.env.ref('dp_reports_account.account_invoices_with_intrastat_short').report_action(self) diff --git a/ext/custom-addons/dp_custom/views/dp_custom_views.xml b/ext/custom-addons/dp_custom/views/dp_custom_views.xml index 29262140..e23b3527 100644 --- a/ext/custom-addons/dp_custom/views/dp_custom_views.xml +++ b/ext/custom-addons/dp_custom/views/dp_custom_views.xml @@ -1,6 +1,16 @@ + + Rechnung Kurztext + ir.actions.server + + + code + action = record.print_invoice_short() + report + + Rechnung mit Zolltarifnummer ir.actions.server @@ -11,4 +21,14 @@ report + + Rechnung mit Zolltarifnummer Kurztext + ir.actions.server + + + code + action = record.print_intrastat_invoice_short() + report + + diff --git a/ext/custom-addons/dp_custom/wizards/wizard_confirm_print_invoice.py b/ext/custom-addons/dp_custom/wizards/wizard_confirm_print_invoice.py index 8b510766..93fcdf14 100644 --- a/ext/custom-addons/dp_custom/wizards/wizard_confirm_print_invoice.py +++ b/ext/custom-addons/dp_custom/wizards/wizard_confirm_print_invoice.py @@ -18,3 +18,18 @@ class ConfirmPrintInvoice(models.TransientModel): return {'type': 'ir.actions.act_window_close'} return self.env.ref('dp_reports_account.account_invoices_with_intrastat').report_action(invoice) + +class ConfirmPrintInvoiceShort(models.TransientModel): + _name = 'wizard.confirm_print_invoice_short' + _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('invoice_ids', [])) + if not invoice: + return {'type': 'ir.actions.act_window_close'} + + return self.env.ref('dp_reports_account.account_invoices_with_intrastat_short').report_action(invoice) diff --git a/ext/custom-addons/dp_custom/wizards/wizard_confirm_print_invoice.xml b/ext/custom-addons/dp_custom/wizards/wizard_confirm_print_invoice.xml index e577860c..b2f4c607 100644 --- a/ext/custom-addons/dp_custom/wizards/wizard_confirm_print_invoice.xml +++ b/ext/custom-addons/dp_custom/wizards/wizard_confirm_print_invoice.xml @@ -29,4 +29,29 @@ form + + wizard_confirm_print_invoice_form_view_short + wizard.confirm_print_invoice_short + +
+ + + + +
+
+
+ + + Bestätige Rechnungsdruck + ir.actions.act_window + wizard.confirm_print_invoice_short + new + form + form + + diff --git a/ext/custom-addons/dp_reports_account/models/report_helper.py b/ext/custom-addons/dp_reports_account/models/report_helper.py index 9560838a..9f8bd42f 100644 --- a/ext/custom-addons/dp_reports_account/models/report_helper.py +++ b/ext/custom-addons/dp_reports_account/models/report_helper.py @@ -49,6 +49,24 @@ class AccountInvoice(models.AbstractModel): } +class AccountInvoiceShort(models.AbstractModel): + _name = 'report.dp_reports_account.report_invoice_short' + _inherit = 'report.account_abstract_report' + _template = 'dp_reports_account.report_invoice_short' + + @api.model + def get_report_values(self, docids, data=None): + model = 'account.invoice' + docs = self.env[model].browse(docids) + return { + 'doc_ids': docids, + 'doc_model': model, + 'docs': docs, + 'data': data, + 'field_set_in_lines': self._field_set_in_lines, + 'formatLang': self._formatLang, + } + class AccountInvoiceWithIntrastat(models.AbstractModel): _name = 'report.dp_reports_account.report_invoice_with_intrastat' _inherit = 'report.account_abstract_report' @@ -66,3 +84,21 @@ class AccountInvoiceWithIntrastat(models.AbstractModel): 'field_set_in_lines': self._field_set_in_lines, 'formatLang': self._formatLang, } + +class AccountInvoiceWithIntrastatShort(models.AbstractModel): + _name = 'report.dp_reports_account.report_invoice_with_intrastat_short' + _inherit = 'report.account_abstract_report' + _template = 'dp_reports_account.report_invoice_with_intrastat_short' + + @api.model + def get_report_values(self, docids, data=None): + model = 'account.invoice' + docs = self.env[model].browse(docids) + return { + 'doc_ids': docids, + 'doc_model': model, + 'docs': docs, + 'data': data, + 'field_set_in_lines': self._field_set_in_lines, + 'formatLang': self._formatLang, + } diff --git a/ext/custom-addons/dp_reports_account/reports/invoice.xml b/ext/custom-addons/dp_reports_account/reports/invoice.xml index e5afa6fa..1a18e528 100644 --- a/ext/custom-addons/dp_reports_account/reports/invoice.xml +++ b/ext/custom-addons/dp_reports_account/reports/invoice.xml @@ -200,7 +200,14 @@
- + + Kurztext: + + + + + +
Serien Nr.: @@ -325,6 +332,26 @@ + + + + @@ -335,6 +362,19 @@ + + + + Rechnung ohne Zolltarifnummer