Lorenzo Battistini - Agile BG has proposed merging lp:~agilebg/openobject-italia/adding_l10n_it_bill_of_entry into lp:openobject-italia/7.0.
Requested reviews: OpenERP Italia core devs (openobject-italia-core-devs) For more details, see: https://code.launchpad.net/~agilebg/openobject-italia/adding_l10n_it_bill_of_entry/+merge/193422 -- https://code.launchpad.net/~agilebg/openobject-italia/adding_l10n_it_bill_of_entry/+merge/193422 Your team OpenERP Italia core devs is requested to review the proposed merge of lp:~agilebg/openobject-italia/adding_l10n_it_bill_of_entry into lp:openobject-italia/7.0.
=== added directory 'l10n_it_bill_of_entry' === added file 'l10n_it_bill_of_entry/AUTHORS.txt' --- l10n_it_bill_of_entry/AUTHORS.txt 1970-01-01 00:00:00 +0000 +++ l10n_it_bill_of_entry/AUTHORS.txt 2013-10-31 14:05:17 +0000 @@ -0,0 +1,3 @@ +Alex Comba <[email protected]> +Lorenzo Battistini <[email protected]> + === added file 'l10n_it_bill_of_entry/__init__.py' --- l10n_it_bill_of_entry/__init__.py 1970-01-01 00:00:00 +0000 +++ l10n_it_bill_of_entry/__init__.py 2013-10-31 14:05:17 +0000 @@ -0,0 +1,26 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Agile Business Group sagl +# (<http://www.agilebg.com>) +# Copyright (C) 2013 +# Associazione OpenERP Italia (<http://www.openerp-italia.org>) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + +import account_invoice +import wizard +import company === added file 'l10n_it_bill_of_entry/__openerp__.py' --- l10n_it_bill_of_entry/__openerp__.py 1970-01-01 00:00:00 +0000 +++ l10n_it_bill_of_entry/__openerp__.py 2013-10-31 14:05:17 +0000 @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>) +# Copyright (C) 2013 +# Associazione OpenERP Italia (<http://www.openerp-italia.org>) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## +{ + 'name': 'Italian Localisation - Bill of Entry', + 'version': '0.1', + 'category': 'Localisation/Italy', + 'description': """ +Bolle doganali +=============== + +Specifiche +---------- + +http://wiki.openerp-italia.org/doku.php/area_utente/requisiti/extraue + +Ci sono 3 documenti coinvolti: + + - Fattura fornitore + - Fattura spedizioniere + - Bolla doganale + +Le relazioni: + +N bolle doganali -> N fatture fornitore +1 fattura spedizioniere -> N bolle doganali + +Configurazione +-------------- + +E' necessario configurare in contabilità il sezionale da utilizzare per il +giroconto di chiusura. + +Utilizzo +-------- + +Dalla bolla doganale è possibile collegare manualmente la (o le) fattura(e) +fornitore corrispondente. + +Dalla fattura spedizioniere è possibile generare la (o le) bolla(e) doganale(i) +tramite il bottone 'genera bolla'. Per questa operazione bisogna prima configurare +un template di fattura (usato per la bolla doganale). + +Nella fattura spedizioniere bisogna indicare quale (o quali) riga (righe) +rappresenti(no) l'IVA anticipata alla dogana. + +Alla conferma della fattura spedizioniere, verrà generata la scrittura contabile di giroconto per chiudere la bolla doganale. + +""", + 'author': 'Agile Business Group', + 'website': 'http://www.agilebg.com', + 'license': 'AGPL-3', + "depends": ['base', 'account_invoice_template'], + "data": [ + 'account_invoice_view.xml', + 'company_view.xml', + ], + "demo": [], + "installable": True +} === added file 'l10n_it_bill_of_entry/account_invoice.py' --- l10n_it_bill_of_entry/account_invoice.py 1970-01-01 00:00:00 +0000 +++ l10n_it_bill_of_entry/account_invoice.py 2013-10-31 14:05:17 +0000 @@ -0,0 +1,139 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>) +# Copyright (C) 2013 +# Associazione OpenERP Italia (<http://www.openerp-italia.org>) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + +from openerp.osv import fields, orm +from openerp.tools.translate import _ + + +class account_invoice(orm.Model): + _inherit = "account.invoice" + + _columns = { + 'customs_doc_type': fields.selection([ + ('bill_of_entry', 'Bill of Entry'), + ('supplier_invoice', 'Supplier Invoice'), + ('forwarder_invoice', 'Forwarder Invoice'), + ], 'Customs Doc Type', readonly=True), + 'supplier_bill_of_entry_ids': fields.many2many('account.invoice', 'sboe_invoice_rel', 'sboe_id', 'invoice_id', 'Supplier Bill of Entries', readonly=True), + 'supplier_invoice_ids': fields.many2many('account.invoice', 'sboe_invoice_rel', 'invoice_id', 'sboe_id', 'Supplier Invoices'), + 'forwarder_invoice_id': fields.many2one('account.invoice', 'Forwarder Invoice'), + 'forwarder_bill_of_entry_ids': fields.one2many('account.invoice', 'forwarder_invoice_id', 'Forward Bill of Entries', readonly=True), + 'bill_of_entry_storno_id': fields.many2one('account.move', 'Bill of Entry Storno', readonly=True), + } + + def action_move_create(self, cr, uid, ids, context=None): + res = super(account_invoice,self).action_move_create(cr, uid, ids, context=context) + move_obj = self.pool.get('account.move') + move_line_obj = self.pool.get('account.move.line') + period_obj = self.pool.get('account.period') + for invoice in self.browse(cr, uid, ids, context): + if invoice.customs_doc_type == 'forwarder_invoice': + for bill_of_entry in invoice.forwarder_bill_of_entry_ids: + if bill_of_entry.state not in ('open', 'paid'): + raise orm.except_orm(_('Error'), _('Bill of entry %s is in state %s') + % (bill_of_entry.partner_id.name, bill_of_entry.state)) + advance_customs_vat_line = False + if invoice.forwarder_bill_of_entry_ids: + for line in invoice.invoice_line: + if line.advance_customs_vat: + advance_customs_vat_line = True + break + if not advance_customs_vat_line: + raise orm.except_orm(_('Error'), + _("Forwarder invoice %s does not have lines with 'Adavance Customs Vat'") + % invoice.number) + if not invoice.company_id.bill_of_entry_journal_id: + raise orm.except_orm(_('Error'), _('No Bill of entry Storno journal configured')) + period_ids = period_obj.find(cr, uid, dt=invoice.date_invoice, context=context) + move_vals = { + 'period_id': period_ids and period_ids[0] or False, + 'journal_id': invoice.company_id.bill_of_entry_journal_id.id, + 'date': invoice.date_invoice, + } + move_lines = [] + for inv_line in invoice.invoice_line: + if inv_line.advance_customs_vat: + move_lines.append((0, 0, { + 'name': _("Customs expenses"), + 'account_id': inv_line.account_id.id, + 'debit': 0.0, + 'credit': inv_line.price_subtotal, + })) + for bill_of_entry in invoice.forwarder_bill_of_entry_ids: + move_lines.append((0, 0, { + 'name': _("Customs supplier"), + 'account_id': bill_of_entry.account_id.id, + 'debit': bill_of_entry.amount_total, + 'credit': 0.0, + 'partner_id': bill_of_entry.partner_id.id, + })) + for boe_line in bill_of_entry.invoice_line: + tax_code_id = False + if boe_line.invoice_line_tax_id: + if len(boe_line.invoice_line_tax_id) > 1: + raise osv.except_osv(_('Error'), + _("Can't handle more than 1 tax for line %s") % boe_line.name) + tax_code_id = (boe_line.invoice_line_tax_id[0].base_code_id + and boe_line.invoice_line_tax_id[0].base_code_id.id or False) + line_vals = { + 'name': _("Extra CEE expenses"), + 'account_id': boe_line.account_id.id, + 'debit': 0.0, + 'credit': boe_line.price_subtotal, + } + if tax_code_id: + line_vals['tax_code_id'] = tax_code_id + line_vals['tax_amount'] = boe_line.price_subtotal + move_lines.append((0, 0, line_vals)) + move_vals['line_id'] = move_lines + move_id = move_obj.create(cr, uid, move_vals, context=context) + invoice.write({'bill_of_entry_storno_id': move_id}, context=context) + + reconcile_ids = [] + for move_line in move_obj.browse(cr, uid, move_id, context).line_id: + for bill_of_entry in invoice.forwarder_bill_of_entry_ids: + if move_line.account_id.id == bill_of_entry.account_id.id: + reconcile_ids.append(move_line.id) + for boe_move_line in bill_of_entry.move_id.line_id: + if boe_move_line.account_id.id == bill_of_entry.account_id.id: + reconcile_ids.append(boe_move_line.id) + move_line_obj.reconcile_partial(cr, uid, reconcile_ids, type='auto', + context=context) + return res + + def action_cancel(self, cr, uid, ids, context=None): + account_move_obj = self.pool.get('account.move') + res = super(account_invoice,self).action_cancel(cr, uid, ids, context=context) + for invoice in self.browse(cr, uid, ids, context): + if invoice.bill_of_entry_storno_id: + account_move_obj.button_cancel(cr, uid, [invoice.bill_of_entry_storno_id.id], + context=context) + account_move_obj.unlink(cr, uid, [invoice.bill_of_entry_storno_id.id], + context=context) + return res + +class account_invoice_line(orm.Model): + _inherit = "account.invoice.line" + + _columns = { + 'advance_customs_vat': fields.boolean("Advance Customs Vat"), + } === added file 'l10n_it_bill_of_entry/account_invoice_view.xml' --- l10n_it_bill_of_entry/account_invoice_view.xml 1970-01-01 00:00:00 +0000 +++ l10n_it_bill_of_entry/account_invoice_view.xml 2013-10-31 14:05:17 +0000 @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + + <record model="ir.ui.view" id="invoice_supplier_form"> + <field name="name">account.invoice.supplier.form</field> + <field name="model">account.invoice</field> + <field name="inherit_id" ref="account.invoice_supplier_form"/> + <field name="arch" type="xml"> + <xpath expr="//field[@name='journal_id']" position="after"> + <field name="customs_doc_type" attrs="{'readonly': ['|',('state', '!=', 'draft'), ('forwarder_bill_of_entry_ids', '!=', [])]}"/> + </xpath> + <xpath expr="//notebook/page[@string='Payments']" position="after"> + <page string="Customs" attrs="{'invisible': [('customs_doc_type','=', False)]}"> + <separator string="Bill of entries" colspan="4" attrs="{'invisible': [('customs_doc_type','!=', 'supplier_invoice')]}"></separator> + <field name="supplier_bill_of_entry_ids" attrs="{'invisible': [('customs_doc_type','!=', 'supplier_invoice')]}" /> + <separator string="Supplier invoices" colspan="4" attrs="{'invisible': [('customs_doc_type','!=', 'bill_of_entry')]}"></separator> + <field name="supplier_invoice_ids" attrs="{'invisible': [('customs_doc_type','!=', 'bill_of_entry')]}" domain="[('customs_doc_type', '=', 'supplier_invoice')]" context="{'default_customs_doc_type': 'supplier_invoice'}"/> + <group> + <field name="forwarder_invoice_id" attrs="{'invisible': [('customs_doc_type','!=', 'bill_of_entry')]}" domain="[('customs_doc_type','=', 'forwarder_invoice')]" context="{'default_customs_doc_type': 'forwarder_invoice'}"/> + </group> + <separator string="Bill of entries" colspan="4" attrs="{'invisible': [('customs_doc_type','!=', 'forwarder_invoice')]}"></separator> + <field name="forwarder_bill_of_entry_ids" attrs="{'invisible': [('customs_doc_type','!=', 'forwarder_invoice')]}"/> + <group> + <field name="bill_of_entry_storno_id" attrs="{'invisible': [('customs_doc_type','!=', 'forwarder_invoice')]}"/> + </group> + <button string="Make Bill of Entry" name="%(account_invoice_template.action_wizard_select_template)d" type="action" class="oe_highlight" attrs="{'invisible': ['|',('customs_doc_type','!=', 'forwarder_invoice'),('state','!=','draft')]}"/> + </page> + </xpath> + <xpath expr="//notebook/page[@string='Invoice']/field[@name='invoice_line']/tree/field[@name='price_subtotal']" position="after"> + <!--It seems attrs doesn't work --> + <field name="advance_customs_vat"/> + </xpath> + </field> + </record> + <record model="ir.ui.view" id="invoice_form_boe"> + <field name="name">account.invoice.form.boe</field> + <field name="model">account.invoice.line</field> + <field name="inherit_id" ref="account.view_invoice_line_form"/> + <field name="arch" type="xml"> + <field name="name" position="after"> + <group> + <field name="advance_customs_vat"/> + </group> + </field> + </field> + </record> + + </data> +</openerp> === added file 'l10n_it_bill_of_entry/company.py' --- l10n_it_bill_of_entry/company.py 1970-01-01 00:00:00 +0000 +++ l10n_it_bill_of_entry/company.py 2013-10-31 14:05:17 +0000 @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>) +# Copyright (C) 2013 +# Associazione OpenERP Italia (<http://www.openerp-italia.org>) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + +from openerp.osv import fields, orm + +class res_company(orm.Model): + _inherit = 'res.company' + _columns = { + 'bill_of_entry_journal_id': fields.many2one('account.journal','Bill of entry Storno journal', + help="Journal used for reconciliation of customs supplier"), + } + +class account_config_settings(orm.TransientModel): + _inherit = 'account.config.settings' + _columns = { + 'bill_of_entry_journal_id': fields.related( + 'company_id', 'bill_of_entry_journal_id', + type='many2one', + relation="account.journal", + string="Bill of entry Storno journal", + help='Journal used for reconciliation of customs supplier'), + } === added file 'l10n_it_bill_of_entry/company_view.xml' --- l10n_it_bill_of_entry/company_view.xml 1970-01-01 00:00:00 +0000 +++ l10n_it_bill_of_entry/company_view.xml 2013-10-31 14:05:17 +0000 @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + + <record id="view_account_config_settings" model="ir.ui.view"> + <field name="name">view_account_config_settings</field> + <field name="model">account.config.settings</field> + <field name="inherit_id" ref="account.view_account_config_settings"/> + <field name="arch" type="xml"> + <xpath expr="/form/group[6]" position="after"> + <separator string="Bill of entry"/> + <group name="Bill of entry"> + <label for="id" string="Configuration"/> + <div> + <div> + <label for="bill_of_entry_journal_id"/> + <field name="bill_of_entry_journal_id" class="oe_inline"/> + </div> + </div> + </group> + </xpath> + </field> + </record> + </data> +</openerp> === added directory 'l10n_it_bill_of_entry/i18n' === added file 'l10n_it_bill_of_entry/i18n/it.po' --- l10n_it_bill_of_entry/i18n/it.po 1970-01-01 00:00:00 +0000 +++ l10n_it_bill_of_entry/i18n/it.po 2013-10-31 14:05:17 +0000 @@ -0,0 +1,181 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * l10n_it_bill_of_entry +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-07-18 18:13+0000\n" +"PO-Revision-Date: 2013-07-18 20:17+0100\n" +"Last-Translator: Lorenzo Battistini <[email protected]>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +"X-Generator: Poedit 1.5.4\n" + +#. module: l10n_it_bill_of_entry +#: view:account.invoice:0 +msgid "Supplier invoices" +msgstr "Fatture fornitore" + +#. module: l10n_it_bill_of_entry +#: field:account.invoice,customs_doc_type:0 +msgid "Customs Doc Type" +msgstr "Tipo documento doganale" + +#. module: l10n_it_bill_of_entry +#: model:ir.model,name:l10n_it_bill_of_entry.model_account_config_settings +msgid "account.config.settings" +msgstr "account.config.settings" + +#. module: l10n_it_bill_of_entry +#: selection:account.invoice,customs_doc_type:0 +msgid "Supplier Invoice" +msgstr "Fattura fornitore" + +#. module: l10n_it_bill_of_entry +#: code:addons/l10n_it_bill_of_entry/account_invoice.py:62 +#, python-format +msgid "Forwarder invoice %s does not have lines with 'Adavance Customs Vat'" +msgstr "La fattura fornitore %s non ha riga con 'IVA anticipata'" + +#. module: l10n_it_bill_of_entry +#: field:account.invoice,bill_of_entry_storno_id:0 +msgid "Bill of Entry Storno" +msgstr "Storno bolla doganale" + +#. module: l10n_it_bill_of_entry +#: selection:account.invoice,customs_doc_type:0 +msgid "Bill of Entry" +msgstr "Bolla doganale" + +#. module: l10n_it_bill_of_entry +#: field:account.invoice,supplier_invoice_ids:0 +msgid "Supplier Invoices" +msgstr "Fatture fornitore" + +#. module: l10n_it_bill_of_entry +#: view:account.invoice:0 +msgid "Make Bill of Entry" +msgstr "Genera bolla doganale" + +#. module: l10n_it_bill_of_entry +#: field:account.invoice,supplier_bill_of_entry_ids:0 +msgid "Supplier Bill of Entries" +msgstr "Bolle doganali fornitore" + +#. module: l10n_it_bill_of_entry +#: view:account.invoice:0 +msgid "Customs" +msgstr "Dogana" + +#. module: l10n_it_bill_of_entry +#: code:addons/l10n_it_bill_of_entry/account_invoice.py:98 +#, python-format +msgid "Extra CEE expenses" +msgstr "Uscite extra CEE" + +#. module: l10n_it_bill_of_entry +#: view:account.invoice:0 +msgid "Bill of entries" +msgstr "Bolle doganali" + +#. module: l10n_it_bill_of_entry +#: view:account.config.settings:0 +msgid "Configuration" +msgstr "Configurazione" + +#. module: l10n_it_bill_of_entry +#: view:account.config.settings:0 +msgid "Bill of entry" +msgstr "Bolla doganale" + +#. module: l10n_it_bill_of_entry +#: field:account.config.settings,bill_of_entry_journal_id:0 +#: field:res.company,bill_of_entry_journal_id:0 +msgid "Bill of entry Storno journal" +msgstr "Sezionale di storno bolla doganale" + +#. module: l10n_it_bill_of_entry +#: model:ir.model,name:l10n_it_bill_of_entry.model_res_company +msgid "Companies" +msgstr "Aziende" + +#. module: l10n_it_bill_of_entry +#: help:account.config.settings,bill_of_entry_journal_id:0 +#: help:res.company,bill_of_entry_journal_id:0 +msgid "Journal used for reconciliation of customs supplier" +msgstr "Sezionale usato per la riconciliazione del fotnirore dogana" + +#. module: l10n_it_bill_of_entry +#: field:account.invoice,forwarder_bill_of_entry_ids:0 +msgid "Forward Bill of Entries" +msgstr "Bolla doganale spedizioniere" + +#. module: l10n_it_bill_of_entry +#: code:addons/l10n_it_bill_of_entry/account_invoice.py:52 +#: code:addons/l10n_it_bill_of_entry/account_invoice.py:61 +#: code:addons/l10n_it_bill_of_entry/account_invoice.py:65 +#: code:addons/l10n_it_bill_of_entry/account_invoice.py:93 +#, python-format +msgid "Error" +msgstr "Errore" + +#. module: l10n_it_bill_of_entry +#: code:addons/l10n_it_bill_of_entry/account_invoice.py:83 +#, python-format +msgid "Customs supplier" +msgstr "Fornitore dogana" + +#. module: l10n_it_bill_of_entry +#: selection:account.invoice,customs_doc_type:0 +#: field:account.invoice,forwarder_invoice_id:0 +msgid "Forwarder Invoice" +msgstr "Fatture spedizioniere" + +#. module: l10n_it_bill_of_entry +#: code:addons/l10n_it_bill_of_entry/account_invoice.py:52 +#, python-format +msgid "Bill of entry %s is in state %s" +msgstr "La bolla doganale %s è in stato %s" + +#. module: l10n_it_bill_of_entry +#: model:ir.model,name:l10n_it_bill_of_entry.model_account_invoice_line +msgid "Invoice Line" +msgstr "Righe Fattura" + +#. module: l10n_it_bill_of_entry +#: code:addons/l10n_it_bill_of_entry/account_invoice.py:76 +#, python-format +msgid "Customs expenses" +msgstr "Spese doganali" + +#. module: l10n_it_bill_of_entry +#: model:ir.model,name:l10n_it_bill_of_entry.model_wizard_select_invoice_template +msgid "wizard.select.invoice.template" +msgstr "wizard.select.invoice.template" + +#. module: l10n_it_bill_of_entry +#: code:addons/l10n_it_bill_of_entry/account_invoice.py:94 +#, python-format +msgid "Can't handle more than 1 tax for line %s" +msgstr "Impossibile gestire più di un'imposta per la riga %s" + +#. module: l10n_it_bill_of_entry +#: model:ir.model,name:l10n_it_bill_of_entry.model_account_invoice +msgid "Invoice" +msgstr "Fattura" + +#. module: l10n_it_bill_of_entry +#: field:account.invoice.line,advance_customs_vat:0 +msgid "Advance Customs Vat" +msgstr "IVA doganale anticipata" + +#. module: l10n_it_bill_of_entry +#: code:addons/l10n_it_bill_of_entry/account_invoice.py:65 +#, python-format +msgid "No Bill of entry Storno journal configured" +msgstr "Nessun sezionale di storno bolla doganale configurato" === added directory 'l10n_it_bill_of_entry/security' === added directory 'l10n_it_bill_of_entry/wizard' === added file 'l10n_it_bill_of_entry/wizard/__init__.py' --- l10n_it_bill_of_entry/wizard/__init__.py 1970-01-01 00:00:00 +0000 +++ l10n_it_bill_of_entry/wizard/__init__.py 2013-10-31 14:05:17 +0000 @@ -0,0 +1,24 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Agile Business Group sagl +# (<http://www.agilebg.com>) +# Copyright (C) 2013 +# Associazione OpenERP Italia (<http://www.openerp-italia.org>) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + +import select_template === added file 'l10n_it_bill_of_entry/wizard/select_template.py' --- l10n_it_bill_of_entry/wizard/select_template.py 1970-01-01 00:00:00 +0000 +++ l10n_it_bill_of_entry/wizard/select_template.py 2013-10-31 14:05:17 +0000 @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>) +# Copyright (C) 2013 +# Associazione OpenERP Italia (<http://www.openerp-italia.org>) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +############################################################################## + +from openerp.osv import fields, osv, orm +from openerp.tools.translate import _ + + +class wizard_select_invoice_template(orm.TransientModel): + _inherit = "wizard.select.invoice.template" + + def load_template(self, cr, uid, ids, context=None): + res = super(wizard_select_invoice_template, self).load_template(cr, uid, ids, context=context) + if context.get('active_model') == 'account.invoice': + invoice = self.pool.get('account.invoice').browse(cr, uid, + context.get('active_id'), context=context) + if invoice and invoice.customs_doc_type == 'forwarder_invoice': + invoice_id = res['res_id'] + invoice_obj = self.pool.get('account.invoice') + invoice_obj.write(cr, uid, invoice_id, { + 'customs_doc_type': 'bill_of_entry', + 'forwarder_invoice_id': context.get('active_id') + }, context=context) + return res
_______________________________________________ Mailing list: https://launchpad.net/~openobject-italia-core-devs Post to : [email protected] Unsubscribe : https://launchpad.net/~openobject-italia-core-devs More help : https://help.launchpad.net/ListHelp

