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
=== added directory 'account_invoice_reference'
=== added file 'account_invoice_reference/__init__.py'
--- account_invoice_reference/__init__.py 1970-01-01 00:00:00 +0000
+++ account_invoice_reference/__init__.py 2014-01-29 14:12:57 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Author: Guewen Baconnier
5# Copyright 2014 Camptocamp SA
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from . import account_move
023
=== added file 'account_invoice_reference/__openerp__.py'
--- account_invoice_reference/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_invoice_reference/__openerp__.py 2014-01-29 14:12:57 +0000
@@ -0,0 +1,146 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Author: Guewen Baconnier
5# Copyright 2014 Camptocamp SA
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22{'name' : 'Invoices Reference',
23 'version' : '1.0',
24 'author' : 'Camptocamp',
25 'maintainer': 'Camptocamp',
26 'license': 'AGPL-3',
27 'category': 'category',
28 'complexity': "easy",
29 'depends' : ['account',
30 ],
31 'description': """
32Invoices Reference
33==================
34
35Aims to simplify the "references" fields on the invoices.
36
37We observed difficulties for the users to file the references (name,
38origin, free reference) and above all, to understand which field will be
39copied in the reference field of the move and move lines.
40
41The approach here is to state simple rules with one concern: consistency.
42The reference of the move lines must be the number of the document at their very
43origin (number of a sales order, of an external document like a supplier
44invoice, ...). The goal is for the accountant to be able to trace to the
45source document from a ledger).
46The description of a line should always be... well, a description. Not a number
47or a cryptic reference.
48
49It particularly fits with other modules of the bank-statement-reconcile series
50as account_advanced_reconcile_transaction_ref.
51
52Fields
53------
54
55Enumerating the information we need in an invoice, we find that the
56mandatory fields are:
57
58* Invoice Number
59* Description
60* Internal Reference ("our reference")
61* External Reference ("customer or supplier reference")
62* Optionally, a technical transaction reference (credit card payment gateways, SEPA, ...)
63
64Now, on the move lines:
65
66* Name
67* Reference
68* Optionally, a technical transaction reference (added by the module `base_transaction_id`)
69
70Let's see how the information will be organized with this module.
71
72Customers Invoices / Refunds
73~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74
75 +-----------------+-----------------+------------------------------+
76 | Information | Invoice field | Instead of (in base modules) |
77 +=================+=================+==============================+
78 | Invoice number | Invoice number | Invoice number |
79 +-----------------+-----------------+------------------------------+
80 | Description | Name | -- |
81 +-----------------+-----------------+------------------------------+
82 | Internal Ref | Origin | Origin |
83 +-----------------+-----------------+------------------------------+
84 | External Ref | Reference | Name |
85 +-----------------+-----------------+------------------------------+
86
87Information propagated to the move lines:
88
89 +-----------------+------------------------------------+
90 | Move line field | Invoice field |
91 +=================+====================================+
92 | Description | Name |
93 +-----------------+------------------------------------+
94 | Reference | Origin, or Invoice number if empty |
95 +-----------------+------------------------------------+
96
97
98Supplier Invoices / Refunds
99~~~~~~~~~~~~~~~~~~~~~~~~~~~
100
101Supplier invoices have an additional field `supplier_invoice_number`
102that we consider as redundant with the reference field. This field is kept
103and even set as mandatory, while the reference field is hidden.
104
105 +-----------------+-----------------+------------------------------+
106 | Information | Invoice field | Instead of (in base modules) |
107 +=================+=================+==============================+
108 | Invoice number | Invoice number | Invoice number |
109 +-----------------+-----------------+------------------------------+
110 | Description | Name | -- |
111 +-----------------+-----------------+------------------------------+
112 | Internal Ref | Origin | Origin |
113 +-----------------+-----------------+------------------------------+
114 | External Ref | Supplier number | Supplier number |
115 +-----------------+-----------------+------------------------------+
116
117The reference field is hidden when the reference type is "free reference",
118because it is already filed in the Supplier invoice number.
119
120Information propagated to the move lines:
121
122 +-----------------+---------------------------------------------+
123 | Move line field | Invoice field |
124 +=================+=============================================+
125 | Description | Name |
126 +-----------------+---------------------------------------------+
127 | Reference | Supplier number, or Invoice number if empty |
128 +-----------------+---------------------------------------------+
129
130 """,
131 'website': 'http://www.camptocamp.com',
132 'data': ['account_invoice_view.xml',
133 ],
134 'test': ['test/out_invoice_with_origin.yml',
135 'test/out_invoice_without_origin.yml',
136 'test/in_invoice_with_supplier_number.yml',
137 'test/in_invoice_without_supplier_number.yml',
138 'test/out_refund_with_origin.yml',
139 'test/out_refund_without_origin.yml',
140 'test/in_refund_with_supplier_number.yml',
141 'test/in_refund_without_supplier_number.yml',
142
143 ],
144 'installable': True,
145 'auto_install': False,
146}
0147
=== added file 'account_invoice_reference/account_invoice_view.xml'
--- account_invoice_reference/account_invoice_view.xml 1970-01-01 00:00:00 +0000
+++ account_invoice_reference/account_invoice_view.xml 2014-01-29 14:12:57 +0000
@@ -0,0 +1,49 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data noupdate="0">
4 <record id="invoice_supplier_form" model="ir.ui.view">
5 <field name="name">account.invoice.supplier.form</field>
6 <field name="model">account.invoice</field>
7 <field name="inherit_id" ref="account.invoice_supplier_form"/>
8 <field name="arch" type="xml">
9 <field name="supplier_invoice_number" position="attributes">
10 <attribute name="required">1</attribute>
11 </field>
12 <!-- remove the name to move it in a better place -->
13 <xpath expr="/form/sheet/notebook/page[@string='Other Info']//field[@name='name']"
14 position="replace">
15 </xpath>
16 <field name="reference_type" position="after">
17 <label string="Enter the reference in the Supplier Invoice Number field"
18 class="oe_inline"
19 attrs="{'invisible': [('reference_type', '!=', 'none')]}"/>
20 </field>
21 <field name="reference" position="attributes">
22 <attribute name="attrs">{'invisible': [('reference_type', '=', 'none')]}</attribute>
23 </field>
24
25 <xpath expr="//field[@name='reference_type']/parent::div" position="after">
26 <field name="name"/>
27 </xpath>
28 </field>
29 </record>
30
31
32 <record id="invoice_form" model="ir.ui.view">
33 <field name="name">account.invoice.form</field>
34 <field name="model">account.invoice</field>
35 <field name="inherit_id" ref="account.invoice_form"/>
36 <field name="arch" type="xml">
37 <xpath expr="//page[@string='Other Info']//field[@name='name']" position="replace">
38 <field name="reference" string="Customer Reference"/>
39 </xpath>
40
41 <field name="fiscal_position" position="after">
42 <field name="name"/>
43 </field>
44
45 </field>
46 </record>
47
48 </data>
49</openerp>
050
=== added file 'account_invoice_reference/account_move.py'
--- account_invoice_reference/account_move.py 1970-01-01 00:00:00 +0000
+++ account_invoice_reference/account_move.py 2014-01-29 14:12:57 +0000
@@ -0,0 +1,100 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Author: Guewen Baconnier
5# Copyright 2014 Camptocamp SA
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from openerp.osv import orm, fields
23
24
25class account_move(orm.Model):
26 _inherit = 'account.move'
27
28 def create(self, cr, uid, vals, context=None):
29 if context is None:
30 context = {}
31 # invoice from which the move is generated
32 invoice = context.get('invoice')
33 if invoice:
34 assert isinstance(invoice, orm.browse_record)
35 invoice_obj = self.pool['account.invoice']
36 ref = invoice_obj._ref_from_invoice(cr, uid, invoice, context=context)
37 vals = vals.copy()
38 vals['ref'] = ref
39 move_id = super(account_move, self).\
40 create(cr, uid, vals, context=context)
41 return move_id
42
43
44class account_invoice(orm.Model):
45 _inherit = 'account.invoice'
46
47 def _ref_from_invoice(self, cr, uid, invoice, context=None):
48 if invoice.type in ('out_invoice', 'out_refund'):
49 return invoice.origin
50 elif invoice.type in ('in_invoice', 'in_refund'):
51 return invoice.supplier_invoice_number
52
53 def action_number(self, cr, uid, ids, context=None):
54 # force the number of the invoice to be updated for the
55 # subsequent browse
56 self.write(cr, uid, ids, {})
57
58 for invoice in self.browse(cr, uid, ids, context=context):
59 ref = self._ref_from_invoice(cr, uid, invoice, context=context)
60 if not ref:
61 ref = invoice.number
62 move_id = invoice.move_id.id if invoice.move_id else False
63
64 self.write(cr, uid, ids, {'internal_number': invoice.number},
65 context=context)
66 cr.execute('UPDATE account_move SET ref=%s '
67 'WHERE id=%s AND (ref is null OR ref = \'\')',
68 (ref, move_id))
69 cr.execute('UPDATE account_move_line SET ref=%s '
70 'WHERE move_id=%s AND (ref is null OR ref = \'\')',
71 (ref, move_id))
72 cr.execute('UPDATE account_analytic_line SET ref=%s '
73 'FROM account_move_line '
74 'WHERE account_move_line.move_id = %s '
75 'AND account_analytic_line.move_id = account_move_line.id',
76 (ref, move_id))
77 return True
78
79 def create(self, cr, uid, vals, context=None):
80 if (vals.get('supplier_invoice_reference') and not
81 vals.get('reference')):
82 vals['reference'] = vals['supplier_invoice_reference']
83 return super(account_invoice, self).create(cr, uid, vals,
84 context=context)
85
86 def write(self, cr, uid, ids, vals, context=None):
87 if vals.get('supplier_invoice_reference'):
88 if isinstance(ids, (int, long)):
89 ids = [ids]
90 for invoice in self.browse(cr, uid, ids, context=context):
91 local_vals = vals
92 if not invoice.reference:
93 locvals = vals.copy()
94 locvals['reference'] = vals['supplier_invoice_reference']
95 super(account_invoice, self).write(cr, uid, [invoice.id],
96 locvals, context=context)
97 return True
98 else:
99 return super(account_invoice, self).write(cr, uid, ids, vals,
100 context=context)
0101
=== added directory 'account_invoice_reference/i18n'
=== added file 'account_invoice_reference/i18n/account_invoice_reference.pot'
--- account_invoice_reference/i18n/account_invoice_reference.pot 1970-01-01 00:00:00 +0000
+++ account_invoice_reference/i18n/account_invoice_reference.pot 2014-01-29 14:12:57 +0000
@@ -0,0 +1,42 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * account_invoice_reference
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-01-24 14:43+0000\n"
10"PO-Revision-Date: 2014-01-24 14:43+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: account_invoice_reference
19#: view:account.invoice:0
20msgid "Enter the reference in the Supplier Invoice Number field"
21msgstr ""
22
23#. module: account_invoice_reference
24#: view:account.invoice:0
25msgid "{'invisible': [('reference_type', '=', 'none')]}"
26msgstr ""
27
28#. module: account_invoice_reference
29#: model:ir.model,name:account_invoice_reference.model_account_move
30msgid "Account Entry"
31msgstr ""
32
33#. module: account_invoice_reference
34#: view:account.invoice:0
35msgid "Customer Reference"
36msgstr ""
37
38#. module: account_invoice_reference
39#: model:ir.model,name:account_invoice_reference.model_account_invoice
40msgid "Invoice"
41msgstr ""
42
043
=== added file 'account_invoice_reference/i18n/fr.po'
--- account_invoice_reference/i18n/fr.po 1970-01-01 00:00:00 +0000
+++ account_invoice_reference/i18n/fr.po 2014-01-29 14:12:57 +0000
@@ -0,0 +1,42 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * account_invoice_reference
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-01-24 14:43+0000\n"
10"PO-Revision-Date: 2014-01-24 14:43+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: account_invoice_reference
19#: view:account.invoice:0
20msgid "Enter the reference in the Supplier Invoice Number field"
21msgstr "Veuillez saisir la référence dans le champ Numéro de facture fournisseur"
22
23#. module: account_invoice_reference
24#: view:account.invoice:0
25msgid "{'invisible': [('reference_type', '=', 'none')]}"
26msgstr ""
27
28#. module: account_invoice_reference
29#: model:ir.model,name:account_invoice_reference.model_account_move
30msgid "Account Entry"
31msgstr "Pièce comptable"
32
33#. module: account_invoice_reference
34#: view:account.invoice:0
35msgid "Customer Reference"
36msgstr "Référence client"
37
38#. module: account_invoice_reference
39#: model:ir.model,name:account_invoice_reference.model_account_invoice
40msgid "Invoice"
41msgstr "Facture"
42
043
=== added directory 'account_invoice_reference/test'
=== added file 'account_invoice_reference/test/in_invoice_with_supplier_number.yml'
--- account_invoice_reference/test/in_invoice_with_supplier_number.yml 1970-01-01 00:00:00 +0000
+++ account_invoice_reference/test/in_invoice_with_supplier_number.yml 2014-01-29 14:12:57 +0000
@@ -0,0 +1,40 @@
1-
2 In order to check if the reference of the move is the supplier invoice number of
3 the invoice (supplier invoices), I create an invoice
4-
5 !record {model: account.invoice, id: invoice_reference_supplier_number, view: account.invoice_supplier_form}:
6 account_id: account.a_pay
7 check_total: 3000.0
8 company_id: base.main_company
9 currency_id: base.EUR
10 invoice_line:
11 - account_id: account.a_expense
12 name: '[PCSC234] PC Assemble SC234'
13 price_unit: 300.0
14 product_id: product.product_product_3
15 quantity: 10.0
16 uos_id: product.product_uom_unit
17 journal_id: account.expenses_journal
18 partner_id: base.res_partner_12
19 reference_type: none
20 supplier_invoice_number: ZZZ246
21 type: in_invoice
22-
23 Set again the type of the invoice (not set on the first one...)
24-
25 !record {model: account.invoice, id: invoice_reference_supplier_number, view: account.invoice_supplier_form}:
26 type: in_invoice
27-
28 Ensure that the invoice is a supplier invoice
29-
30 !assert {model: account.invoice, id: invoice_reference_supplier_number}:
31 - type == 'in_invoice'
32-
33 I create invoice by clicking on Create button
34-
35 !workflow {model: account.invoice, action: invoice_open, ref: invoice_reference_supplier_number}
36-
37 I check that the reference of the move is the supplier invoice number of the invoice
38-
39 !assert {model: account.invoice, id: invoice_reference_supplier_number}:
40 - move_id.ref == 'ZZZ246'
041
=== added file 'account_invoice_reference/test/in_invoice_without_supplier_number.yml'
--- account_invoice_reference/test/in_invoice_without_supplier_number.yml 1970-01-01 00:00:00 +0000
+++ account_invoice_reference/test/in_invoice_without_supplier_number.yml 2014-01-29 14:12:57 +0000
@@ -0,0 +1,39 @@
1-
2 In order to check if the reference of the move is the supplier invoice number of
3 the invoice (supplier invoices), I create an invoice
4-
5 !record {model: account.invoice, id: invoice_reference_no_supplier_number, view: account.invoice_supplier_form}:
6 account_id: account.a_pay
7 check_total: 3000.0
8 company_id: base.main_company
9 currency_id: base.EUR
10 invoice_line:
11 - account_id: account.a_expense
12 name: '[PCSC234] PC Assemble SC234'
13 price_unit: 300.0
14 product_id: product.product_product_3
15 quantity: 10.0
16 uos_id: product.product_uom_unit
17 journal_id: account.expenses_journal
18 partner_id: base.res_partner_12
19 reference_type: none
20 type: in_invoice
21-
22 Set again the type of the invoice (not set on the first one...)
23-
24 !record {model: account.invoice, id: invoice_reference_supplier_number, view: account.invoice_supplier_form}:
25 type: in_invoice
26-
27 Ensure that the invoice is a supplier invoice
28-
29 !assert {model: account.invoice, id: invoice_reference_supplier_number}:
30 - type == 'in_invoice'
31-
32 I create invoice by clicking on Create button
33-
34 !workflow {model: account.invoice, action: invoice_open, ref: invoice_reference_no_supplier_number}
35-
36 I check that the reference of the move is the number of the invoice
37-
38 !assert {model: account.invoice, id: invoice_reference_no_supplier_number}:
39 - move_id.ref == number
040
=== added file 'account_invoice_reference/test/in_refund_with_supplier_number.yml'
--- account_invoice_reference/test/in_refund_with_supplier_number.yml 1970-01-01 00:00:00 +0000
+++ account_invoice_reference/test/in_refund_with_supplier_number.yml 2014-01-29 14:12:57 +0000
@@ -0,0 +1,40 @@
1-
2 In order to check if the reference of the move is the supplier invoice number of
3 the refund (supplier refunds), I create a refund
4-
5 !record {model: account.invoice, id: refund_reference_supplier_number, view: account.invoice_supplier_form}:
6 account_id: account.a_pay
7 check_total: 3000.0
8 company_id: base.main_company
9 currency_id: base.EUR
10 invoice_line:
11 - account_id: account.a_expense
12 name: '[PCSC234] PC Assemble SC234'
13 price_unit: 300.0
14 product_id: product.product_product_3
15 quantity: 10.0
16 uos_id: product.product_uom_unit
17 journal_id: account.expenses_journal
18 partner_id: base.res_partner_12
19 reference_type: none
20 supplier_invoice_number: RZZZ246
21 type: in_refund
22-
23 Set again the type of the refund (not set on the first one...)
24-
25 !record {model: account.invoice, id: refund_reference_supplier_number, view: account.invoice_supplier_form}:
26 type: in_refund
27-
28 Ensure that the refund is a supplier refund
29-
30 !assert {model: account.invoice, id: refund_reference_supplier_number}:
31 - type == 'in_refund'
32-
33 I create refund by clicking on Create button
34-
35 !workflow {model: account.invoice, action: invoice_open, ref: refund_reference_supplier_number}
36-
37 I check that the reference of the move is the supplier refund number of the refund
38-
39 !assert {model: account.invoice, id: refund_reference_supplier_number}:
40 - move_id.ref == 'RZZZ246'
041
=== added file 'account_invoice_reference/test/in_refund_without_supplier_number.yml'
--- account_invoice_reference/test/in_refund_without_supplier_number.yml 1970-01-01 00:00:00 +0000
+++ account_invoice_reference/test/in_refund_without_supplier_number.yml 2014-01-29 14:12:57 +0000
@@ -0,0 +1,39 @@
1-
2 In order to check if the reference of the move is the supplier refund number of
3 the refund (supplier refunds), I create an refund
4-
5 !record {model: account.invoice, id: refund_reference_no_supplier_number, view: account.invoice_supplier_form}:
6 account_id: account.a_pay
7 check_total: 3000.0
8 company_id: base.main_company
9 currency_id: base.EUR
10 invoice_line:
11 - account_id: account.a_expense
12 name: '[PCSC234] PC Assemble SC234'
13 price_unit: 300.0
14 product_id: product.product_product_3
15 quantity: 10.0
16 uos_id: product.product_uom_unit
17 journal_id: account.expenses_journal
18 partner_id: base.res_partner_12
19 reference_type: none
20 type: in_refund
21-
22 Set again the type of the refund (not set on the first one...)
23-
24 !record {model: account.invoice, id: refund_reference_supplier_number, view: account.invoice_supplier_form}:
25 type: in_refund
26-
27 Ensure that the refund is a supplier refund
28-
29 !assert {model: account.invoice, id: refund_reference_supplier_number}:
30 - type == 'in_refund'
31-
32 I create refund by clicking on Create button
33-
34 !workflow {model: account.invoice, action: invoice_open, ref: refund_reference_no_supplier_number}
35-
36 I check that the reference of the move is the number of the refund
37-
38 !assert {model: account.invoice, id: refund_reference_no_supplier_number}:
39 - move_id.ref == number
040
=== added file 'account_invoice_reference/test/out_invoice_with_origin.yml'
--- account_invoice_reference/test/out_invoice_with_origin.yml 1970-01-01 00:00:00 +0000
+++ account_invoice_reference/test/out_invoice_with_origin.yml 2014-01-29 14:12:57 +0000
@@ -0,0 +1,23 @@
1-
2 In order to check if the reference of the move is the origin of
3 the invoice (customer invoices), I create an invoice
4-
5 !record {model: account.invoice, id: invoice_reference_origin}:
6 payment_term: account.account_payment_term_advance
7 journal_id: account.sales_journal
8 partner_id: base.res_partner_3
9 reference_type: none
10 name: 'Test Customer Invoice'
11 origin: ABC123
12 invoice_line:
13 - product_id: product.product_product_5
14 quantity: 10.0
15-
16 I create invoice by clicking on Create button
17-
18 !workflow {model: account.invoice, action: invoice_open, ref: invoice_reference_origin}
19-
20 I check that the reference of the move is the origin of the invoice
21-
22 !assert {model: account.invoice, id: invoice_reference_origin}:
23 - move_id.ref == 'ABC123'
024
=== added file 'account_invoice_reference/test/out_invoice_without_origin.yml'
--- account_invoice_reference/test/out_invoice_without_origin.yml 1970-01-01 00:00:00 +0000
+++ account_invoice_reference/test/out_invoice_without_origin.yml 2014-01-29 14:12:57 +0000
@@ -0,0 +1,22 @@
1-
2 In order to check if the reference of the move is the number of
3 the invoice (customer invoices) when it has no origin, I create an invoice
4-
5 !record {model: account.invoice, id: invoice_reference_no_origin}:
6 payment_term: account.account_payment_term_advance
7 journal_id: account.sales_journal
8 partner_id: base.res_partner_3
9 reference_type: none
10 name: 'Test Customer Invoice no origin'
11 invoice_line:
12 - product_id: product.product_product_5
13 quantity: 10.0
14-
15 I create invoice by clicking on Create button
16-
17 !workflow {model: account.invoice, action: invoice_open, ref: invoice_reference_no_origin}
18-
19 I check that the reference of the move is the number of the invoice
20-
21 !assert {model: account.invoice, id: invoice_reference_no_origin}:
22 - move_id.ref == number
023
=== added file 'account_invoice_reference/test/out_refund_with_origin.yml'
--- account_invoice_reference/test/out_refund_with_origin.yml 1970-01-01 00:00:00 +0000
+++ account_invoice_reference/test/out_refund_with_origin.yml 2014-01-29 14:12:57 +0000
@@ -0,0 +1,34 @@
1-
2 In order to check if the reference of the move is the origin of
3 the refund (customer refunds), I create a refund
4-
5 !record {model: account.invoice, id: refund_reference_origin, view: account.invoice_form}:
6 payment_term: account.account_payment_term_advance
7 journal_id: account.sales_journal
8 partner_id: base.res_partner_3
9 reference_type: none
10 name: 'Test Customer refund'
11 origin: RABC123
12 invoice_line:
13 - product_id: product.product_product_5
14 quantity: 10.0
15 type: out_refund
16-
17 Set again the type of the invoice (not set on the first one...)
18-
19 !record {model: account.invoice, id: refund_reference_origin, view: account.invoice_form}:
20 type: out_refund
21-
22 Ensure that the invoice is a customer refund
23-
24 !assert {model: account.invoice, id: refund_reference_origin}:
25 - type == 'out_refund'
26-
27 I create a refund by clicking on Create button
28-
29 !workflow {model: account.invoice, action: invoice_open, ref: refund_reference_origin}
30-
31 I check that the reference of the move is the origin of the refund
32-
33 !assert {model: account.invoice, id: refund_reference_origin}:
34 - move_id.ref == 'RABC123'
035
=== added file 'account_invoice_reference/test/out_refund_without_origin.yml'
--- account_invoice_reference/test/out_refund_without_origin.yml 1970-01-01 00:00:00 +0000
+++ account_invoice_reference/test/out_refund_without_origin.yml 2014-01-29 14:12:57 +0000
@@ -0,0 +1,33 @@
1-
2 In order to check if the reference of the move is the number of
3 the refund (customer refunds) when it has no origin, I create a refund
4-
5 !record {model: account.invoice, id: refund_reference_no_origin}:
6 payment_term: account.account_payment_term_advance
7 journal_id: account.sales_journal
8 partner_id: base.res_partner_3
9 reference_type: none
10 name: 'Test Customer refund no origin'
11 invoice_line:
12 - product_id: product.product_product_5
13 quantity: 10.0
14 type: out_refund
15-
16 Set again the type of the invoice (not set on the first one...)
17-
18 !record {model: account.invoice, id: refund_reference_no_origin, view: account.invoice_form}:
19 type: out_refund
20-
21 Ensure that the invoice is a customer refund
22-
23 !assert {model: account.invoice, id: refund_reference_no_origin}:
24 - type == 'out_refund'
25-
26 I create refund by clicking on Create button
27-
28 !workflow {model: account.invoice, action: invoice_open, ref: refund_reference_no_origin}
29-
30 I check that the reference of the move is the number of the refund
31-
32 !assert {model: account.invoice, id: refund_reference_no_origin}:
33 - move_id.ref == number

Subscribers

People subscribed via source and target branches