Merge lp:~camptocamp/banking-addons/7.0-bank-statement-reconcile-account_invoice_reference into lp:banking-addons/bank-statement-reconcile-70

Proposed by Guewen Baconnier @ Camptocamp
Status: Superseded
Proposed branch: lp:~camptocamp/banking-addons/7.0-bank-statement-reconcile-account_invoice_reference
Merge into: lp:banking-addons/bank-statement-reconcile-70
Diff against target: 743 lines (+671/-0)
14 files modified
account_invoice_reference/__init__.py (+22/-0)
account_invoice_reference/__openerp__.py (+146/-0)
account_invoice_reference/account_invoice_view.xml (+49/-0)
account_invoice_reference/account_move.py (+100/-0)
account_invoice_reference/i18n/account_invoice_reference.pot (+42/-0)
account_invoice_reference/i18n/fr.po (+42/-0)
account_invoice_reference/test/in_invoice_with_supplier_number.yml (+40/-0)
account_invoice_reference/test/in_invoice_without_supplier_number.yml (+39/-0)
account_invoice_reference/test/in_refund_with_supplier_number.yml (+40/-0)
account_invoice_reference/test/in_refund_without_supplier_number.yml (+39/-0)
account_invoice_reference/test/out_invoice_with_origin.yml (+23/-0)
account_invoice_reference/test/out_invoice_without_origin.yml (+22/-0)
account_invoice_reference/test/out_refund_with_origin.yml (+34/-0)
account_invoice_reference/test/out_refund_without_origin.yml (+33/-0)
To merge this branch: bzr merge lp:~camptocamp/banking-addons/7.0-bank-statement-reconcile-account_invoice_reference
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp code review, no test Approve
Joël Grand-Guillaume @ camptocamp code review, no tests Approve
Review via email: mp+202689@code.launchpad.net

This proposal has been superseded by a proposal from 2014-03-21.

Description of the change

We observed difficulties for the users to file the references (name, origin, free reference) and above all, to understand which field will be copied in the reference field of the move and move lines. It ends up with move lines with incoherent, inconsistent descriptions and references, giving head-hashes to the accountant trying to figure out which move line refers to which document.

The approach here is to state simple rules with one concern: consistency.
The reference of the move lines must be the number of the document at their very
origin (number of a sales order, of an external document like a supplier
invoice, ...). The goal is for the accountant to be able to trace to the
source document from a ledger).
The description of a line should always be... well, a description. Not a number
or a cryptic reference.

The transaction ids from external systems like payment gateways could have been used in other modules as a reference to reconcile the entries. We strongly advocate for using a new (technical) field for that and not storing it in the existing reference to keep a clear distinctions between human references and technical reference. See also my recent proposal on transaction ids [0].

The rules:
----------

For customers invoices
~~~~~~~~~~~~~~~~~~~~~~
The reference is the origin of the invoice (so it could be a sales order's number or another document having generated the invoice).
When it has no origin, the reference is the invoice's number. In that case, the move's reference will be the same than the move's number, but that's consistent and at the end that's what we want: the ref allowing to find the origin document, here an invoice.

For supplier invoices
~~~~~~~~~~~~~~~~~~~~~
The reference is the "supplier invoice number".
When this field is empty, the ref is the invoice's number (same remark than for customers invoices).

In the supplier invoices view, when the reference type is "free reference, we hides the reference field and display the name instead, thus it will be copied in the name of the move. We also copy the supplier invoice number in the ref for usability (we think the supplier invoice number should not have existed - same as ref - but now it is there and searches and views are designed around this field so we prefer to deal with it)

Details in the __openerp__.py file.

I first thought that this module would have his place in this project as it is mostly related to how moves are created with reconciliation in heads, but it could be in an invoicing project. Let me know what you think.

[0] https://code.launchpad.net/~camptocamp/banking-addons/7.0-bank-statement-reconcile-transaction_id-imp/+merge/202806

To post a comment you must log in.
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi,

Thanks for the work and the COMMENTS ! That is very much welcome :)

LGTM

review: Approve (code review, no tests)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

LGTM

review: Approve (code review, no test)

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'account_invoice_reference'
2=== added file 'account_invoice_reference/__init__.py'
3--- account_invoice_reference/__init__.py 1970-01-01 00:00:00 +0000
4+++ account_invoice_reference/__init__.py 2014-01-29 14:12:57 +0000
5@@ -0,0 +1,22 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# Author: Guewen Baconnier
10+# Copyright 2014 Camptocamp SA
11+#
12+# This program is free software: you can redistribute it and/or modify
13+# it under the terms of the GNU Affero General Public License as
14+# published by the Free Software Foundation, either version 3 of the
15+# License, or (at your option) any later version.
16+#
17+# This program is distributed in the hope that it will be useful,
18+# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+# GNU Affero General Public License for more details.
21+#
22+# You should have received a copy of the GNU Affero General Public License
23+# along with this program. If not, see <http://www.gnu.org/licenses/>.
24+#
25+##############################################################################
26+
27+from . import account_move
28
29=== added file 'account_invoice_reference/__openerp__.py'
30--- account_invoice_reference/__openerp__.py 1970-01-01 00:00:00 +0000
31+++ account_invoice_reference/__openerp__.py 2014-01-29 14:12:57 +0000
32@@ -0,0 +1,146 @@
33+# -*- coding: utf-8 -*-
34+##############################################################################
35+#
36+# Author: Guewen Baconnier
37+# Copyright 2014 Camptocamp SA
38+#
39+# This program is free software: you can redistribute it and/or modify
40+# it under the terms of the GNU Affero General Public License as
41+# published by the Free Software Foundation, either version 3 of the
42+# License, or (at your option) any later version.
43+#
44+# This program is distributed in the hope that it will be useful,
45+# but WITHOUT ANY WARRANTY; without even the implied warranty of
46+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47+# GNU Affero General Public License for more details.
48+#
49+# You should have received a copy of the GNU Affero General Public License
50+# along with this program. If not, see <http://www.gnu.org/licenses/>.
51+#
52+##############################################################################
53+
54+{'name' : 'Invoices Reference',
55+ 'version' : '1.0',
56+ 'author' : 'Camptocamp',
57+ 'maintainer': 'Camptocamp',
58+ 'license': 'AGPL-3',
59+ 'category': 'category',
60+ 'complexity': "easy",
61+ 'depends' : ['account',
62+ ],
63+ 'description': """
64+Invoices Reference
65+==================
66+
67+Aims to simplify the "references" fields on the invoices.
68+
69+We observed difficulties for the users to file the references (name,
70+origin, free reference) and above all, to understand which field will be
71+copied in the reference field of the move and move lines.
72+
73+The approach here is to state simple rules with one concern: consistency.
74+The reference of the move lines must be the number of the document at their very
75+origin (number of a sales order, of an external document like a supplier
76+invoice, ...). The goal is for the accountant to be able to trace to the
77+source document from a ledger).
78+The description of a line should always be... well, a description. Not a number
79+or a cryptic reference.
80+
81+It particularly fits with other modules of the bank-statement-reconcile series
82+as account_advanced_reconcile_transaction_ref.
83+
84+Fields
85+------
86+
87+Enumerating the information we need in an invoice, we find that the
88+mandatory fields are:
89+
90+* Invoice Number
91+* Description
92+* Internal Reference ("our reference")
93+* External Reference ("customer or supplier reference")
94+* Optionally, a technical transaction reference (credit card payment gateways, SEPA, ...)
95+
96+Now, on the move lines:
97+
98+* Name
99+* Reference
100+* Optionally, a technical transaction reference (added by the module `base_transaction_id`)
101+
102+Let's see how the information will be organized with this module.
103+
104+Customers Invoices / Refunds
105+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106+
107+ +-----------------+-----------------+------------------------------+
108+ | Information | Invoice field | Instead of (in base modules) |
109+ +=================+=================+==============================+
110+ | Invoice number | Invoice number | Invoice number |
111+ +-----------------+-----------------+------------------------------+
112+ | Description | Name | -- |
113+ +-----------------+-----------------+------------------------------+
114+ | Internal Ref | Origin | Origin |
115+ +-----------------+-----------------+------------------------------+
116+ | External Ref | Reference | Name |
117+ +-----------------+-----------------+------------------------------+
118+
119+Information propagated to the move lines:
120+
121+ +-----------------+------------------------------------+
122+ | Move line field | Invoice field |
123+ +=================+====================================+
124+ | Description | Name |
125+ +-----------------+------------------------------------+
126+ | Reference | Origin, or Invoice number if empty |
127+ +-----------------+------------------------------------+
128+
129+
130+Supplier Invoices / Refunds
131+~~~~~~~~~~~~~~~~~~~~~~~~~~~
132+
133+Supplier invoices have an additional field `supplier_invoice_number`
134+that we consider as redundant with the reference field. This field is kept
135+and even set as mandatory, while the reference field is hidden.
136+
137+ +-----------------+-----------------+------------------------------+
138+ | Information | Invoice field | Instead of (in base modules) |
139+ +=================+=================+==============================+
140+ | Invoice number | Invoice number | Invoice number |
141+ +-----------------+-----------------+------------------------------+
142+ | Description | Name | -- |
143+ +-----------------+-----------------+------------------------------+
144+ | Internal Ref | Origin | Origin |
145+ +-----------------+-----------------+------------------------------+
146+ | External Ref | Supplier number | Supplier number |
147+ +-----------------+-----------------+------------------------------+
148+
149+The reference field is hidden when the reference type is "free reference",
150+because it is already filed in the Supplier invoice number.
151+
152+Information propagated to the move lines:
153+
154+ +-----------------+---------------------------------------------+
155+ | Move line field | Invoice field |
156+ +=================+=============================================+
157+ | Description | Name |
158+ +-----------------+---------------------------------------------+
159+ | Reference | Supplier number, or Invoice number if empty |
160+ +-----------------+---------------------------------------------+
161+
162+ """,
163+ 'website': 'http://www.camptocamp.com',
164+ 'data': ['account_invoice_view.xml',
165+ ],
166+ 'test': ['test/out_invoice_with_origin.yml',
167+ 'test/out_invoice_without_origin.yml',
168+ 'test/in_invoice_with_supplier_number.yml',
169+ 'test/in_invoice_without_supplier_number.yml',
170+ 'test/out_refund_with_origin.yml',
171+ 'test/out_refund_without_origin.yml',
172+ 'test/in_refund_with_supplier_number.yml',
173+ 'test/in_refund_without_supplier_number.yml',
174+
175+ ],
176+ 'installable': True,
177+ 'auto_install': False,
178+}
179
180=== added file 'account_invoice_reference/account_invoice_view.xml'
181--- account_invoice_reference/account_invoice_view.xml 1970-01-01 00:00:00 +0000
182+++ account_invoice_reference/account_invoice_view.xml 2014-01-29 14:12:57 +0000
183@@ -0,0 +1,49 @@
184+<?xml version="1.0" encoding="utf-8"?>
185+<openerp>
186+ <data noupdate="0">
187+ <record id="invoice_supplier_form" model="ir.ui.view">
188+ <field name="name">account.invoice.supplier.form</field>
189+ <field name="model">account.invoice</field>
190+ <field name="inherit_id" ref="account.invoice_supplier_form"/>
191+ <field name="arch" type="xml">
192+ <field name="supplier_invoice_number" position="attributes">
193+ <attribute name="required">1</attribute>
194+ </field>
195+ <!-- remove the name to move it in a better place -->
196+ <xpath expr="/form/sheet/notebook/page[@string='Other Info']//field[@name='name']"
197+ position="replace">
198+ </xpath>
199+ <field name="reference_type" position="after">
200+ <label string="Enter the reference in the Supplier Invoice Number field"
201+ class="oe_inline"
202+ attrs="{'invisible': [('reference_type', '!=', 'none')]}"/>
203+ </field>
204+ <field name="reference" position="attributes">
205+ <attribute name="attrs">{'invisible': [('reference_type', '=', 'none')]}</attribute>
206+ </field>
207+
208+ <xpath expr="//field[@name='reference_type']/parent::div" position="after">
209+ <field name="name"/>
210+ </xpath>
211+ </field>
212+ </record>
213+
214+
215+ <record id="invoice_form" model="ir.ui.view">
216+ <field name="name">account.invoice.form</field>
217+ <field name="model">account.invoice</field>
218+ <field name="inherit_id" ref="account.invoice_form"/>
219+ <field name="arch" type="xml">
220+ <xpath expr="//page[@string='Other Info']//field[@name='name']" position="replace">
221+ <field name="reference" string="Customer Reference"/>
222+ </xpath>
223+
224+ <field name="fiscal_position" position="after">
225+ <field name="name"/>
226+ </field>
227+
228+ </field>
229+ </record>
230+
231+ </data>
232+</openerp>
233
234=== added file 'account_invoice_reference/account_move.py'
235--- account_invoice_reference/account_move.py 1970-01-01 00:00:00 +0000
236+++ account_invoice_reference/account_move.py 2014-01-29 14:12:57 +0000
237@@ -0,0 +1,100 @@
238+# -*- coding: utf-8 -*-
239+##############################################################################
240+#
241+# Author: Guewen Baconnier
242+# Copyright 2014 Camptocamp SA
243+#
244+# This program is free software: you can redistribute it and/or modify
245+# it under the terms of the GNU Affero General Public License as
246+# published by the Free Software Foundation, either version 3 of the
247+# License, or (at your option) any later version.
248+#
249+# This program is distributed in the hope that it will be useful,
250+# but WITHOUT ANY WARRANTY; without even the implied warranty of
251+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
252+# GNU Affero General Public License for more details.
253+#
254+# You should have received a copy of the GNU Affero General Public License
255+# along with this program. If not, see <http://www.gnu.org/licenses/>.
256+#
257+##############################################################################
258+
259+from openerp.osv import orm, fields
260+
261+
262+class account_move(orm.Model):
263+ _inherit = 'account.move'
264+
265+ def create(self, cr, uid, vals, context=None):
266+ if context is None:
267+ context = {}
268+ # invoice from which the move is generated
269+ invoice = context.get('invoice')
270+ if invoice:
271+ assert isinstance(invoice, orm.browse_record)
272+ invoice_obj = self.pool['account.invoice']
273+ ref = invoice_obj._ref_from_invoice(cr, uid, invoice, context=context)
274+ vals = vals.copy()
275+ vals['ref'] = ref
276+ move_id = super(account_move, self).\
277+ create(cr, uid, vals, context=context)
278+ return move_id
279+
280+
281+class account_invoice(orm.Model):
282+ _inherit = 'account.invoice'
283+
284+ def _ref_from_invoice(self, cr, uid, invoice, context=None):
285+ if invoice.type in ('out_invoice', 'out_refund'):
286+ return invoice.origin
287+ elif invoice.type in ('in_invoice', 'in_refund'):
288+ return invoice.supplier_invoice_number
289+
290+ def action_number(self, cr, uid, ids, context=None):
291+ # force the number of the invoice to be updated for the
292+ # subsequent browse
293+ self.write(cr, uid, ids, {})
294+
295+ for invoice in self.browse(cr, uid, ids, context=context):
296+ ref = self._ref_from_invoice(cr, uid, invoice, context=context)
297+ if not ref:
298+ ref = invoice.number
299+ move_id = invoice.move_id.id if invoice.move_id else False
300+
301+ self.write(cr, uid, ids, {'internal_number': invoice.number},
302+ context=context)
303+ cr.execute('UPDATE account_move SET ref=%s '
304+ 'WHERE id=%s AND (ref is null OR ref = \'\')',
305+ (ref, move_id))
306+ cr.execute('UPDATE account_move_line SET ref=%s '
307+ 'WHERE move_id=%s AND (ref is null OR ref = \'\')',
308+ (ref, move_id))
309+ cr.execute('UPDATE account_analytic_line SET ref=%s '
310+ 'FROM account_move_line '
311+ 'WHERE account_move_line.move_id = %s '
312+ 'AND account_analytic_line.move_id = account_move_line.id',
313+ (ref, move_id))
314+ return True
315+
316+ def create(self, cr, uid, vals, context=None):
317+ if (vals.get('supplier_invoice_reference') and not
318+ vals.get('reference')):
319+ vals['reference'] = vals['supplier_invoice_reference']
320+ return super(account_invoice, self).create(cr, uid, vals,
321+ context=context)
322+
323+ def write(self, cr, uid, ids, vals, context=None):
324+ if vals.get('supplier_invoice_reference'):
325+ if isinstance(ids, (int, long)):
326+ ids = [ids]
327+ for invoice in self.browse(cr, uid, ids, context=context):
328+ local_vals = vals
329+ if not invoice.reference:
330+ locvals = vals.copy()
331+ locvals['reference'] = vals['supplier_invoice_reference']
332+ super(account_invoice, self).write(cr, uid, [invoice.id],
333+ locvals, context=context)
334+ return True
335+ else:
336+ return super(account_invoice, self).write(cr, uid, ids, vals,
337+ context=context)
338
339=== added directory 'account_invoice_reference/i18n'
340=== added file 'account_invoice_reference/i18n/account_invoice_reference.pot'
341--- account_invoice_reference/i18n/account_invoice_reference.pot 1970-01-01 00:00:00 +0000
342+++ account_invoice_reference/i18n/account_invoice_reference.pot 2014-01-29 14:12:57 +0000
343@@ -0,0 +1,42 @@
344+# Translation of OpenERP Server.
345+# This file contains the translation of the following modules:
346+# * account_invoice_reference
347+#
348+msgid ""
349+msgstr ""
350+"Project-Id-Version: OpenERP Server 7.0\n"
351+"Report-Msgid-Bugs-To: \n"
352+"POT-Creation-Date: 2014-01-24 14:43+0000\n"
353+"PO-Revision-Date: 2014-01-24 14:43+0000\n"
354+"Last-Translator: <>\n"
355+"Language-Team: \n"
356+"MIME-Version: 1.0\n"
357+"Content-Type: text/plain; charset=UTF-8\n"
358+"Content-Transfer-Encoding: \n"
359+"Plural-Forms: \n"
360+
361+#. module: account_invoice_reference
362+#: view:account.invoice:0
363+msgid "Enter the reference in the Supplier Invoice Number field"
364+msgstr ""
365+
366+#. module: account_invoice_reference
367+#: view:account.invoice:0
368+msgid "{'invisible': [('reference_type', '=', 'none')]}"
369+msgstr ""
370+
371+#. module: account_invoice_reference
372+#: model:ir.model,name:account_invoice_reference.model_account_move
373+msgid "Account Entry"
374+msgstr ""
375+
376+#. module: account_invoice_reference
377+#: view:account.invoice:0
378+msgid "Customer Reference"
379+msgstr ""
380+
381+#. module: account_invoice_reference
382+#: model:ir.model,name:account_invoice_reference.model_account_invoice
383+msgid "Invoice"
384+msgstr ""
385+
386
387=== added file 'account_invoice_reference/i18n/fr.po'
388--- account_invoice_reference/i18n/fr.po 1970-01-01 00:00:00 +0000
389+++ account_invoice_reference/i18n/fr.po 2014-01-29 14:12:57 +0000
390@@ -0,0 +1,42 @@
391+# Translation of OpenERP Server.
392+# This file contains the translation of the following modules:
393+# * account_invoice_reference
394+#
395+msgid ""
396+msgstr ""
397+"Project-Id-Version: OpenERP Server 7.0\n"
398+"Report-Msgid-Bugs-To: \n"
399+"POT-Creation-Date: 2014-01-24 14:43+0000\n"
400+"PO-Revision-Date: 2014-01-24 14:43+0000\n"
401+"Last-Translator: <>\n"
402+"Language-Team: \n"
403+"MIME-Version: 1.0\n"
404+"Content-Type: text/plain; charset=UTF-8\n"
405+"Content-Transfer-Encoding: \n"
406+"Plural-Forms: \n"
407+
408+#. module: account_invoice_reference
409+#: view:account.invoice:0
410+msgid "Enter the reference in the Supplier Invoice Number field"
411+msgstr "Veuillez saisir la référence dans le champ Numéro de facture fournisseur"
412+
413+#. module: account_invoice_reference
414+#: view:account.invoice:0
415+msgid "{'invisible': [('reference_type', '=', 'none')]}"
416+msgstr ""
417+
418+#. module: account_invoice_reference
419+#: model:ir.model,name:account_invoice_reference.model_account_move
420+msgid "Account Entry"
421+msgstr "Pièce comptable"
422+
423+#. module: account_invoice_reference
424+#: view:account.invoice:0
425+msgid "Customer Reference"
426+msgstr "Référence client"
427+
428+#. module: account_invoice_reference
429+#: model:ir.model,name:account_invoice_reference.model_account_invoice
430+msgid "Invoice"
431+msgstr "Facture"
432+
433
434=== added directory 'account_invoice_reference/test'
435=== added file 'account_invoice_reference/test/in_invoice_with_supplier_number.yml'
436--- account_invoice_reference/test/in_invoice_with_supplier_number.yml 1970-01-01 00:00:00 +0000
437+++ account_invoice_reference/test/in_invoice_with_supplier_number.yml 2014-01-29 14:12:57 +0000
438@@ -0,0 +1,40 @@
439+-
440+ In order to check if the reference of the move is the supplier invoice number of
441+ the invoice (supplier invoices), I create an invoice
442+-
443+ !record {model: account.invoice, id: invoice_reference_supplier_number, view: account.invoice_supplier_form}:
444+ account_id: account.a_pay
445+ check_total: 3000.0
446+ company_id: base.main_company
447+ currency_id: base.EUR
448+ invoice_line:
449+ - account_id: account.a_expense
450+ name: '[PCSC234] PC Assemble SC234'
451+ price_unit: 300.0
452+ product_id: product.product_product_3
453+ quantity: 10.0
454+ uos_id: product.product_uom_unit
455+ journal_id: account.expenses_journal
456+ partner_id: base.res_partner_12
457+ reference_type: none
458+ supplier_invoice_number: ZZZ246
459+ type: in_invoice
460+-
461+ Set again the type of the invoice (not set on the first one...)
462+-
463+ !record {model: account.invoice, id: invoice_reference_supplier_number, view: account.invoice_supplier_form}:
464+ type: in_invoice
465+-
466+ Ensure that the invoice is a supplier invoice
467+-
468+ !assert {model: account.invoice, id: invoice_reference_supplier_number}:
469+ - type == 'in_invoice'
470+-
471+ I create invoice by clicking on Create button
472+-
473+ !workflow {model: account.invoice, action: invoice_open, ref: invoice_reference_supplier_number}
474+-
475+ I check that the reference of the move is the supplier invoice number of the invoice
476+-
477+ !assert {model: account.invoice, id: invoice_reference_supplier_number}:
478+ - move_id.ref == 'ZZZ246'
479
480=== added file 'account_invoice_reference/test/in_invoice_without_supplier_number.yml'
481--- account_invoice_reference/test/in_invoice_without_supplier_number.yml 1970-01-01 00:00:00 +0000
482+++ account_invoice_reference/test/in_invoice_without_supplier_number.yml 2014-01-29 14:12:57 +0000
483@@ -0,0 +1,39 @@
484+-
485+ In order to check if the reference of the move is the supplier invoice number of
486+ the invoice (supplier invoices), I create an invoice
487+-
488+ !record {model: account.invoice, id: invoice_reference_no_supplier_number, view: account.invoice_supplier_form}:
489+ account_id: account.a_pay
490+ check_total: 3000.0
491+ company_id: base.main_company
492+ currency_id: base.EUR
493+ invoice_line:
494+ - account_id: account.a_expense
495+ name: '[PCSC234] PC Assemble SC234'
496+ price_unit: 300.0
497+ product_id: product.product_product_3
498+ quantity: 10.0
499+ uos_id: product.product_uom_unit
500+ journal_id: account.expenses_journal
501+ partner_id: base.res_partner_12
502+ reference_type: none
503+ type: in_invoice
504+-
505+ Set again the type of the invoice (not set on the first one...)
506+-
507+ !record {model: account.invoice, id: invoice_reference_supplier_number, view: account.invoice_supplier_form}:
508+ type: in_invoice
509+-
510+ Ensure that the invoice is a supplier invoice
511+-
512+ !assert {model: account.invoice, id: invoice_reference_supplier_number}:
513+ - type == 'in_invoice'
514+-
515+ I create invoice by clicking on Create button
516+-
517+ !workflow {model: account.invoice, action: invoice_open, ref: invoice_reference_no_supplier_number}
518+-
519+ I check that the reference of the move is the number of the invoice
520+-
521+ !assert {model: account.invoice, id: invoice_reference_no_supplier_number}:
522+ - move_id.ref == number
523
524=== added file 'account_invoice_reference/test/in_refund_with_supplier_number.yml'
525--- account_invoice_reference/test/in_refund_with_supplier_number.yml 1970-01-01 00:00:00 +0000
526+++ account_invoice_reference/test/in_refund_with_supplier_number.yml 2014-01-29 14:12:57 +0000
527@@ -0,0 +1,40 @@
528+-
529+ In order to check if the reference of the move is the supplier invoice number of
530+ the refund (supplier refunds), I create a refund
531+-
532+ !record {model: account.invoice, id: refund_reference_supplier_number, view: account.invoice_supplier_form}:
533+ account_id: account.a_pay
534+ check_total: 3000.0
535+ company_id: base.main_company
536+ currency_id: base.EUR
537+ invoice_line:
538+ - account_id: account.a_expense
539+ name: '[PCSC234] PC Assemble SC234'
540+ price_unit: 300.0
541+ product_id: product.product_product_3
542+ quantity: 10.0
543+ uos_id: product.product_uom_unit
544+ journal_id: account.expenses_journal
545+ partner_id: base.res_partner_12
546+ reference_type: none
547+ supplier_invoice_number: RZZZ246
548+ type: in_refund
549+-
550+ Set again the type of the refund (not set on the first one...)
551+-
552+ !record {model: account.invoice, id: refund_reference_supplier_number, view: account.invoice_supplier_form}:
553+ type: in_refund
554+-
555+ Ensure that the refund is a supplier refund
556+-
557+ !assert {model: account.invoice, id: refund_reference_supplier_number}:
558+ - type == 'in_refund'
559+-
560+ I create refund by clicking on Create button
561+-
562+ !workflow {model: account.invoice, action: invoice_open, ref: refund_reference_supplier_number}
563+-
564+ I check that the reference of the move is the supplier refund number of the refund
565+-
566+ !assert {model: account.invoice, id: refund_reference_supplier_number}:
567+ - move_id.ref == 'RZZZ246'
568
569=== added file 'account_invoice_reference/test/in_refund_without_supplier_number.yml'
570--- account_invoice_reference/test/in_refund_without_supplier_number.yml 1970-01-01 00:00:00 +0000
571+++ account_invoice_reference/test/in_refund_without_supplier_number.yml 2014-01-29 14:12:57 +0000
572@@ -0,0 +1,39 @@
573+-
574+ In order to check if the reference of the move is the supplier refund number of
575+ the refund (supplier refunds), I create an refund
576+-
577+ !record {model: account.invoice, id: refund_reference_no_supplier_number, view: account.invoice_supplier_form}:
578+ account_id: account.a_pay
579+ check_total: 3000.0
580+ company_id: base.main_company
581+ currency_id: base.EUR
582+ invoice_line:
583+ - account_id: account.a_expense
584+ name: '[PCSC234] PC Assemble SC234'
585+ price_unit: 300.0
586+ product_id: product.product_product_3
587+ quantity: 10.0
588+ uos_id: product.product_uom_unit
589+ journal_id: account.expenses_journal
590+ partner_id: base.res_partner_12
591+ reference_type: none
592+ type: in_refund
593+-
594+ Set again the type of the refund (not set on the first one...)
595+-
596+ !record {model: account.invoice, id: refund_reference_supplier_number, view: account.invoice_supplier_form}:
597+ type: in_refund
598+-
599+ Ensure that the refund is a supplier refund
600+-
601+ !assert {model: account.invoice, id: refund_reference_supplier_number}:
602+ - type == 'in_refund'
603+-
604+ I create refund by clicking on Create button
605+-
606+ !workflow {model: account.invoice, action: invoice_open, ref: refund_reference_no_supplier_number}
607+-
608+ I check that the reference of the move is the number of the refund
609+-
610+ !assert {model: account.invoice, id: refund_reference_no_supplier_number}:
611+ - move_id.ref == number
612
613=== added file 'account_invoice_reference/test/out_invoice_with_origin.yml'
614--- account_invoice_reference/test/out_invoice_with_origin.yml 1970-01-01 00:00:00 +0000
615+++ account_invoice_reference/test/out_invoice_with_origin.yml 2014-01-29 14:12:57 +0000
616@@ -0,0 +1,23 @@
617+-
618+ In order to check if the reference of the move is the origin of
619+ the invoice (customer invoices), I create an invoice
620+-
621+ !record {model: account.invoice, id: invoice_reference_origin}:
622+ payment_term: account.account_payment_term_advance
623+ journal_id: account.sales_journal
624+ partner_id: base.res_partner_3
625+ reference_type: none
626+ name: 'Test Customer Invoice'
627+ origin: ABC123
628+ invoice_line:
629+ - product_id: product.product_product_5
630+ quantity: 10.0
631+-
632+ I create invoice by clicking on Create button
633+-
634+ !workflow {model: account.invoice, action: invoice_open, ref: invoice_reference_origin}
635+-
636+ I check that the reference of the move is the origin of the invoice
637+-
638+ !assert {model: account.invoice, id: invoice_reference_origin}:
639+ - move_id.ref == 'ABC123'
640
641=== added file 'account_invoice_reference/test/out_invoice_without_origin.yml'
642--- account_invoice_reference/test/out_invoice_without_origin.yml 1970-01-01 00:00:00 +0000
643+++ account_invoice_reference/test/out_invoice_without_origin.yml 2014-01-29 14:12:57 +0000
644@@ -0,0 +1,22 @@
645+-
646+ In order to check if the reference of the move is the number of
647+ the invoice (customer invoices) when it has no origin, I create an invoice
648+-
649+ !record {model: account.invoice, id: invoice_reference_no_origin}:
650+ payment_term: account.account_payment_term_advance
651+ journal_id: account.sales_journal
652+ partner_id: base.res_partner_3
653+ reference_type: none
654+ name: 'Test Customer Invoice no origin'
655+ invoice_line:
656+ - product_id: product.product_product_5
657+ quantity: 10.0
658+-
659+ I create invoice by clicking on Create button
660+-
661+ !workflow {model: account.invoice, action: invoice_open, ref: invoice_reference_no_origin}
662+-
663+ I check that the reference of the move is the number of the invoice
664+-
665+ !assert {model: account.invoice, id: invoice_reference_no_origin}:
666+ - move_id.ref == number
667
668=== added file 'account_invoice_reference/test/out_refund_with_origin.yml'
669--- account_invoice_reference/test/out_refund_with_origin.yml 1970-01-01 00:00:00 +0000
670+++ account_invoice_reference/test/out_refund_with_origin.yml 2014-01-29 14:12:57 +0000
671@@ -0,0 +1,34 @@
672+-
673+ In order to check if the reference of the move is the origin of
674+ the refund (customer refunds), I create a refund
675+-
676+ !record {model: account.invoice, id: refund_reference_origin, view: account.invoice_form}:
677+ payment_term: account.account_payment_term_advance
678+ journal_id: account.sales_journal
679+ partner_id: base.res_partner_3
680+ reference_type: none
681+ name: 'Test Customer refund'
682+ origin: RABC123
683+ invoice_line:
684+ - product_id: product.product_product_5
685+ quantity: 10.0
686+ type: out_refund
687+-
688+ Set again the type of the invoice (not set on the first one...)
689+-
690+ !record {model: account.invoice, id: refund_reference_origin, view: account.invoice_form}:
691+ type: out_refund
692+-
693+ Ensure that the invoice is a customer refund
694+-
695+ !assert {model: account.invoice, id: refund_reference_origin}:
696+ - type == 'out_refund'
697+-
698+ I create a refund by clicking on Create button
699+-
700+ !workflow {model: account.invoice, action: invoice_open, ref: refund_reference_origin}
701+-
702+ I check that the reference of the move is the origin of the refund
703+-
704+ !assert {model: account.invoice, id: refund_reference_origin}:
705+ - move_id.ref == 'RABC123'
706
707=== added file 'account_invoice_reference/test/out_refund_without_origin.yml'
708--- account_invoice_reference/test/out_refund_without_origin.yml 1970-01-01 00:00:00 +0000
709+++ account_invoice_reference/test/out_refund_without_origin.yml 2014-01-29 14:12:57 +0000
710@@ -0,0 +1,33 @@
711+-
712+ In order to check if the reference of the move is the number of
713+ the refund (customer refunds) when it has no origin, I create a refund
714+-
715+ !record {model: account.invoice, id: refund_reference_no_origin}:
716+ payment_term: account.account_payment_term_advance
717+ journal_id: account.sales_journal
718+ partner_id: base.res_partner_3
719+ reference_type: none
720+ name: 'Test Customer refund no origin'
721+ invoice_line:
722+ - product_id: product.product_product_5
723+ quantity: 10.0
724+ type: out_refund
725+-
726+ Set again the type of the invoice (not set on the first one...)
727+-
728+ !record {model: account.invoice, id: refund_reference_no_origin, view: account.invoice_form}:
729+ type: out_refund
730+-
731+ Ensure that the invoice is a customer refund
732+-
733+ !assert {model: account.invoice, id: refund_reference_no_origin}:
734+ - type == 'out_refund'
735+-
736+ I create refund by clicking on Create button
737+-
738+ !workflow {model: account.invoice, action: invoice_open, ref: refund_reference_no_origin}
739+-
740+ I check that the reference of the move is the number of the refund
741+-
742+ !assert {model: account.invoice, id: refund_reference_no_origin}:
743+ - move_id.ref == number

Subscribers

People subscribed via source and target branches