Merge lp:~scigghia/account-invoicing/adding_account_invoice_shipping_address_7 into lp:~account-core-editors/account-invoicing/7.0

Proposed by Andrea Cometa
Status: Merged
Merged at revision: 22
Proposed branch: lp:~scigghia/account-invoicing/adding_account_invoice_shipping_address_7
Merge into: lp:~account-core-editors/account-invoicing/7.0
Diff against target: 250 lines (+209/-0)
8 files modified
account_invoice_shipping_address/AUTHORS.txt (+2/-0)
account_invoice_shipping_address/__init__.py (+24/-0)
account_invoice_shipping_address/__openerp__.py (+39/-0)
account_invoice_shipping_address/i18n/account_invoice_shipping_address.pot (+27/-0)
account_invoice_shipping_address/i18n/it.po (+27/-0)
account_invoice_shipping_address/invoice.py (+39/-0)
account_invoice_shipping_address/invoice_view.xml (+15/-0)
account_invoice_shipping_address/sale.py (+36/-0)
To merge this branch: bzr merge lp:~scigghia/account-invoicing/adding_account_invoice_shipping_address_7
Reviewer Review Type Date Requested Status
Francesco Apruzzese (community) Approve
Lorenzo Battistini (community) code review Approve
Pedro Manuel Baeza code review and test Approve
Andrea Cometa (community) Approve
Leonardo Pistone Needs Fixing
Review via email: mp+183872@code.launchpad.net

Description of the change

This Addon adds a shipping address field to the invoice, also fill it in sale invoicing

To post a comment you must log in.
Revision history for this message
Lorenzo Battistini (elbati) wrote :
review: Needs Information
Revision history for this message
Andrea Cometa (scigghia) wrote :

ok, but sale.py now use the _prepare_invoice instead of _make_invoice

21. By Andrea Cometa

account_invoice_shipping_address (C)

22. By Andrea Cometa

[add] language files

Revision history for this message
Andrea Cometa (scigghia) :
review: Approve
Revision history for this message
Lorenzo Battistini (elbati) wrote :

line 70: replace 'Andrea Cometa' with 'Andrea Cometa, Agile Business Group'
line 71: description should be ENG only. ITA translation should be done by it.po
line 74: remove init_xml
line 75: replace update_xml with data
line 78: replace demo_xml with demo
line 177 and 238: replace osv.osv with orm.Model
line 182: too long
line 185 and 249: remove
line 199: <field name="type">form</field>

Thanks!

review: Needs Fixing
23. By Andrea Cometa

[fix] as proposed by eLBati

Revision history for this message
Leonardo Pistone (lepistone) wrote :

Andrea,
I would fix refactor a bit to make flake8 pass. I think everything except the first two lines in __init__.py can be fixed (those two are actually correct).

Thanks!

Here is the output:

./__init__.py:23:1: F401 'invoice' imported but unused
./__init__.py:24:1: F401 'sale' imported but unused
./__openerp__.py:30:80: E501 line too long (102 > 79 characters)
./invoice.py:23:1: F401 'osv' imported but unused
./invoice.py:23:23: E231 missing whitespace after ','
./invoice.py:24:1: F401 '_' imported but unused
./invoice.py:26:1: E302 expected 2 blank lines, found 1
./invoice.py:26:1: F821 undefined name 'orm'
./invoice.py:27:1: W191 indentation contains tabs
./invoice.py:29:1: W191 indentation contains tabs
./invoice.py:30:1: W191 indentation contains tabs
./invoice.py:30:3: E126 continuation line over-indented for hanging indent
./invoice.py:30:76: W291 trailing whitespace
./invoice.py:31:1: W191 indentation contains tabs
./invoice.py:31:4: E128 continuation line under-indented for visual indent
./invoice.py:31:80: E501 line too long (89 > 79 characters)
./invoice.py:32:1: W191 indentation contains tabs
./invoice.py:32:4: E126 continuation line over-indented for hanging indent
./invoice.py:33:1: W191 indentation contains tabs
./sale.py:23:1: F401 'fields' imported but unused
./sale.py:23:1: F401 'osv' imported but unused
./sale.py:23:23: E231 missing whitespace after ','
./sale.py:24:1: F401 '_' imported but unused
./sale.py:26:1: E302 expected 2 blank lines, found 1
./sale.py:26:1: F821 undefined name 'orm'
./sale.py:27:1: W191 indentation contains tabs
./sale.py:28:1: E101 indentation contains mixed spaces and tabs
./sale.py:28:1: W293 blank line contains whitespace
./sale.py:29:1: W191 indentation contains tabs
./sale.py:31:1: W191 indentation contains tabs
./sale.py:31:80: E501 line too long (88 > 79 characters)
./sale.py:32:1: W191 indentation contains tabs
./sale.py:33:1: W191 indentation contains tabs
./sale.py:33:6: E126 continuation line over-indented for hanging indent
./sale.py:34:1: W191 indentation contains tabs
./sale.py:34:6: E126 continuation line over-indented for hanging indent
./sale.py:35:1: W191 indentation contains tabs

review: Needs Fixing
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Another little change. Where it puts:

from osv import fields,osv
from tools.translate import _

please change it to the new OpenERP standard for v7:

from openerp.osv import fields, orm
from openerp.tools.translate import _

Regards.

review: Needs Fixing
24. By Andrea Cometa

[fix] pep8 style

25. By Andrea Cometa

[fix] pep8 style

Revision history for this message
Andrea Cometa (scigghia) wrote :

for me its ok, i've fixed every suggestion

review: Approve
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) :
review: Approve (code review and test)
Revision history for this message
Lorenzo Battistini (elbati) :
review: Approve (code review)
Revision history for this message
Francesco Apruzzese (opencode) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'account_invoice_shipping_address'
2=== added file 'account_invoice_shipping_address/AUTHORS.txt'
3--- account_invoice_shipping_address/AUTHORS.txt 1970-01-01 00:00:00 +0000
4+++ account_invoice_shipping_address/AUTHORS.txt 2013-09-11 14:16:29 +0000
5@@ -0,0 +1,2 @@
6+Leonardo Pistone <leonardo.pistone@domsense.com>
7+Andrea Cometa <info@andreacometa.it>
8
9=== added file 'account_invoice_shipping_address/__init__.py'
10--- account_invoice_shipping_address/__init__.py 1970-01-01 00:00:00 +0000
11+++ account_invoice_shipping_address/__init__.py 2013-09-11 14:16:29 +0000
12@@ -0,0 +1,24 @@
13+# -*- encoding: utf-8 -*-
14+##############################################################################
15+#
16+# OpenERP, Open Source Management Solution
17+# Copyright (C) 2011 Domsense s.r.l. (<http://www.domsense.com>).
18+# Copyright (C) 2013 Andrea Cometa Perito Informatico (www.andreacometa.it)
19+#
20+# This program is free software: you can redistribute it and/or modify
21+# it under the terms of the GNU Affero General Public License as
22+# published by the Free Software Foundation, either version 3 of the
23+# License, or (at your option) any later version.
24+#
25+# This program is distributed in the hope that it will be useful,
26+# but WITHOUT ANY WARRANTY; without even the implied warranty of
27+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28+# GNU Affero General Public License for more details.
29+#
30+# You should have received a copy of the GNU Affero General Public License
31+# along with this program. If not, see <http://www.gnu.org/licenses/>.
32+#
33+##############################################################################
34+
35+import invoice
36+import sale
37
38=== added file 'account_invoice_shipping_address/__openerp__.py'
39--- account_invoice_shipping_address/__openerp__.py 1970-01-01 00:00:00 +0000
40+++ account_invoice_shipping_address/__openerp__.py 2013-09-11 14:16:29 +0000
41@@ -0,0 +1,39 @@
42+# -*- encoding: utf-8 -*-
43+##############################################################################
44+#
45+# OpenERP, Open Source Management Solution
46+# Copyright (C) 2011 Domsense s.r.l. (<http://www.domsense.com>).
47+# Copyright (C) 2013 Andrea Cometa Perito Informatico (www.andreacometa.it)
48+#
49+# This program is free software: you can redistribute it and/or modify
50+# it under the terms of the GNU Affero General Public License as
51+# published by the Free Software Foundation, either version 3 of the
52+# License, or (at your option) any later version.
53+#
54+# This program is distributed in the hope that it will be useful,
55+# but WITHOUT ANY WARRANTY; without even the implied warranty of
56+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
57+# GNU Affero General Public License for more details.
58+#
59+# You should have received a copy of the GNU Affero General Public License
60+# along with this program. If not, see <http://www.gnu.org/licenses/>.
61+#
62+##############################################################################
63+
64+
65+{
66+ "name": "Invoice Shipping Address",
67+ "version": "0.1",
68+ 'category': 'Generic Modules/Accounting',
69+ "depends": ["account", "sale"],
70+ "author": "Andrea Cometa, Agile Business Group",
71+ "description": """Adds a shipping address field to the invoice, also fill
72+it in sale invoicing""",
73+ 'website': 'http://www.andreacometa.it',
74+ 'data': [
75+ 'invoice_view.xml',
76+ ],
77+ 'demo': [],
78+ 'installable': True,
79+ 'active': False,
80+}
81
82=== added directory 'account_invoice_shipping_address/i18n'
83=== added file 'account_invoice_shipping_address/i18n/account_invoice_shipping_address.pot'
84--- account_invoice_shipping_address/i18n/account_invoice_shipping_address.pot 1970-01-01 00:00:00 +0000
85+++ account_invoice_shipping_address/i18n/account_invoice_shipping_address.pot 2013-09-11 14:16:29 +0000
86@@ -0,0 +1,27 @@
87+# Translation of OpenERP Server.
88+# This file contains the translation of the following modules:
89+# * account_invoice_shipping_address
90+#
91+msgid ""
92+msgstr ""
93+"Project-Id-Version: OpenERP Server 7.0\n"
94+"Report-Msgid-Bugs-To: \n"
95+"POT-Creation-Date: 2013-09-04 14:39+0000\n"
96+"PO-Revision-Date: 2013-09-04 14:39+0000\n"
97+"Last-Translator: <>\n"
98+"Language-Team: \n"
99+"MIME-Version: 1.0\n"
100+"Content-Type: text/plain; charset=UTF-8\n"
101+"Content-Transfer-Encoding: \n"
102+"Plural-Forms: \n"
103+
104+#. module: account_invoice_shipping_address
105+#: field:account.invoice,address_shipping_id:0
106+msgid "Shipping Address"
107+msgstr ""
108+
109+#. module: account_invoice_shipping_address
110+#: help:account.invoice,address_shipping_id:0
111+msgid "Delivery address for current invoice."
112+msgstr ""
113+
114
115=== added file 'account_invoice_shipping_address/i18n/it.po'
116--- account_invoice_shipping_address/i18n/it.po 1970-01-01 00:00:00 +0000
117+++ account_invoice_shipping_address/i18n/it.po 2013-09-11 14:16:29 +0000
118@@ -0,0 +1,27 @@
119+# Translation of OpenERP Server.
120+# This file contains the translation of the following modules:
121+# * account_invoice_shipping_address
122+#
123+msgid ""
124+msgstr ""
125+"Project-Id-Version: OpenERP Server 7.0\n"
126+"Report-Msgid-Bugs-To: \n"
127+"POT-Creation-Date: 2013-09-04 14:39+0000\n"
128+"PO-Revision-Date: 2013-09-04 14:39+0000\n"
129+"Last-Translator: <>\n"
130+"Language-Team: \n"
131+"MIME-Version: 1.0\n"
132+"Content-Type: text/plain; charset=UTF-8\n"
133+"Content-Transfer-Encoding: \n"
134+"Plural-Forms: \n"
135+
136+#. module: account_invoice_shipping_address
137+#: field:account.invoice,address_shipping_id:0
138+msgid "Shipping Address"
139+msgstr "Indirizzo di consegna"
140+
141+#. module: account_invoice_shipping_address
142+#: help:account.invoice,address_shipping_id:0
143+msgid "Delivery address for current invoice."
144+msgstr "Indirizzo di consegna per la presente fattura"
145+
146
147=== added file 'account_invoice_shipping_address/invoice.py'
148--- account_invoice_shipping_address/invoice.py 1970-01-01 00:00:00 +0000
149+++ account_invoice_shipping_address/invoice.py 2013-09-11 14:16:29 +0000
150@@ -0,0 +1,39 @@
151+# -*- encoding: utf-8 -*-
152+##############################################################################
153+#
154+# OpenERP, Open Source Management Solution
155+# Copyright (C) 2011 Domsense s.r.l. (<http://www.domsense.com>).
156+# Copyright (C) 2013 Andrea Cometa Perito Informatico (www.andreacometa.it)
157+#
158+# This program is free software: you can redistribute it and/or modify
159+# it under the terms of the GNU Affero General Public License as
160+# published by the Free Software Foundation, either version 3 of the
161+# License, or (at your option) any later version.
162+#
163+# This program is distributed in the hope that it will be useful,
164+# but WITHOUT ANY WARRANTY; without even the implied warranty of
165+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
166+# GNU Affero General Public License for more details.
167+#
168+# You should have received a copy of the GNU Affero General Public License
169+# along with this program. If not, see <http://www.gnu.org/licenses/>.
170+#
171+##############################################################################
172+
173+from openerp.osv import fields, orm
174+
175+
176+class account_invoice(orm.Model):
177+ _inherit = "account.invoice"
178+
179+ _columns = {
180+ 'address_shipping_id': fields.many2one(
181+ 'res.partner',
182+ 'Shipping Address',
183+ readonly=True,
184+ states={
185+ 'draft': [('readonly', False)],
186+ 'sent': [('readonly', False)]
187+ },
188+ help="Delivery address for current invoice."),
189+ }
190
191=== added file 'account_invoice_shipping_address/invoice_view.xml'
192--- account_invoice_shipping_address/invoice_view.xml 1970-01-01 00:00:00 +0000
193+++ account_invoice_shipping_address/invoice_view.xml 2013-09-11 14:16:29 +0000
194@@ -0,0 +1,15 @@
195+<?xml version="1.0" encoding="UTF-8"?>
196+<openerp>
197+ <data>
198+ <record model="ir.ui.view" id="invoice_form_shipping_address">
199+ <field name="name">account.invoice.form.shipping.address</field>
200+ <field name="model">account.invoice</field>
201+ <field name="inherit_id" ref="account.invoice_form"/>
202+ <field name="arch" type="xml">
203+ <field name="fiscal_position" position="before">
204+ <field name="address_shipping_id" />
205+ </field>
206+ </field>
207+ </record>
208+ </data>
209+</openerp>
210
211=== added file 'account_invoice_shipping_address/sale.py'
212--- account_invoice_shipping_address/sale.py 1970-01-01 00:00:00 +0000
213+++ account_invoice_shipping_address/sale.py 2013-09-11 14:16:29 +0000
214@@ -0,0 +1,36 @@
215+# -*- encoding: utf-8 -*-
216+##############################################################################
217+#
218+# OpenERP, Open Source Management Solution
219+# Copyright (C) 2011 Domsense s.r.l. (<http://www.domsense.com>).
220+# Copyright (C) 2013 Andrea Cometa Perito Informatico (www.andreacometa.it)
221+#
222+# This program is free software: you can redistribute it and/or modify
223+# it under the terms of the GNU Affero General Public License as
224+# published by the Free Software Foundation, either version 3 of the
225+# License, or (at your option) any later version.
226+#
227+# This program is distributed in the hope that it will be useful,
228+# but WITHOUT ANY WARRANTY; without even the implied warranty of
229+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
230+# GNU Affero General Public License for more details.
231+#
232+# You should have received a copy of the GNU Affero General Public License
233+# along with this program. If not, see <http://www.gnu.org/licenses/>.
234+#
235+##############################################################################
236+
237+from openerp.osv import orm
238+
239+
240+class sale_order(orm.Model):
241+ _inherit = 'sale.order'
242+
243+ def _prepare_invoice(self, cr, uid, order, lines, context=None):
244+
245+ res = super(sale_order, self)._prepare_invoice(
246+ cr, uid, order, lines, context=context
247+ )
248+ res.update({
249+ 'address_shipping_id': order.partner_shipping_id.id, })
250+ return res

Subscribers

People subscribed via source and target branches