Merge lp:~akretion-team/banking-addons/70-fully-handle-payment-types into lp:banking-addons

Proposed by Alexis de Lattre
Status: Merged
Merged at revision: 262
Proposed branch: lp:~akretion-team/banking-addons/70-fully-handle-payment-types
Merge into: lp:banking-addons
Diff against target: 1929 lines (+1329/-124)
45 files modified
account_banking_pain_base/__openerp__.py (+1/-0)
account_banking_payment/model/account_payment.py (+109/-75)
account_banking_payment_export/demo/banking_demo.xml (+35/-0)
account_banking_payment_export/model/__init__.py (+1/-0)
account_banking_payment_export/model/account_payment.py (+3/-0)
account_banking_payment_export/model/payment_mode.py (+5/-0)
account_banking_payment_export/model/payment_mode_type.py (+2/-0)
account_banking_payment_export/view/account_payment.xml (+7/-6)
account_banking_payment_export/view/payment_mode.xml (+1/-0)
account_banking_payment_export/view/payment_mode_type.xml (+33/-5)
account_banking_sepa_credit_transfer/__openerp__.py (+1/-0)
account_banking_sepa_credit_transfer/account_banking_sepa.py (+1/-1)
account_banking_sepa_credit_transfer/account_banking_sepa_view.xml (+15/-18)
account_banking_sepa_direct_debit/__openerp__.py (+1/-0)
account_banking_sepa_direct_debit/account_banking_sdd.py (+1/-1)
account_banking_sepa_direct_debit/account_banking_sdd_view.xml (+15/-18)
account_banking_sepa_direct_debit/company.py (+1/-0)
account_payment_partner/__init__.py (+23/-0)
account_payment_partner/__openerp__.py (+55/-0)
account_payment_partner/demo/partner_demo.xml (+51/-0)
account_payment_partner/i18n/account_payment_partner.pot (+57/-0)
account_payment_partner/model/__init__.py (+25/-0)
account_payment_partner/model/account_invoice.py (+56/-0)
account_payment_partner/model/partner.py (+44/-0)
account_payment_partner/model/payment_order_create.py (+39/-0)
account_payment_partner/view/account_invoice.xml (+38/-0)
account_payment_partner/view/partner.xml (+31/-0)
account_payment_purchase/__init__.py (+23/-0)
account_payment_purchase/__openerp__.py (+55/-0)
account_payment_purchase/i18n/account_payment_purchase.pot (+42/-0)
account_payment_purchase/i18n/fr.po (+42/-0)
account_payment_purchase/model/__init__.py (+24/-0)
account_payment_purchase/model/purchase.py (+82/-0)
account_payment_purchase/model/stock.py (+42/-0)
account_payment_purchase/view/purchase.xml (+26/-0)
account_payment_sale/__init__.py (+23/-0)
account_payment_sale/__openerp__.py (+55/-0)
account_payment_sale/i18n/account_payment_sale.pot (+27/-0)
account_payment_sale/model/__init__.py (+23/-0)
account_payment_sale/model/sale.py (+55/-0)
account_payment_sale/view/sale.xml (+24/-0)
account_payment_sale_stock/__init__.py (+23/-0)
account_payment_sale_stock/__openerp__.py (+46/-0)
account_payment_sale_stock/model/__init__.py (+23/-0)
account_payment_sale_stock/model/stock.py (+43/-0)
To merge this branch: bzr merge lp:~akretion-team/banking-addons/70-fully-handle-payment-types
Reviewer Review Type Date Requested Status
Stefan Rijnhart (Opener) Approve
Raphaël Valyi - http://www.akretion.com Approve
Review via email: mp+211283@code.launchpad.net

Description of the change

This merge proposal is the result of the discussion that I started in the mailing-list banking-addons-drivers with subject "account_payment_extension", cf https://lists.launchpad.net/banking-addons-drivers/msg00059.html

The main changes in this merge proposal are :

1) Add 4 new modules to handle payment type and bank accounts:
    - account_payment_partner
    - account_payment_sale
    - account_payment_sale_stock
    - account_payment_purchase

2) Filter the selection of invoices per payment type.
    Add active field on payment.mode and payment.mode.type.
    Add menu entry for Payment Types.

This MP also contains smaller stuff :

3) Small code clean-up in the SEPA modules (views, 'state' field on SEPA file objects)

4) Code enhancement in the file account_banking_payment/model/account_payment.py (PEP-8, _prepare_* functions, support for payment lines with move_line_id = False)

I hope you will enjoy this work.

To post a comment you must log in.
239. By Alexis de Lattre

Add a hook, which is designed to be inherited. For example, it can be used to wake-up the workflow of purchase order (usefull in combination with the module 'purchase_payment_order')

240. By Alexis de Lattre

[FIX] wrong model type in inherit.

241. By Raphaël Valyi - http://www.akretion.com

[MERGE] merged HEAD into current feature branch

242. By Raphaël Valyi - http://www.akretion.com

[REF] wrapping module description lines to keep cool with the PEP-8 extremists

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

Thanks for this excellent work Alexis! This is making it possible to finally migrate from account_payment_extension and weight altogether on the same banking modules.

review: Approve
Revision history for this message
Luis Felipe Miléo - http://www.kmee.com.br (mileo) wrote :

Nice work. Thanks
Em 21/03/2014 16:53, "Raphaël Valyi - http://www.akretion.com" <
<email address hidden>> escreveu:

> Review: Approve
>
> Thanks for this excellent work Alexis! This is making it possible to
> finally migrate from account_payment_extension and weight altogether on the
> same banking modules.
> --
>
> https://code.launchpad.net/~akretion-team/banking-addons/70-fully-handle-payment-types/+merge/211283
> Your team Banking Addons Core Editors is subscribed to branch
> lp:banking-addons.
>
> --
> Mailing list: https://launchpad.net/~banking-addons-team
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~banking-addons-team
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks. The general architecture looks very neat.

Can I ask you why you chose the level of payment mode type to register on partners and invoices instead of the payment mode level? The payment mode type level does not cover the case where you have several payment modes of the same SEPA mode type but on different bank accounts. It also makes transitions between various SEPA modes difficult (for instance, when the bank switches from supporting version 03 to 04).

Other remarks:

- IMHO the sale/sale_stock/purchase modules should be set to autoinstall (=installed automatically when dependencies are fulfilled).
- Filtering seems very strict. Maybe allow for a transition by means of a checkbox on the payment mode (type) to indicate if you want to filter invoices by this exact payment mode or also select for invoices with no payment mode set yet. What do you think?
- Purchase module: maybe override do_merge and apply any payment mode found in the original purchase orders to the resulting merged order? If you merge purchase orders with this code, you don't get any payment mode in the result.
- I would have prefered module names with 'payment_mode' (like account_payment_mode_sale). Would you consider renaming them?
- You really should apply the reverse payment mode setting from the partner for refunds. With regards to that, the fields had better be called something like credit_payment_mode and debit_payment_mode instead of supplier_payment_mode and customer_payment_mode. Maybe combine this with a corresponding filter on 'debit' or 'credit' modes.
- What is the use of partner_bank_receivable? It does not seem related at all related to the rest of the changes, or to payment functionality in general.
- Moot point if you honour my first question, but I think it would be nice if the payment type tree view could show inactive items by default, by passing {'active_test': False} in its act_window's context.

review: Needs Fixing
243. By Alexis de Lattre

Add auto-install on account_payment_sale_stock.

244. By Alexis de Lattre

As suggested by Stefan, display unactive payment.mode.types in tree view.

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

@Stefan:

About why I chose the level of payment.mode.type vs payment.mode : I first thought I would point to payment.mode, but, as I explained that in my email "Re: [Banking-addons-drivers] account_payment_extension" on 21/02/2014 12:40 Paris time, I found out that account_payment_extension points to payment.mode.type and I think I found the reason ; here is the explaination of my email :

<<
if you consider that your company has 2 bank accounts A and B : they sometimes pay their suppliers from account A, sometimes from account B, depending on the situation of each bank account. As they have 2 bank accounts, they have 2 payment modes for wire transfer... but they could share the same account type "wire transfer". In this case, we would prefer to have the many2one fields point to account.type, so that it is independant from the bank account that will be used for the payment.
Note : if the 2 banks use 2 different versions of SEPA PAIN, then we'll have 2 different payment types... bad luck ! But maybe we could change that in the future and have 1 payment type for "pain.001.001.xx" and store the xx on the payment.mode.
>>

About your other remarks :
- I must say that I dislike the auto_install mechanism :) I don't think it would be a good idea to have it on account_payment_purchase and account_payment_sale, because you may want to have sale and account_payment_partner, but not to manage the payment type on sale.order, but only on partners and customer invoices. Same for purchase ; you may not want to manage the payment type on purchase.order, but only on partners and supplier invoices. So I have just added the auto-install option on account_payment_sale_stock, where I admit it can be a good idea :)
- About filtering : I agree with you. We could imagine that, by default, you also get the invoices with no payment type set.
- I always forget the do_merge stuff on POs ; I surely need to add that.
- about the name of the modules : if we keep pointing to payment.mode.type, it may lead to confusion to put "payment_mode" in the name.
- I think that the partner_bank_receivable is fully related to the other changes. On a customer invoice, the field partner_bank_id is a M2O to res.partner.bank and it designate the bank account of "your company" on which you would like to receive the money. We need to have the same field on sale.order and res.partner, and have the usual behavior :

customer res.partner (partner_bank_receivable) -> sale.order (partner_bank_receivable) -> customer account.invoice (partner_bank_id)

- I like your suggestion to show inactive payment types in tree view by default. I didn't knew it was possible with active_test : False. I just made the modification.

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

Can we really inherit the do_merge function ? It seems that this function is not designed to be inherited... I don't see how I could develop what you suggested (and it would be a bad idea to copy-paste the whole do_merge function inside the module account_payment_purchase). If you have an example of a module that inherit do_merge to add a field, please tell me.

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

Hello,

I believed that this fat do_merge method would have been refactored in trunk or trunk-wms. Sadly I just checked and I had wrong expectation: it stayed nearly the same. Eventually, if a simple patch is envisioned to make do_merge easier to override we may consider refactoring it very lightly in OCB and having a hook working here. Now, may be we should just first merge Alexis's improvement and leave this minor detail for later?

for reference:
7.0: https://github.com/akretion/openerp-addons/blob/ocb-7.0/purchase/purchase.py#L751
trunk: https://github.com/akretion/openerp-addons/blob/master/purchase/purchase.py#L749
trunk-wms: https://github.com/akretion/openerp-addons/blob/trunk-wms/purchase/purchase.py#L829

245. By Alexis de Lattre

As suggested by Stefan: also select invoices with empty payment.mode.type.

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

@Stefan:

My last commit (245) is on your remark about filtering : by default, you now also get the invoices with no payment type set.

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

Interestingly, Leonardo Pistone just did a modular rewrite of the do_merge method:
http://bazaar.launchpad.net/~camptocamp/openobject-addons/trunk-refactor-po-merge-lep/revision/9372
Not sure yet what is the plan for 7 (OCB merge? monkey patch? depend on extra module?) or 8 (merge in official?)
But at least the code exists now.

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks for your response, Alexis. I see you honoured most of my requests. As for purchase do_merge, it's OK to leave it for another proposal.

I am still not convinced of using the payment type, instead of the payment mode. I think it is safe to say that the payment type is an arbitrary technical detail of the way that payment orders are exported for each bank account, but then again so is the actual bank account. However, the first option leads to a big hassle when a bank changes the payment type that it supports (which we see now in the transfer to SEPA and we will see in the future with SEPA updates). The latter option is transparent in that case: you just change this technical detail in the payment mode.

You mention a valid example of course, of a company exporting to one of a couple of bank accounts depending on their liquidity situation. But this is not an argument for implementing this feature on the wrong level. Instead, this is supported transparently in the following manner: link the same payment mode on every partner that you want to include in payments from this pool of bank accounts. This particular payment mode is of course tied to a specific bank account itself, but if the user wants to change the bank account, they can simply change the payment mode on the payment order after selecting the payables, switching to the bank account that they want to use this time.

On the contrary, my use case of a company that wants to pay some suppliers from account A and some suppliers from account B is not supported at all in the current implementation. It would be when you implement it on the level of the payment mode.

It looks to me as if implementing this on the level of the payment mode leads to greater flexibility and no real problems when the payment type should change. So I'm still asking you to reconsider.

review: Needs Fixing
246. By Alexis de Lattre

Update to the new data-model decided during the Open Days 2014.
Add demo data.

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

I have just implemented the data-model that we decided during the Open Days ; we don't use payment types any more, only payment modes.

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thank you Alexis, code looks good to me! I'll be doing some tests later on.

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Found a small oversight: ll.973,1738,1922 need to check for the payment_mode_id before asking its bank_id.id

review: Needs Fixing
247. By Alexis de Lattre

Suggested by Stefan Rijnhart : check for the payment_mode_id before asking its bank_id.id

248. By Alexis de Lattre

[MERGE] with trunk revno 260.

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks for the update!

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_banking_pain_base/__openerp__.py'
2--- account_banking_pain_base/__openerp__.py 2013-12-24 14:30:37 +0000
3+++ account_banking_pain_base/__openerp__.py 2014-06-23 09:47:35 +0000
4@@ -1,3 +1,4 @@
5+# -*- encoding: utf-8 -*-
6 ##############################################################################
7 #
8 # PAIN base module for OpenERP
9
10=== modified file 'account_banking_payment/model/account_payment.py'
11--- account_banking_payment/model/account_payment.py 2014-02-16 16:13:15 +0000
12+++ account_banking_payment/model/account_payment.py 2014-06-23 09:47:35 +0000
13@@ -3,7 +3,7 @@
14 #
15 # Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
16 # (C) 2011 - 2013 Therp BV (<http://therp.nl>).
17-#
18+#
19 # All other contributions are (C) by their respective contributors
20 #
21 # All Rights Reserved
22@@ -63,11 +63,11 @@
23 ),
24 'state': fields.selection([
25 ('draft', 'Draft'),
26- ('open','Confirmed'),
27- ('cancel','Cancelled'),
28+ ('open', 'Confirmed'),
29+ ('cancel', 'Cancelled'),
30 ('sent', 'Sent'),
31 ('rejected', 'Rejected'),
32- ('done','Done'),
33+ ('done', 'Done'),
34 ], 'State', select=True
35 ),
36 'line_ids': fields.one2many(
37@@ -81,7 +81,7 @@
38 },
39 ),
40 'user_id': fields.many2one(
41- 'res.users','User', required=True,
42+ 'res.users', 'User', required=True,
43 states={
44 'sent': [('readonly', True)],
45 'rejected': [('readonly', True)],
46@@ -98,18 +98,19 @@
47 'rejected': [('readonly', True)],
48 'done': [('readonly', True)]
49 },
50- help=("Choose an option for the Payment Order:'Fixed' stands for a "
51- "date specified by you.'Directly' stands for the direct "
52+ help=("Choose an option for the Payment Order:'Fixed' stands for "
53+ "a date specified by you.'Directly' stands for the direct "
54 "execution.'Due date' stands for the scheduled date of "
55 "execution."
56- )
57+ )
58 ),
59 'date_sent': fields.date('Send date', readonly=True),
60 }
61
62 def _write_payment_lines(self, cr, uid, ids, **kwargs):
63 '''
64- ORM method for setting attributes of corresponding payment.line objects.
65+ ORM method for setting attributes of corresponding payment.line
66+ objects.
67 Note that while this is ORM compliant, it is also very ineffecient due
68 to the absence of filters on writes and hence the requirement to
69 filter on the client(=OpenERP server) side.
70@@ -143,7 +144,7 @@
71 cr, uid, ids, *args
72 )
73
74- def debit_reconcile_transfer(self, cr, uid, payment_order_id,
75+ def debit_reconcile_transfer(self, cr, uid, payment_order_id,
76 amount, currency, context=None):
77 """
78 During import of bank statements, create the reconcile on the transfer
79@@ -163,10 +164,10 @@
80 if line.account_id.type == 'other' and not line.reconcile_id:
81 line_ids.append(line.id)
82 if self.pool.get('res.currency').is_zero(
83- cr, uid, currency,
84- move_line_obj.get_balance(cr, uid, line_ids) - amount):
85+ cr, uid, currency,
86+ move_line_obj.get_balance(cr, uid, line_ids) - amount):
87 reconcile_id = self.pool.get('account.move.reconcile').create(
88- cr, uid,
89+ cr, uid,
90 {'type': 'auto', 'line_id': [(6, 0, line_ids)]},
91 context)
92 # set direct debit order to finished state
93@@ -175,8 +176,9 @@
94 uid, 'payment.order', payment_order_id, 'done', cr)
95 return reconcile_id
96
97- def debit_unreconcile_transfer(self, cr, uid, payment_order_id, reconcile_id,
98- amount, currency, context=None):
99+ def debit_unreconcile_transfer(
100+ self, cr, uid, payment_order_id, reconcile_id, amount, currency,
101+ context=None):
102 """
103 Due to a cancelled bank statements import, unreconcile the move on
104 the transfer account. Delegate the conditions to the workflow.
105@@ -194,12 +196,12 @@
106 if state != 'sent':
107 raise orm.except_orm(
108 _("Cannot unreconcile"),
109- _("Cannot unreconcile payment order: "+
110+ _("Cannot unreconcile payment order: "
111 "Workflow will not allow it."))
112 return True
113
114 def test_undo_done(self, cr, uid, ids, context=None):
115- """
116+ """
117 Called from the workflow. Used to unset done state on
118 payment orders that were reconciled with bank transfers
119 which are being cancelled.
120@@ -213,14 +215,72 @@
121 for order in self.browse(cr, uid, ids, context=context):
122 for order_line in order.line_ids:
123 if order_line.transit_move_line_id.move_id:
124- for line in order_line.transit_move_line_id.move_id.line_id:
125+ for line in \
126+ order_line.transit_move_line_id.move_id.line_id:
127 if (line.account_id.type == 'other' and
128 line.reconcile_id):
129 return False
130 return True
131-
132+
133+ def _prepare_transfer_move(
134+ self, cr, uid, order, line, labels, context=None):
135+ vals = {
136+ 'journal_id': order.mode.transfer_journal_id.id,
137+ 'name': '%s %s' % (labels[order.payment_order_type],
138+ line.move_line_id
139+ and line.move_line_id.move_id.name
140+ or line.communication),
141+ 'ref': '%s %s' % (order.payment_order_type[:3].upper(),
142+ line.move_line_id
143+ and line.move_line_id.move_id.name
144+ or line.communication),
145+ }
146+ return vals
147+
148+ def _prepare_move_line_transfer_account(
149+ self, cr, uid, order, line, move_id, labels, context=None):
150+ vals = {
151+ 'name': _('%s for %s') % (
152+ labels[order.payment_order_type],
153+ line.move_line_id and (line.move_line_id.invoice
154+ and line.move_line_id.invoice.number
155+ or line.move_line_id.name)
156+ or line.communication),
157+ 'move_id': move_id,
158+ 'partner_id': False,
159+ 'account_id': order.mode.transfer_account_id.id,
160+ 'credit': (order.payment_order_type == 'payment'
161+ and line.amount or 0.0),
162+ 'debit': (order.payment_order_type == 'debit'
163+ and line.amount or 0.0),
164+ 'date': fields.date.context_today(
165+ self, cr, uid, context=context),
166+ }
167+ return vals
168+
169+ def _update_move_line_partner_account(
170+ self, cr, uid, order, line, vals, context=None):
171+ vals.update({
172+ 'partner_id': line.partner_id.id,
173+ 'account_id': (line.move_line_id
174+ and line.move_line_id.account_id.id
175+ or False),
176+ # if not line.move_line_id, the field 'account_id' must be set by
177+ # another module that inherit this function, like for example in
178+ # the module purchase_payment_order
179+ 'credit': (order.payment_order_type == 'debit'
180+ and line.amount or 0.0),
181+ 'debit': (order.payment_order_type == 'payment'
182+ and line.amount or 0.0),
183+ })
184+ return vals
185+
186+ def action_sent_no_move_line_hook(self, cr, uid, pay_line, context=None):
187+ """This function is designed to be inherited"""
188+ return
189+
190 def action_sent(self, cr, uid, ids, context=None):
191- """
192+ """
193 Create the moves that pay off the move lines from
194 the debit order. This happens when the debit order file is
195 generated.
196@@ -233,63 +293,35 @@
197 'debit': _('Direct debit order'),
198 }
199 for order in self.browse(cr, uid, ids, context=context):
200- if not order.mode.transfer_journal_id or not order.mode.transfer_account_id:
201+ if not order.mode.transfer_journal_id \
202+ or not order.mode.transfer_account_id:
203 continue
204 for line in order.line_ids:
205 # basic checks
206- if not line.move_line_id:
207- raise orm.except_orm(
208- _('Error'),
209- _('No move line provided for line %s') % line.name)
210- if line.move_line_id.reconcile_id:
211- raise orm.except_orm(
212- _('Error'),
213- _('Move line %s has already been paid/reconciled') %
214- line.move_line_id.name
215- )
216+ if line.move_line_id and line.move_line_id.reconcile_id:
217+ raise orm.except_orm(
218+ _('Error'),
219+ _('Move line %s has already been paid/reconciled')
220+ % line.move_line_id.name)
221
222- move_id = account_move_obj.create(cr, uid, {
223- 'journal_id': order.mode.transfer_journal_id.id,
224- 'name': '%s %s' % (labels[order.payment_order_type],
225- line.move_line_id.move_id.name),
226- 'ref': '%s%s' % (order.payment_order_type[:3].upper(),
227- line.move_line_id.move_id.name),
228- }, context=context)
229+ move_id = account_move_obj.create(
230+ cr, uid, self._prepare_transfer_move(
231+ cr, uid, order, line, labels, context=context),
232+ context=context)
233
234 # TODO: take multicurrency into account
235-
236+
237 # create the debit move line on the transfer account
238- vals = {
239- 'name': _('%s for %s') % (
240- labels[order.payment_order_type],
241- line.move_line_id.invoice and
242- line.move_line_id.invoice.number or
243- line.move_line_id.name),
244- 'move_id': move_id,
245- 'partner_id': False,
246- 'account_id': order.mode.transfer_account_id.id,
247- 'credit': (order.payment_order_type == 'payment'
248- and line.amount or 0.0),
249- 'debit': (order.payment_order_type == 'debit'
250- and line.amount or 0.0),
251- 'date': fields.date.context_today(
252- self, cr, uid, context=context),
253- }
254- transfer_move_line_id = account_move_line_obj.create(
255- cr, uid, vals, context=context)
256+ ml_vals = self._prepare_move_line_transfer_account(
257+ cr, uid, order, line, move_id, labels, context=context)
258+ account_move_line_obj.create(cr, uid, ml_vals, context=context)
259
260- # create the debit move line on the receivable account
261- vals.update({
262- 'partner_id': line.partner_id.id,
263- 'account_id': line.move_line_id.account_id.id,
264- 'credit': (order.payment_order_type == 'debit'
265- and line.amount or 0.0),
266- 'debit': (order.payment_order_type == 'payment'
267- and line.amount or 0.0),
268- })
269+ # create the debit move line on the partner account
270+ self._update_move_line_partner_account(
271+ cr, uid, order, line, ml_vals, context=context)
272 reconcile_move_line_id = account_move_line_obj.create(
273- cr, uid, vals, context=context)
274-
275+ cr, uid, ml_vals, context=context)
276+
277 # register the debit move line on the payment line
278 # and call reconciliation on it
279 payment_line_obj.write(
280@@ -297,16 +329,18 @@
281 {'transit_move_line_id': reconcile_move_line_id},
282 context=context)
283
284- payment_line_obj.debit_reconcile(
285- cr, uid, line.id, context=context)
286+ if line.move_line_id:
287+ payment_line_obj.debit_reconcile(
288+ cr, uid, line.id, context=context)
289+ else:
290+ self.action_sent_no_move_line_hook(
291+ cr, uid, line, context=context)
292 account_move_obj.post(cr, uid, [move_id], context=context)
293
294 # State field is written by act_sent_wait
295 self.write(cr, uid, ids, {
296- 'date_sent': fields.date.context_today(
297- self, cr, uid, context=context),
298- }, context=context)
299+ 'date_sent': fields.date.context_today(
300+ self, cr, uid, context=context),
301+ }, context=context)
302
303 return True
304-
305-
306
307=== modified file 'account_banking_payment_export/demo/banking_demo.xml'
308--- account_banking_payment_export/demo/banking_demo.xml 2014-02-16 14:01:09 +0000
309+++ account_banking_payment_export/demo/banking_demo.xml 2014-06-23 09:47:35 +0000
310@@ -21,6 +21,15 @@
311 <field name="country" ref="base.fr"/>
312 </record>
313
314+<record id="bank_societe_generale" model="res.bank">
315+ <field name="name">Société Générale</field>
316+ <field name="bic">SOGEFRPPXXX</field>
317+ <field name="street">1 avenue du Roi Fabien 1er</field>
318+ <field name="zip">75008</field>
319+ <field name="city">Paris</field>
320+ <field name="country" ref="base.fr"/>
321+</record>
322+
323 <record id="main_company_iban" model="res.partner.bank">
324 <field name="acc_number">FR76 4242 4242 4242 4242 4242 424</field>
325 <field name="state">iban</field>
326@@ -30,6 +39,15 @@
327 <field name="bank_bic">PSSTFRPPXXX</field>
328 </record>
329
330+<record id="main_company_iban2" model="res.partner.bank">
331+ <field name="acc_number">FR20 1242 1242 1242 1242 1242 124</field>
332+ <field name="state">iban</field>
333+ <field name="bank" ref="bank_societe_generale"/>
334+ <field name="partner_id" ref="base.main_partner" />
335+ <field name="bank_name">Société Générale</field>
336+ <field name="bank_bic">SOGEFRPPXXX</field>
337+</record>
338+
339 <record id="res_partner_12_iban" model="res.partner.bank">
340 <field name="acc_number">FR66 1212 1212 1212 1212 1212 121</field>
341 <field name="state">iban</field>
342@@ -39,5 +57,22 @@
343 <field name="bank_bic">FTNOFRP1XXX</field>
344 </record>
345
346+<record id="payment_mode_2" model="payment.mode">
347+ <field name="name">Credit Trf Banque Postale</field>
348+ <field name="journal" ref="account.bank_journal"/>
349+ <field name="bank_id" ref="main_company_iban"/>
350+ <field name="company_id" ref="base.main_company"/>
351+ <field name="type" ref="account_banking_payment_export.manual_bank_tranfer"/>
352+</record>
353+
354+<record id="payment_mode_3" model="payment.mode">
355+ <field name="name">Credit Trf Société Générale</field>
356+ <field name="journal" ref="account.bank_journal"/>
357+ <field name="bank_id" ref="main_company_iban2"/>
358+ <field name="company_id" ref="base.main_company"/>
359+ <field name="type" ref="account_banking_payment_export.manual_bank_tranfer"/>
360+</record>
361+
362+
363 </data>
364 </openerp>
365
366=== modified file 'account_banking_payment_export/model/__init__.py'
367--- account_banking_payment_export/model/__init__.py 2014-02-16 14:03:28 +0000
368+++ account_banking_payment_export/model/__init__.py 2014-06-23 09:47:35 +0000
369@@ -1,3 +1,4 @@
370+# -*- coding: utf-8 -*-
371 from . import account_move_line
372 from . import account_payment
373 from . import bank_payment_manual
374
375=== modified file 'account_banking_payment_export/model/account_payment.py'
376--- account_banking_payment_export/model/account_payment.py 2014-02-16 16:13:15 +0000
377+++ account_banking_payment_export/model/account_payment.py 2014-06-23 09:47:35 +0000
378@@ -37,6 +37,9 @@
379 'Payment order type', required=True,
380 readonly=True, states={'draft': [('readonly', False)]},
381 ),
382+ 'mode_type': fields.related(
383+ 'mode', 'type', type='many2one', relation='payment.mode.type',
384+ string='Payment Type'),
385 }
386
387 _defaults = {
388
389=== modified file 'account_banking_payment_export/model/payment_mode.py'
390--- account_banking_payment_export/model/payment_mode.py 2014-02-16 16:13:15 +0000
391+++ account_banking_payment_export/model/payment_mode.py 2014-06-23 09:47:35 +0000
392@@ -53,4 +53,9 @@
393 'type', 'payment_order_type', readonly=True, type='selection',
394 selection=[('payment', 'Payment'), ('debit', 'Direct debit')],
395 string="Payment Order Type"),
396+ 'active': fields.boolean('Active'),
397+ }
398+
399+ _defaults = {
400+ 'active': True,
401 }
402
403=== modified file 'account_banking_payment_export/model/payment_mode_type.py'
404--- account_banking_payment_export/model/payment_mode_type.py 2014-02-16 16:13:15 +0000
405+++ account_banking_payment_export/model/payment_mode_type.py 2014-06-23 09:47:35 +0000
406@@ -53,10 +53,12 @@
407 [('payment', 'Payment'), ('debit', 'Direct debit')],
408 'Payment order type', required=True,
409 ),
410+ 'active': fields.boolean('Active'),
411 }
412
413 _defaults = {
414 'payment_order_type': 'payment',
415+ 'active': True,
416 }
417
418 def _auto_init(self, cr, context=None):
419
420=== modified file 'account_banking_payment_export/view/account_payment.xml'
421--- account_banking_payment_export/view/account_payment.xml 2013-08-09 20:55:49 +0000
422+++ account_banking_payment_export/view/account_payment.xml 2014-06-23 09:47:35 +0000
423@@ -9,12 +9,13 @@
424 <field name="inherit_id" ref="account_payment.view_payment_order_form" />
425 <field name="model">payment.order</field>
426 <field name="arch" type="xml">
427- <data>
428- <xpath expr="//button[@string='Make Payments']"
429- position="attributes">
430- <attribute name="name">launch_wizard</attribute>
431- </xpath>
432- </data>
433+ <xpath expr="//button[@string='Make Payments']"
434+ position="attributes">
435+ <attribute name="name">launch_wizard</attribute>
436+ </xpath>
437+ <field name="mode" position="after">
438+ <field name="mode_type" invisible="1"/>
439+ </field>
440 </field>
441 </record>
442
443
444=== modified file 'account_banking_payment_export/view/payment_mode.xml'
445--- account_banking_payment_export/view/payment_mode.xml 2013-08-13 09:18:15 +0000
446+++ account_banking_payment_export/view/payment_mode.xml 2014-06-23 09:47:35 +0000
447@@ -11,6 +11,7 @@
448 <field name="inherit_id" ref="account_payment.view_payment_mode_form"/>
449 <field name="arch" type="xml">
450 <field name="company_id" position="after">
451+ <field name="active"/>
452 <field name="type"/>
453 </field>
454 </field>
455
456=== modified file 'account_banking_payment_export/view/payment_mode_type.xml'
457--- account_banking_payment_export/view/payment_mode_type.xml 2013-09-12 07:32:00 +0000
458+++ account_banking_payment_export/view/payment_mode_type.xml 2014-06-23 09:47:35 +0000
459@@ -18,14 +18,42 @@
460 <field name="name">view.payment.mode.type.form</field>
461 <field name="model">payment.mode.type</field>
462 <field name="arch" type="xml">
463- <form string="Payment mode">
464- <field name="name" />
465- <field name="code" />
466- <field name="suitable_bank_types"/>
467+ <form string="Payment Type" version="7.0">
468+ <group name="main">
469+ <field name="name"/>
470+ <field name="code"/>
471+ <field name="active"/>
472+ <field name="ir_model_id"/>
473+ <field name="suitable_bank_types"/>
474+ </group>
475+ </form>
476+ </field>
477+ </record>
478+
479+ <record id="view_payment_mode_type_tree" model="ir.ui.view">
480+ <field name="name">view.payment.mode.type.tree</field>
481+ <field name="model">payment.mode.type</field>
482+ <field name="arch" type="xml">
483+ <tree string="Payment Types">
484+ <field name="name"/>
485+ <field name="code"/>
486+ <field name="active"/>
487 <field name="ir_model_id"/>
488- </form>
489+ </tree>
490 </field>
491 </record>
492
493+ <record id="action_payment_mode_type" model="ir.actions.act_window">
494+ <field name="name">Payment Type</field>
495+ <field name="res_model">payment.mode.type</field>
496+ <field name="view_type">form</field>
497+ <field name="view_mode">tree,form</field>
498+ <field name="context">{'active_test': False}</field>
499+ </record>
500+
501+ <menuitem id="menu_payment_mode_type"
502+ action="action_payment_mode_type"
503+ parent="account.menu_configuration_misc" />
504+
505 </data>
506 </openerp>
507
508=== modified file 'account_banking_sepa_credit_transfer/__openerp__.py'
509--- account_banking_sepa_credit_transfer/__openerp__.py 2014-02-16 14:01:09 +0000
510+++ account_banking_sepa_credit_transfer/__openerp__.py 2014-06-23 09:47:35 +0000
511@@ -1,3 +1,4 @@
512+# -*- encoding: utf-8 -*-
513 ##############################################################################
514 #
515 # SEPA Credit Transfer module for OpenERP
516
517=== modified file 'account_banking_sepa_credit_transfer/account_banking_sepa.py'
518--- account_banking_sepa_credit_transfer/account_banking_sepa.py 2013-12-24 00:01:04 +0000
519+++ account_banking_sepa_credit_transfer/account_banking_sepa.py 2014-06-23 09:47:35 +0000
520@@ -1,3 +1,4 @@
521+# -*- encoding: utf-8 -*-
522 ##############################################################################
523 #
524 # SEPA Credit Transfer module for OpenERP
525@@ -81,7 +82,6 @@
526 'state': fields.selection([
527 ('draft', 'Draft'),
528 ('sent', 'Sent'),
529- ('done', 'Reconciled'),
530 ], 'State', readonly=True),
531 }
532
533
534=== modified file 'account_banking_sepa_credit_transfer/account_banking_sepa_view.xml'
535--- account_banking_sepa_credit_transfer/account_banking_sepa_view.xml 2013-11-21 23:41:32 +0000
536+++ account_banking_sepa_credit_transfer/account_banking_sepa_view.xml 2014-06-23 09:47:35 +0000
537@@ -11,28 +11,24 @@
538 <field name="name">account.banking.export.sepa.form</field>
539 <field name="model">banking.export.sepa</field>
540 <field name="arch" type="xml">
541- <form string="SEPA Credit Transfer">
542+ <form string="SEPA Credit Transfer" version="7.0">
543+ <header>
544+ <field name="state" widget="statusbar"/>
545+ </header>
546 <notebook>
547 <page string="General Information">
548- <field name="total_amount" />
549- <field name="nb_transactions" />
550- <field name="batch_booking" />
551- <field name="charge_bearer"/>
552- <field name="create_date" />
553- <newline />
554- <field name="file" filename="filename"/>
555- <field name="filename" invisible="True"/>
556+ <group name="main">
557+ <field name="total_amount" />
558+ <field name="nb_transactions" />
559+ <field name="batch_booking" />
560+ <field name="charge_bearer"/>
561+ <field name="create_date" />
562+ <field name="file" filename="filename"/>
563+ <field name="filename" invisible="True"/>
564+ </group>
565 </page>
566 <page string="Payment Orders">
567- <field name="payment_order_ids" colspan="4" nolabel="1">
568- <tree colors="blue:state in ('draft');gray:state in ('cancel','done');black:state in ('open')" string="Payment Orders">
569- <field name="reference"/>
570- <field name="date_created"/>
571- <field name="date_done"/>
572- <field name="total"/>
573- <field name="state"/>
574- </tree>
575- </field>
576+ <field name="payment_order_ids" nolabel="1"/>
577 </page>
578 </notebook>
579 </form>
580@@ -48,6 +44,7 @@
581 <field name="filename"/>
582 <field name="create_date"/>
583 <field name="nb_transactions"/>
584+ <field name="state"/>
585 </tree>
586 </field>
587 </record>
588
589=== modified file 'account_banking_sepa_direct_debit/__openerp__.py'
590--- account_banking_sepa_direct_debit/__openerp__.py 2014-02-16 14:01:09 +0000
591+++ account_banking_sepa_direct_debit/__openerp__.py 2014-06-23 09:47:35 +0000
592@@ -1,3 +1,4 @@
593+# -*- encoding: utf-8 -*-
594 ##############################################################################
595 #
596 # SEPA Direct Debit module for OpenERP
597
598=== modified file 'account_banking_sepa_direct_debit/account_banking_sdd.py'
599--- account_banking_sepa_direct_debit/account_banking_sdd.py 2014-06-12 16:05:52 +0000
600+++ account_banking_sepa_direct_debit/account_banking_sdd.py 2014-06-23 09:47:35 +0000
601@@ -1,3 +1,4 @@
602+# -*- encoding: utf-8 -*-
603 ##############################################################################
604 #
605 # SEPA Direct Debit module for OpenERP
606@@ -89,7 +90,6 @@
607 'state': fields.selection([
608 ('draft', 'Draft'),
609 ('sent', 'Sent'),
610- ('done', 'Reconciled'),
611 ], 'State', readonly=True),
612 }
613
614
615=== modified file 'account_banking_sepa_direct_debit/account_banking_sdd_view.xml'
616--- account_banking_sepa_direct_debit/account_banking_sdd_view.xml 2013-12-12 22:19:53 +0000
617+++ account_banking_sepa_direct_debit/account_banking_sdd_view.xml 2014-06-23 09:47:35 +0000
618@@ -11,28 +11,24 @@
619 <field name="name">account.banking.export.sdd.form</field>
620 <field name="model">banking.export.sdd</field>
621 <field name="arch" type="xml">
622- <form string="SEPA Direct Debit">
623+ <form string="SEPA Direct Debit" version="7.0">
624+ <header>
625+ <field name="state" widget="statusbar"/>
626+ </header>
627 <notebook>
628 <page string="General Information">
629- <field name="total_amount" />
630- <field name="nb_transactions" />
631- <field name="batch_booking" />
632- <field name="charge_bearer"/>
633- <field name="create_date" />
634- <newline />
635- <field name="file" filename="filename"/>
636- <field name="filename" invisible="True"/>
637+ <group name="main">
638+ <field name="total_amount" />
639+ <field name="nb_transactions" />
640+ <field name="batch_booking" />
641+ <field name="charge_bearer"/>
642+ <field name="create_date" />
643+ <field name="file" filename="filename"/>
644+ <field name="filename" invisible="True"/>
645+ </group>
646 </page>
647 <page string="Payment Orders">
648- <field name="payment_order_ids" colspan="4" nolabel="1">
649- <tree colors="blue:state in ('draft');gray:state in ('cancel','done');black:state in ('open')" string="Payment Orders">
650- <field name="reference"/>
651- <field name="date_created"/>
652- <field name="date_done"/>
653- <field name="total"/>
654- <field name="state"/>
655- </tree>
656- </field>
657+ <field name="payment_order_ids" nolabel="1"/>
658 </page>
659 </notebook>
660 </form>
661@@ -48,6 +44,7 @@
662 <field name="filename"/>
663 <field name="create_date"/>
664 <field name="nb_transactions"/>
665+ <field name="state"/>
666 </tree>
667 </field>
668 </record>
669
670=== modified file 'account_banking_sepa_direct_debit/company.py'
671--- account_banking_sepa_direct_debit/company.py 2013-12-24 00:01:04 +0000
672+++ account_banking_sepa_direct_debit/company.py 2014-06-23 09:47:35 +0000
673@@ -1,3 +1,4 @@
674+# -*- encoding: utf-8 -*-
675 ##############################################################################
676 #
677 # SEPA Direct Debit module for OpenERP
678
679=== added directory 'account_payment_partner'
680=== added file 'account_payment_partner/__init__.py'
681--- account_payment_partner/__init__.py 1970-01-01 00:00:00 +0000
682+++ account_payment_partner/__init__.py 2014-06-23 09:47:35 +0000
683@@ -0,0 +1,23 @@
684+# -*- encoding: utf-8 -*-
685+##############################################################################
686+#
687+# Account Payment Partner module for OpenERP
688+# Copyright (C) 2014 Akretion (http://www.akretion.com)
689+# @author Alexis de Lattre <alexis.delattre@akretion.com>
690+#
691+# This program is free software: you can redistribute it and/or modify
692+# it under the terms of the GNU Affero General Public License as
693+# published by the Free Software Foundation, either version 3 of the
694+# License, or (at your option) any later version.
695+#
696+# This program is distributed in the hope that it will be useful,
697+# but WITHOUT ANY WARRANTY; without even the implied warranty of
698+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
699+# GNU Affero General Public License for more details.
700+#
701+# You should have received a copy of the GNU Affero General Public License
702+# along with this program. If not, see <http://www.gnu.org/licenses/>.
703+#
704+##############################################################################
705+
706+from . import model
707
708=== added file 'account_payment_partner/__openerp__.py'
709--- account_payment_partner/__openerp__.py 1970-01-01 00:00:00 +0000
710+++ account_payment_partner/__openerp__.py 2014-06-23 09:47:35 +0000
711@@ -0,0 +1,55 @@
712+# -*- encoding: utf-8 -*-
713+##############################################################################
714+#
715+# Account Payment Partner module for OpenERP
716+# Copyright (C) 2014 Akretion (http://www.akretion.com)
717+# @author Alexis de Lattre <alexis.delattre@akretion.com>
718+#
719+# This program is free software: you can redistribute it and/or modify
720+# it under the terms of the GNU Affero General Public License as
721+# published by the Free Software Foundation, either version 3 of the
722+# License, or (at your option) any later version.
723+#
724+# This program is distributed in the hope that it will be useful,
725+# but WITHOUT ANY WARRANTY; without even the implied warranty of
726+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
727+# GNU Affero General Public License for more details.
728+#
729+# You should have received a copy of the GNU Affero General Public License
730+# along with this program. If not, see <http://www.gnu.org/licenses/>.
731+#
732+##############################################################################
733+
734+
735+{
736+ 'name': 'Account Payment Partner',
737+ 'version': '0.1',
738+ 'category': 'Banking addons',
739+ 'license': 'AGPL-3',
740+ 'summary': 'Adds payment mode on partners and invoices',
741+ 'description': """
742+Account Payment Partner
743+=======================
744+
745+This module adds severals fields :
746+
747+* the *Supplier Payment Mode* and *Customer Payment Mode* on Partners,
748+
749+* the *Payment Mode* on Invoices.
750+
751+On a Payment Order, in the wizard *Select Invoices to Pay*, the invoices will
752+be filtered per Payment Mode.
753+
754+Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com>
755+for any help or question about this module.
756+ """,
757+ 'author': 'Akretion',
758+ 'website': 'http://www.akretion.com',
759+ 'depends': ['account_banking_payment_export'],
760+ 'data': [
761+ 'view/partner.xml',
762+ 'view/account_invoice.xml',
763+ ],
764+ 'demo': ['demo/partner_demo.xml'],
765+ 'active': False,
766+}
767
768=== added directory 'account_payment_partner/demo'
769=== added file 'account_payment_partner/demo/partner_demo.xml'
770--- account_payment_partner/demo/partner_demo.xml 1970-01-01 00:00:00 +0000
771+++ account_payment_partner/demo/partner_demo.xml 2014-06-23 09:47:35 +0000
772@@ -0,0 +1,51 @@
773+<?xml version="1.0" encoding="utf-8"?>
774+
775+<openerp>
776+<data noupdate="1">
777+
778+<!-- Camptocamp -->
779+<record id="supplier_payment_mode_12" model="ir.property" forcecreate="True">
780+ <field name="name">supplier_payment_mode_12</field>
781+ <field name="fields_id"
782+ search="[('model','=','res.partner'),('name','=','supplier_payment_mode')]"/>
783+ <field name="value"
784+ eval="'payment.mode,'+str(ref('account_banking_payment_export.payment_mode_2'))"/>
785+ <field name="company_id" ref="base.main_company"/>
786+ <field name="res_id" ref="base.res_partner_12"/>
787+</record>
788+
789+<record id="customer_payment_mode_12" model="ir.property" forcecreate="True">
790+ <field name="name">customer_payment_mode_12</field>
791+ <field name="fields_id"
792+ search="[('model','=','res.partner'),('name','=','customer_payment_mode')]"/>
793+ <field name="value"
794+ eval="'payment.mode,'+str(ref('account_banking_payment_export.payment_mode_2'))"/>
795+ <field name="company_id" ref="base.main_company"/>
796+ <field name="res_id" ref="base.res_partner_12"/>
797+</record>
798+
799+<!-- Agrolait -->
800+<record id="customer_payment_mode_2" model="ir.property" forcecreate="True">
801+ <field name="name">customer_payment_mode_2</field>
802+ <field name="fields_id"
803+ search="[('model','=','res.partner'),('name','=','customer_payment_mode')]"/>
804+ <field name="value"
805+ eval="'payment.mode,'+str(ref('account_banking_payment_export.payment_mode_3'))"/>
806+ <field name="company_id" ref="base.main_company"/>
807+ <field name="res_id" ref="base.res_partner_2"/>
808+</record>
809+
810+<!-- Asustek -->
811+<record id="supplier_payment_mode_1" model="ir.property" forcecreate="True">
812+ <field name="name">supplier_payment_mode_1</field>
813+ <field name="fields_id"
814+ search="[('model','=','res.partner'),('name','=','supplier_payment_mode')]"/>
815+ <field name="value"
816+ eval="'payment.mode,'+str(ref('account_banking_payment_export.payment_mode_2'))"/>
817+ <field name="company_id" ref="base.main_company"/>
818+ <field name="res_id" ref="base.res_partner_1"/>
819+</record>
820+
821+
822+</data>
823+</openerp>
824
825=== added directory 'account_payment_partner/i18n'
826=== added file 'account_payment_partner/i18n/account_payment_partner.pot'
827--- account_payment_partner/i18n/account_payment_partner.pot 1970-01-01 00:00:00 +0000
828+++ account_payment_partner/i18n/account_payment_partner.pot 2014-06-23 09:47:35 +0000
829@@ -0,0 +1,57 @@
830+# Translation of OpenERP Server.
831+# This file contains the translation of the following modules:
832+# * account_payment_partner
833+#
834+msgid ""
835+msgstr ""
836+"Project-Id-Version: OpenERP Server 7.0\n"
837+"Report-Msgid-Bugs-To: \n"
838+"POT-Creation-Date: 2014-06-09 23:22+0000\n"
839+"PO-Revision-Date: 2014-06-09 23:22+0000\n"
840+"Last-Translator: <>\n"
841+"Language-Team: \n"
842+"MIME-Version: 1.0\n"
843+"Content-Type: text/plain; charset=UTF-8\n"
844+"Content-Transfer-Encoding: \n"
845+"Plural-Forms: \n"
846+
847+#. module: account_payment_partner
848+#: field:res.partner,customer_payment_mode:0
849+msgid "Customer Payment Mode"
850+msgstr ""
851+
852+#. module: account_payment_partner
853+#: model:ir.model,name:account_payment_partner.model_account_invoice
854+msgid "Invoice"
855+msgstr ""
856+
857+#. module: account_payment_partner
858+#: model:ir.model,name:account_payment_partner.model_res_partner
859+msgid "Partner"
860+msgstr ""
861+
862+#. module: account_payment_partner
863+#: field:account.invoice,payment_mode_id:0
864+msgid "Payment Mode"
865+msgstr ""
866+
867+#. module: account_payment_partner
868+#: help:res.partner,customer_payment_mode:0
869+msgid "Select the default payment mode for this customer."
870+msgstr ""
871+
872+#. module: account_payment_partner
873+#: help:res.partner,supplier_payment_mode:0
874+msgid "Select the default payment mode for this supplier."
875+msgstr ""
876+
877+#. module: account_payment_partner
878+#: field:res.partner,supplier_payment_mode:0
879+msgid "Supplier Payment Mode"
880+msgstr ""
881+
882+#. module: account_payment_partner
883+#: model:ir.model,name:account_payment_partner.model_payment_order_create
884+msgid "payment.order.create"
885+msgstr ""
886+
887
888=== added directory 'account_payment_partner/model'
889=== added file 'account_payment_partner/model/__init__.py'
890--- account_payment_partner/model/__init__.py 1970-01-01 00:00:00 +0000
891+++ account_payment_partner/model/__init__.py 2014-06-23 09:47:35 +0000
892@@ -0,0 +1,25 @@
893+# -*- encoding: utf-8 -*-
894+##############################################################################
895+#
896+# Account Payment Partner module for OpenERP
897+# Copyright (C) 2014 Akretion (http://www.akretion.com)
898+# @author Alexis de Lattre <alexis.delattre@akretion.com>
899+#
900+# This program is free software: you can redistribute it and/or modify
901+# it under the terms of the GNU Affero General Public License as
902+# published by the Free Software Foundation, either version 3 of the
903+# License, or (at your option) any later version.
904+#
905+# This program is distributed in the hope that it will be useful,
906+# but WITHOUT ANY WARRANTY; without even the implied warranty of
907+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
908+# GNU Affero General Public License for more details.
909+#
910+# You should have received a copy of the GNU Affero General Public License
911+# along with this program. If not, see <http://www.gnu.org/licenses/>.
912+#
913+##############################################################################
914+
915+from . import partner
916+from . import account_invoice
917+from . import payment_order_create
918
919=== added file 'account_payment_partner/model/account_invoice.py'
920--- account_payment_partner/model/account_invoice.py 1970-01-01 00:00:00 +0000
921+++ account_payment_partner/model/account_invoice.py 2014-06-23 09:47:35 +0000
922@@ -0,0 +1,56 @@
923+# -*- encoding: utf-8 -*-
924+##############################################################################
925+#
926+# Account Payment Partner module for OpenERP
927+# Copyright (C) 2014 Akretion (http://www.akretion.com)
928+# @author Alexis de Lattre <alexis.delattre@akretion.com>
929+#
930+# This program is free software: you can redistribute it and/or modify
931+# it under the terms of the GNU Affero General Public License as
932+# published by the Free Software Foundation, either version 3 of the
933+# License, or (at your option) any later version.
934+#
935+# This program is distributed in the hope that it will be useful,
936+# but WITHOUT ANY WARRANTY; without even the implied warranty of
937+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
938+# GNU Affero General Public License for more details.
939+#
940+# You should have received a copy of the GNU Affero General Public License
941+# along with this program. If not, see <http://www.gnu.org/licenses/>.
942+#
943+##############################################################################
944+
945+from openerp.osv import orm, fields
946+
947+
948+class account_invoice(orm.Model):
949+ _inherit = 'account.invoice'
950+
951+ _columns = {
952+ 'payment_mode_id': fields.many2one(
953+ 'payment.mode', 'Payment Mode'),
954+ }
955+
956+ def onchange_partner_id(
957+ self, cr, uid, ids, type, partner_id, date_invoice=False,
958+ payment_term=False, partner_bank_id=False, company_id=False):
959+ res = super(account_invoice, self).onchange_partner_id(
960+ cr, uid, ids, type, partner_id, date_invoice=date_invoice,
961+ payment_term=payment_term, partner_bank_id=partner_bank_id,
962+ company_id=company_id)
963+ if partner_id:
964+ partner = self.pool['res.partner'].browse(cr, uid, partner_id)
965+ if type == 'in_invoice':
966+ res['value']['payment_mode_id'] = \
967+ partner.supplier_payment_mode.id or False
968+ elif type == 'out_invoice':
969+ res['value'].update({
970+ 'payment_mode_id':
971+ partner.customer_payment_mode.id or False,
972+ 'partner_bank_id':
973+ partner.customer_payment_mode and
974+ partner.customer_payment_mode.bank_id.id or False,
975+ })
976+ else:
977+ res['value']['payment_mode_id'] = False
978+ return res
979
980=== added file 'account_payment_partner/model/partner.py'
981--- account_payment_partner/model/partner.py 1970-01-01 00:00:00 +0000
982+++ account_payment_partner/model/partner.py 2014-06-23 09:47:35 +0000
983@@ -0,0 +1,44 @@
984+# -*- encoding: utf-8 -*-
985+##############################################################################
986+#
987+# Account Payment Partner module for OpenERP
988+# Copyright (C) 2014 Akretion (http://www.akretion.com)
989+# @author Alexis de Lattre <alexis.delattre@akretion.com>
990+#
991+# This program is free software: you can redistribute it and/or modify
992+# it under the terms of the GNU Affero General Public License as
993+# published by the Free Software Foundation, either version 3 of the
994+# License, or (at your option) any later version.
995+#
996+# This program is distributed in the hope that it will be useful,
997+# but WITHOUT ANY WARRANTY; without even the implied warranty of
998+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
999+# GNU Affero General Public License for more details.
1000+#
1001+# You should have received a copy of the GNU Affero General Public License
1002+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1003+#
1004+##############################################################################
1005+
1006+from openerp.osv import orm, fields
1007+
1008+
1009+class res_partner(orm.Model):
1010+ _inherit = 'res.partner'
1011+
1012+ _columns = {
1013+ 'supplier_payment_mode': fields.property(
1014+ 'payment.mode', type='many2one', relation='payment.mode',
1015+ string='Supplier Payment Mode', view_load=True,
1016+ help="Select the default payment mode for this supplier."),
1017+ 'customer_payment_mode': fields.property(
1018+ 'payment.mode', type='many2one', relation='payment.mode',
1019+ string='Customer Payment Mode', view_load=True,
1020+ help="Select the default payment mode for this customer."),
1021+ }
1022+
1023+ def _commercial_fields(self, cr, uid, context=None):
1024+ res = super(res_partner, self)._commercial_fields(
1025+ cr, uid, context=context)
1026+ res += ['supplier_payment_mode', 'customer_payment_mode']
1027+ return res
1028
1029=== added file 'account_payment_partner/model/payment_order_create.py'
1030--- account_payment_partner/model/payment_order_create.py 1970-01-01 00:00:00 +0000
1031+++ account_payment_partner/model/payment_order_create.py 2014-06-23 09:47:35 +0000
1032@@ -0,0 +1,39 @@
1033+# -*- encoding: utf-8 -*-
1034+##############################################################################
1035+#
1036+# Account Payment Partner module for OpenERP
1037+# Copyright (C) 2014 Akretion (http://www.akretion.com)
1038+# @author Alexis de Lattre <alexis.delattre@akretion.com>
1039+#
1040+# This program is free software: you can redistribute it and/or modify
1041+# it under the terms of the GNU Affero General Public License as
1042+# published by the Free Software Foundation, either version 3 of the
1043+# License, or (at your option) any later version.
1044+#
1045+# This program is distributed in the hope that it will be useful,
1046+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1047+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1048+# GNU Affero General Public License for more details.
1049+#
1050+# You should have received a copy of the GNU Affero General Public License
1051+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1052+#
1053+##############################################################################
1054+
1055+from openerp.osv import orm
1056+
1057+
1058+class payment_order_create(orm.TransientModel):
1059+ _inherit = 'payment.order.create'
1060+
1061+ def extend_payment_order_domain(
1062+ self, cr, uid, payment_order, domain, context=None):
1063+ super(payment_order_create, self).extend_payment_order_domain(
1064+ cr, uid, payment_order, domain, context=context)
1065+ domain += [
1066+ '|', '|',
1067+ ('invoice', '=', False),
1068+ ('invoice.payment_mode_id', '=', False),
1069+ ('invoice.payment_mode_id', '=', payment_order.mode.id)
1070+ ]
1071+ return True
1072
1073=== added directory 'account_payment_partner/view'
1074=== added file 'account_payment_partner/view/account_invoice.xml'
1075--- account_payment_partner/view/account_invoice.xml 1970-01-01 00:00:00 +0000
1076+++ account_payment_partner/view/account_invoice.xml 2014-06-23 09:47:35 +0000
1077@@ -0,0 +1,38 @@
1078+<?xml version="1.0" encoding="utf-8"?>
1079+
1080+<!--
1081+ Copyright (C) 2014 Akretion (http://www.akretion.com/)
1082+ @author Alexis de Lattre <alexis.delattre@akretion.com>
1083+ The licence is in the file __openerp__.py
1084+-->
1085+
1086+<openerp>
1087+<data>
1088+
1089+
1090+<record id="invoice_form" model="ir.ui.view">
1091+ <field name="name">account_payment_partner.invoice_form</field>
1092+ <field name="model">account.invoice</field>
1093+ <field name="inherit_id" ref="account.invoice_form" />
1094+ <field name="arch" type="xml">
1095+ <field name="partner_bank_id" position="after">
1096+ <field name="payment_mode_id"/>
1097+ </field>
1098+ </field>
1099+</record>
1100+
1101+
1102+<record id="invoice_supplier_form" model="ir.ui.view">
1103+ <field name="name">account_payment_partner.invoice_supplier_form</field>
1104+ <field name="model">account.invoice</field>
1105+ <field name="inherit_id" ref="account.invoice_supplier_form" />
1106+ <field name="arch" type="xml">
1107+ <field name="partner_bank_id" position="after">
1108+ <field name="payment_mode_id"/>
1109+ </field>
1110+ </field>
1111+</record>
1112+
1113+
1114+</data>
1115+</openerp>
1116
1117=== added file 'account_payment_partner/view/partner.xml'
1118--- account_payment_partner/view/partner.xml 1970-01-01 00:00:00 +0000
1119+++ account_payment_partner/view/partner.xml 2014-06-23 09:47:35 +0000
1120@@ -0,0 +1,31 @@
1121+<?xml version="1.0" encoding="utf-8"?>
1122+
1123+<!--
1124+ Copyright (C) 2014 Akretion (http://www.akretion.com/)
1125+ @author Alexis de Lattre <alexis.delattre@akretion.com>
1126+ The licence is in the file __openerp__.py
1127+-->
1128+
1129+<openerp>
1130+<data>
1131+
1132+
1133+<record id="view_partner_property_form" model="ir.ui.view">
1134+ <field name="name">account_partner_payment.partner_form</field>
1135+ <field name="model">res.partner</field>
1136+ <field name="inherit_id" ref="account.view_partner_property_form" />
1137+ <field name="arch" type="xml">
1138+ <field name="property_payment_term" position="after">
1139+ <field name="customer_payment_mode"
1140+ attrs="{'invisible': [('customer', '=', False)]}"/>
1141+ </field>
1142+ <field name="property_supplier_payment_term" position="after">
1143+ <field name="supplier_payment_mode"
1144+ attrs="{'invisible': [('supplier', '=', False)]}"/>
1145+ </field>
1146+ </field>
1147+</record>
1148+
1149+
1150+</data>
1151+</openerp>
1152
1153=== added directory 'account_payment_purchase'
1154=== added file 'account_payment_purchase/__init__.py'
1155--- account_payment_purchase/__init__.py 1970-01-01 00:00:00 +0000
1156+++ account_payment_purchase/__init__.py 2014-06-23 09:47:35 +0000
1157@@ -0,0 +1,23 @@
1158+# -*- encoding: utf-8 -*-
1159+##############################################################################
1160+#
1161+# Account Payment Purchase module for OpenERP
1162+# Copyright (C) 2014 Akretion (http://www.akretion.com)
1163+# @author Alexis de Lattre <alexis.delattre@akretion.com>
1164+#
1165+# This program is free software: you can redistribute it and/or modify
1166+# it under the terms of the GNU Affero General Public License as
1167+# published by the Free Software Foundation, either version 3 of the
1168+# License, or (at your option) any later version.
1169+#
1170+# This program is distributed in the hope that it will be useful,
1171+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1172+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1173+# GNU Affero General Public License for more details.
1174+#
1175+# You should have received a copy of the GNU Affero General Public License
1176+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1177+#
1178+##############################################################################
1179+
1180+from . import model
1181
1182=== added file 'account_payment_purchase/__openerp__.py'
1183--- account_payment_purchase/__openerp__.py 1970-01-01 00:00:00 +0000
1184+++ account_payment_purchase/__openerp__.py 2014-06-23 09:47:35 +0000
1185@@ -0,0 +1,55 @@
1186+# -*- encoding: utf-8 -*-
1187+##############################################################################
1188+#
1189+# Account Payment Purchase module for OpenERP
1190+# Copyright (C) 2014 Akretion (http://www.akretion.com).
1191+# @author Alexis de Lattre <alexis.delattre@akretion.com>
1192+#
1193+# This program is free software: you can redistribute it and/or modify
1194+# it under the terms of the GNU Affero General Public License as
1195+# published by the Free Software Foundation, either version 3 of the
1196+# License, or (at your option) any later version.
1197+#
1198+# This program is distributed in the hope that it will be useful,
1199+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1200+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1201+# GNU Affero General Public License for more details.
1202+#
1203+# You should have received a copy of the GNU Affero General Public License
1204+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1205+#
1206+##############################################################################
1207+
1208+{
1209+ 'name': 'Account Payment Purchase',
1210+ 'version': '1.0',
1211+ 'category': 'Banking addons',
1212+ 'license': 'AGPL-3',
1213+ 'summary': "Adds Bank Account and Payment Mode on Purchase Orders",
1214+ 'description': """
1215+Account Payment Purchase
1216+========================
1217+
1218+This modules adds 2 fields on purchase orders : *Bank Account* and *Payment
1219+Mode*. These fields are copied from partner to purchase order and then from
1220+purchase order to supplier invoice.
1221+
1222+This module is similar to the *purchase_payment* module ; the main difference
1223+is that it doesn't depend on the *account_payment_extension* module (it's not
1224+the only module to conflict with *account_payment_extension* ; all the SEPA
1225+modules in the banking addons conflict with *account_payment_extension*, cf
1226+banking-addons-70/account_banking_payment_export/__openerp__.py).
1227+
1228+Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com>
1229+for any help or question about this module.
1230+ """,
1231+ 'author': 'Akretion',
1232+ 'website': 'http://www.akretion.com',
1233+ 'depends': ['purchase', 'account_payment_partner'],
1234+ 'conflicts': ['purchase_payment'],
1235+ 'data': [
1236+ 'view/purchase.xml',
1237+ ],
1238+ 'installable': True,
1239+ 'active': False,
1240+}
1241
1242=== added directory 'account_payment_purchase/i18n'
1243=== added file 'account_payment_purchase/i18n/account_payment_purchase.pot'
1244--- account_payment_purchase/i18n/account_payment_purchase.pot 1970-01-01 00:00:00 +0000
1245+++ account_payment_purchase/i18n/account_payment_purchase.pot 2014-06-23 09:47:35 +0000
1246@@ -0,0 +1,42 @@
1247+# Translation of OpenERP Server.
1248+# This file contains the translation of the following modules:
1249+# * account_payment_purchase
1250+#
1251+msgid ""
1252+msgstr ""
1253+"Project-Id-Version: OpenERP Server 7.0\n"
1254+"Report-Msgid-Bugs-To: \n"
1255+"POT-Creation-Date: 2014-06-09 23:23+0000\n"
1256+"PO-Revision-Date: 2014-06-09 23:23+0000\n"
1257+"Last-Translator: <>\n"
1258+"Language-Team: \n"
1259+"MIME-Version: 1.0\n"
1260+"Content-Type: text/plain; charset=UTF-8\n"
1261+"Content-Transfer-Encoding: \n"
1262+"Plural-Forms: \n"
1263+
1264+#. module: account_payment_purchase
1265+#: field:purchase.order,payment_mode_id:0
1266+msgid "Payment Mode"
1267+msgstr ""
1268+
1269+#. module: account_payment_purchase
1270+#: model:ir.model,name:account_payment_purchase.model_stock_picking
1271+msgid "Picking List"
1272+msgstr ""
1273+
1274+#. module: account_payment_purchase
1275+#: model:ir.model,name:account_payment_purchase.model_purchase_order
1276+msgid "Purchase Order"
1277+msgstr ""
1278+
1279+#. module: account_payment_purchase
1280+#: help:purchase.order,supplier_partner_bank_id:0
1281+msgid "Select the bank account of your supplier on which your company should send the payment. This field is copied from the partner and will be copied to the supplier invoice."
1282+msgstr ""
1283+
1284+#. module: account_payment_purchase
1285+#: field:purchase.order,supplier_partner_bank_id:0
1286+msgid "Supplier Bank Account"
1287+msgstr ""
1288+
1289
1290=== added file 'account_payment_purchase/i18n/fr.po'
1291--- account_payment_purchase/i18n/fr.po 1970-01-01 00:00:00 +0000
1292+++ account_payment_purchase/i18n/fr.po 2014-06-23 09:47:35 +0000
1293@@ -0,0 +1,42 @@
1294+# Translation of OpenERP Server.
1295+# This file contains the translation of the following modules:
1296+# * account_payment_purchase
1297+#
1298+msgid ""
1299+msgstr ""
1300+"Project-Id-Version: OpenERP Server 7.0\n"
1301+"Report-Msgid-Bugs-To: \n"
1302+"POT-Creation-Date: 2014-02-24 23:09+0000\n"
1303+"PO-Revision-Date: 2014-02-24 23:09+0000\n"
1304+"Last-Translator: Alexis de Lattre <alexis.delattre@akretion.com>\n"
1305+"Language-Team: \n"
1306+"MIME-Version: 1.0\n"
1307+"Content-Type: text/plain; charset=UTF-8\n"
1308+"Content-Transfer-Encoding: \n"
1309+"Plural-Forms: \n"
1310+
1311+#. module: account_payment_purchase
1312+#: field:purchase.order,payment_mode_type:0
1313+msgid "Payment Type"
1314+msgstr "Type de Paiement"
1315+
1316+#. module: account_payment_purchase
1317+#: model:ir.model,name:account_payment_purchase.model_purchase_order
1318+msgid "Purchase Order"
1319+msgstr "Bon de commande"
1320+
1321+#. module: account_payment_purchase
1322+#: help:purchase.order,supplier_partner_bank:0
1323+msgid "Select the bank account of your supplier on which your company should send the payment. This field is copied from the partner and will be copied to the supplier invoice."
1324+msgstr "Selectionnez le compte bancaire du fournisseur sur lequel votre société devra effectuer le règlement. Ce champ est copié depuis le partenaire et sera recopié sur la facture fournisseur."
1325+
1326+#. module: account_payment_purchase
1327+#: field:purchase.order,supplier_partner_bank:0
1328+msgid "Supplier Bank Account"
1329+msgstr "Compte bancaire du fournisseur"
1330+
1331+#. module: account_payment_purchase
1332+#: model:ir.model,name:account_payment_purchase.model_stock_picking
1333+msgid "Picking List"
1334+msgstr "Bon de livraison"
1335+
1336
1337=== added directory 'account_payment_purchase/model'
1338=== added file 'account_payment_purchase/model/__init__.py'
1339--- account_payment_purchase/model/__init__.py 1970-01-01 00:00:00 +0000
1340+++ account_payment_purchase/model/__init__.py 2014-06-23 09:47:35 +0000
1341@@ -0,0 +1,24 @@
1342+# -*- encoding: utf-8 -*-
1343+##############################################################################
1344+#
1345+# Account Payment Purchase module for OpenERP
1346+# Copyright (C) 2014 Akretion (http://www.akretion.com)
1347+# @author Alexis de Lattre <alexis.delattre@akretion.com>
1348+#
1349+# This program is free software: you can redistribute it and/or modify
1350+# it under the terms of the GNU Affero General Public License as
1351+# published by the Free Software Foundation, either version 3 of the
1352+# License, or (at your option) any later version.
1353+#
1354+# This program is distributed in the hope that it will be useful,
1355+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1356+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1357+# GNU Affero General Public License for more details.
1358+#
1359+# You should have received a copy of the GNU Affero General Public License
1360+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1361+#
1362+##############################################################################
1363+
1364+from . import purchase
1365+from . import stock
1366
1367=== added file 'account_payment_purchase/model/purchase.py'
1368--- account_payment_purchase/model/purchase.py 1970-01-01 00:00:00 +0000
1369+++ account_payment_purchase/model/purchase.py 2014-06-23 09:47:35 +0000
1370@@ -0,0 +1,82 @@
1371+# -*- encoding: utf-8 -*-
1372+##############################################################################
1373+#
1374+# Account Payment Purchase module for OpenERP
1375+# Copyright (C) 2014 Akretion (http://www.akretion.com)
1376+# @author Alexis de Lattre <alexis.delattre@akretion.com>
1377+#
1378+# This program is free software: you can redistribute it and/or modify
1379+# it under the terms of the GNU Affero General Public License as
1380+# published by the Free Software Foundation, either version 3 of the
1381+# License, or (at your option) any later version.
1382+#
1383+# This program is distributed in the hope that it will be useful,
1384+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1385+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1386+# GNU Affero General Public License for more details.
1387+#
1388+# You should have received a copy of the GNU Affero General Public License
1389+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1390+#
1391+##############################################################################
1392+
1393+from openerp.osv import orm, fields
1394+
1395+
1396+class purchase_order(orm.Model):
1397+ _inherit = "purchase.order"
1398+
1399+ _columns = {
1400+ 'supplier_partner_bank_id': fields.many2one(
1401+ 'res.partner.bank', 'Supplier Bank Account',
1402+ help="Select the bank account of your supplier on which "
1403+ "your company should send the payment. This field is copied "
1404+ "from the partner and will be copied to the supplier invoice."),
1405+ 'payment_mode_id': fields.many2one(
1406+ 'payment.mode', 'Payment Mode'),
1407+ }
1408+
1409+ def _get_default_supplier_partner_bank(
1410+ self, cr, uid, partner, context=None):
1411+ '''This function is designed to be inherited'''
1412+ if partner.bank_ids:
1413+ return partner.bank_ids[0].id
1414+ else:
1415+ return False
1416+
1417+ def onchange_partner_id(self, cr, uid, ids, partner_id):
1418+ res = super(purchase_order, self).onchange_partner_id(
1419+ cr, uid, ids, partner_id)
1420+ if partner_id:
1421+ partner = self.pool['res.partner'].browse(
1422+ cr, uid, partner_id)
1423+ res['value'].update({
1424+ 'supplier_partner_bank_id':
1425+ self._get_default_supplier_partner_bank(
1426+ cr, uid, partner),
1427+ 'payment_mode_id':
1428+ partner.supplier_payment_mode.id or False,
1429+ })
1430+ else:
1431+ res['value'].update({
1432+ 'supplier_partner_bank_id': False,
1433+ 'payment_mode_id': False,
1434+ })
1435+ return res
1436+
1437+ def action_invoice_create(self, cr, uid, ids, context=None):
1438+ """Copy bank partner + payment type from PO to invoice"""
1439+ # as of OpenERP 7.0, there is no _prepare function for
1440+ # the invoice (the _prepare function only exists for invoice lines)
1441+ res = super(purchase_order, self).action_invoice_create(
1442+ cr, uid, ids, context=context)
1443+ for order in self.browse(cr, uid, ids, context=context):
1444+ for invoice in order.invoice_ids:
1445+ if invoice.state == 'draft':
1446+ invoice.write({
1447+ 'partner_bank_id':
1448+ order.supplier_partner_bank_id.id or False,
1449+ 'payment_mode_id':
1450+ order.payment_mode_id.id or False,
1451+ }, context=context)
1452+ return res
1453
1454=== added file 'account_payment_purchase/model/stock.py'
1455--- account_payment_purchase/model/stock.py 1970-01-01 00:00:00 +0000
1456+++ account_payment_purchase/model/stock.py 2014-06-23 09:47:35 +0000
1457@@ -0,0 +1,42 @@
1458+# -*- encoding: utf-8 -*-
1459+##############################################################################
1460+#
1461+# Account Payment Purchase module for OpenERP
1462+# Copyright (C) 2014 Akretion (http://www.akretion.com)
1463+# @author Alexis de Lattre <alexis.delattre@akretion.com>
1464+#
1465+# This program is free software: you can redistribute it and/or modify
1466+# it under the terms of the GNU Affero General Public License as
1467+# published by the Free Software Foundation, either version 3 of the
1468+# License, or (at your option) any later version.
1469+#
1470+# This program is distributed in the hope that it will be useful,
1471+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1472+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1473+# GNU Affero General Public License for more details.
1474+#
1475+# You should have received a copy of the GNU Affero General Public License
1476+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1477+#
1478+##############################################################################
1479+
1480+from openerp.osv import orm
1481+
1482+
1483+class stock_picking(orm.Model):
1484+ _inherit = "stock.picking"
1485+
1486+ def _prepare_invoice(
1487+ self, cr, uid, picking, partner, inv_type, journal_id,
1488+ context=None):
1489+ """Copy bank partner and payment type from PO to invoice"""
1490+ invoice_vals = super(stock_picking, self)._prepare_invoice(
1491+ cr, uid, picking, partner, inv_type, journal_id, context=context)
1492+ if picking.purchase_id:
1493+ invoice_vals.update({
1494+ 'partner_bank_id':
1495+ picking.purchase_id.supplier_partner_bank.id or False,
1496+ 'payment_mode_type':
1497+ picking.purchase_id.payment_mode_type.id or False,
1498+ })
1499+ return invoice_vals
1500
1501=== added directory 'account_payment_purchase/view'
1502=== added file 'account_payment_purchase/view/purchase.xml'
1503--- account_payment_purchase/view/purchase.xml 1970-01-01 00:00:00 +0000
1504+++ account_payment_purchase/view/purchase.xml 2014-06-23 09:47:35 +0000
1505@@ -0,0 +1,26 @@
1506+<?xml version="1.0" encoding="utf-8"?>
1507+
1508+<!--
1509+ Copyright (C) 2014 Akretion (http://www.akretion.com/)
1510+ @author Alexis de Lattre <alexis.delattre@akretion.com>
1511+ The licence is in the file __openerp__.py
1512+-->
1513+
1514+<openerp>
1515+<data>
1516+
1517+<record id="purchase_order_form" model="ir.ui.view">
1518+ <field name="name">account_payment_purchase.purchase_order.form</field>
1519+ <field name="model">purchase.order</field>
1520+ <field name="inherit_id" ref="purchase.purchase_order_form"/>
1521+ <field name="arch" type="xml">
1522+ <field name="payment_term_id" position="after">
1523+ <field name="payment_mode_id"/>
1524+ <field name="supplier_partner_bank_id"
1525+ domain="[('partner_id', '=', partner_id)]" />
1526+ </field>
1527+ </field>
1528+</record>
1529+
1530+</data>
1531+</openerp>
1532
1533=== added directory 'account_payment_sale'
1534=== added file 'account_payment_sale/__init__.py'
1535--- account_payment_sale/__init__.py 1970-01-01 00:00:00 +0000
1536+++ account_payment_sale/__init__.py 2014-06-23 09:47:35 +0000
1537@@ -0,0 +1,23 @@
1538+# -*- encoding: utf-8 -*-
1539+##############################################################################
1540+#
1541+# Account Payment Sale module for OpenERP
1542+# Copyright (C) 2014 Akretion (http://www.akretion.com)
1543+# @author Alexis de Lattre <alexis.delattre@akretion.com>
1544+#
1545+# This program is free software: you can redistribute it and/or modify
1546+# it under the terms of the GNU Affero General Public License as
1547+# published by the Free Software Foundation, either version 3 of the
1548+# License, or (at your option) any later version.
1549+#
1550+# This program is distributed in the hope that it will be useful,
1551+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1552+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1553+# GNU Affero General Public License for more details.
1554+#
1555+# You should have received a copy of the GNU Affero General Public License
1556+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1557+#
1558+##############################################################################
1559+
1560+from . import model
1561
1562=== added file 'account_payment_sale/__openerp__.py'
1563--- account_payment_sale/__openerp__.py 1970-01-01 00:00:00 +0000
1564+++ account_payment_sale/__openerp__.py 2014-06-23 09:47:35 +0000
1565@@ -0,0 +1,55 @@
1566+# -*- encoding: utf-8 -*-
1567+##############################################################################
1568+#
1569+# Account Payment Sale module for OpenERP
1570+# Copyright (C) 2014 Akretion (http://www.akretion.com).
1571+# @author Alexis de Lattre <alexis.delattre@akretion.com>
1572+#
1573+# This program is free software: you can redistribute it and/or modify
1574+# it under the terms of the GNU Affero General Public License as
1575+# published by the Free Software Foundation, either version 3 of the
1576+# License, or (at your option) any later version.
1577+#
1578+# This program is distributed in the hope that it will be useful,
1579+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1580+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1581+# GNU Affero General Public License for more details.
1582+#
1583+# You should have received a copy of the GNU Affero General Public License
1584+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1585+#
1586+##############################################################################
1587+
1588+{
1589+ 'name': 'Account Payment Sale',
1590+ 'version': '1.0',
1591+ 'category': 'Banking addons',
1592+ 'license': 'AGPL-3',
1593+ 'summary': "Adds Payment Mode on Sale Orders",
1594+ 'description': """
1595+Account Payment Sale
1596+====================
1597+
1598+This modules adds one field on sale orders : *Payment Mode*.
1599+This field is copied from partner to sale order and then from sale order to
1600+customer invoice.
1601+
1602+This module is similar to the *sale_payment* module ; the main difference is
1603+that it doesn't depend on the *account_payment_extension* module (it's not the
1604+only module to conflict with *account_payment_extension* ; all the SEPA
1605+modules in the banking addons conflict with *account_payment_extension*, cf
1606+banking-addons-70/account_banking_payment_export/__openerp__.py).
1607+
1608+Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com>
1609+for any help or question about this module.
1610+ """,
1611+ 'author': 'Akretion',
1612+ 'website': 'http://www.akretion.com',
1613+ 'depends': ['sale', 'account_payment_partner'],
1614+ 'conflicts': ['sale_payment'],
1615+ 'data': [
1616+ 'view/sale.xml',
1617+ ],
1618+ 'installable': True,
1619+ 'active': False,
1620+}
1621
1622=== added directory 'account_payment_sale/i18n'
1623=== added file 'account_payment_sale/i18n/account_payment_sale.pot'
1624--- account_payment_sale/i18n/account_payment_sale.pot 1970-01-01 00:00:00 +0000
1625+++ account_payment_sale/i18n/account_payment_sale.pot 2014-06-23 09:47:35 +0000
1626@@ -0,0 +1,27 @@
1627+# Translation of OpenERP Server.
1628+# This file contains the translation of the following modules:
1629+# * account_payment_sale
1630+#
1631+msgid ""
1632+msgstr ""
1633+"Project-Id-Version: OpenERP Server 7.0\n"
1634+"Report-Msgid-Bugs-To: \n"
1635+"POT-Creation-Date: 2014-06-09 23:24+0000\n"
1636+"PO-Revision-Date: 2014-06-09 23:24+0000\n"
1637+"Last-Translator: <>\n"
1638+"Language-Team: \n"
1639+"MIME-Version: 1.0\n"
1640+"Content-Type: text/plain; charset=UTF-8\n"
1641+"Content-Transfer-Encoding: \n"
1642+"Plural-Forms: \n"
1643+
1644+#. module: account_payment_sale
1645+#: field:sale.order,payment_mode_id:0
1646+msgid "Payment Mode"
1647+msgstr ""
1648+
1649+#. module: account_payment_sale
1650+#: model:ir.model,name:account_payment_sale.model_sale_order
1651+msgid "Sales Order"
1652+msgstr ""
1653+
1654
1655=== added directory 'account_payment_sale/model'
1656=== added file 'account_payment_sale/model/__init__.py'
1657--- account_payment_sale/model/__init__.py 1970-01-01 00:00:00 +0000
1658+++ account_payment_sale/model/__init__.py 2014-06-23 09:47:35 +0000
1659@@ -0,0 +1,23 @@
1660+# -*- encoding: utf-8 -*-
1661+##############################################################################
1662+#
1663+# Account Payment Sale module for OpenERP
1664+# Copyright (C) 2014 Akretion (http://www.akretion.com)
1665+# @author Alexis de Lattre <alexis.delattre@akretion.com>
1666+#
1667+# This program is free software: you can redistribute it and/or modify
1668+# it under the terms of the GNU Affero General Public License as
1669+# published by the Free Software Foundation, either version 3 of the
1670+# License, or (at your option) any later version.
1671+#
1672+# This program is distributed in the hope that it will be useful,
1673+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1674+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1675+# GNU Affero General Public License for more details.
1676+#
1677+# You should have received a copy of the GNU Affero General Public License
1678+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1679+#
1680+##############################################################################
1681+
1682+from . import sale
1683
1684=== added file 'account_payment_sale/model/sale.py'
1685--- account_payment_sale/model/sale.py 1970-01-01 00:00:00 +0000
1686+++ account_payment_sale/model/sale.py 2014-06-23 09:47:35 +0000
1687@@ -0,0 +1,55 @@
1688+# -*- encoding: utf-8 -*-
1689+##############################################################################
1690+#
1691+# Account Payment Sale module for OpenERP
1692+# Copyright (C) 2014 Akretion (http://www.akretion.com)
1693+# @author Alexis de Lattre <alexis.delattre@akretion.com>
1694+#
1695+# This program is free software: you can redistribute it and/or modify
1696+# it under the terms of the GNU Affero General Public License as
1697+# published by the Free Software Foundation, either version 3 of the
1698+# License, or (at your option) any later version.
1699+#
1700+# This program is distributed in the hope that it will be useful,
1701+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1702+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1703+# GNU Affero General Public License for more details.
1704+#
1705+# You should have received a copy of the GNU Affero General Public License
1706+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1707+#
1708+##############################################################################
1709+
1710+from openerp.osv import orm, fields
1711+
1712+
1713+class sale_order(orm.Model):
1714+ _inherit = "sale.order"
1715+
1716+ _columns = {
1717+ 'payment_mode_id': fields.many2one(
1718+ 'payment.mode', 'Payment Mode'),
1719+ }
1720+
1721+ def onchange_partner_id(self, cr, uid, ids, part, context=None):
1722+ res = super(sale_order, self).onchange_partner_id(
1723+ cr, uid, ids, part, context=context)
1724+ if part:
1725+ partner = self.pool['res.partner'].browse(
1726+ cr, uid, part, context=context)
1727+ res['value']['payment_mode_id'] = \
1728+ partner.customer_payment_mode.id or False,
1729+ else:
1730+ res['value']['payment_mode_id'] = False
1731+ return res
1732+
1733+ def _prepare_invoice(self, cr, uid, order, lines, context=None):
1734+ """Copy bank partner from sale order to invoice"""
1735+ invoice_vals = super(sale_order, self)._prepare_invoice(
1736+ cr, uid, order, lines, context=context)
1737+ invoice_vals.update({
1738+ 'payment_mode_id': order.payment_mode_id.id or False,
1739+ 'partner_bank_id': order.payment_mode_id and
1740+ order.payment_mode_id.bank_id.id or False,
1741+ })
1742+ return invoice_vals
1743
1744=== added directory 'account_payment_sale/view'
1745=== added file 'account_payment_sale/view/sale.xml'
1746--- account_payment_sale/view/sale.xml 1970-01-01 00:00:00 +0000
1747+++ account_payment_sale/view/sale.xml 2014-06-23 09:47:35 +0000
1748@@ -0,0 +1,24 @@
1749+<?xml version="1.0" encoding="utf-8"?>
1750+
1751+<!--
1752+ Copyright (C) 2014 Akretion (http://www.akretion.com/)
1753+ @author Alexis de Lattre <alexis.delattre@akretion.com>
1754+ The licence is in the file __openerp__.py
1755+-->
1756+
1757+<openerp>
1758+<data>
1759+
1760+<record id="view_order_form" model="ir.ui.view">
1761+ <field name="name">account_payment_sale.sale_order.form</field>
1762+ <field name="model">sale.order</field>
1763+ <field name="inherit_id" ref="sale.view_order_form"/>
1764+ <field name="arch" type="xml">
1765+ <field name="payment_term" position="after">
1766+ <field name="payment_mode_id"/>
1767+ </field>
1768+ </field>
1769+</record>
1770+
1771+</data>
1772+</openerp>
1773
1774=== added directory 'account_payment_sale_stock'
1775=== added file 'account_payment_sale_stock/__init__.py'
1776--- account_payment_sale_stock/__init__.py 1970-01-01 00:00:00 +0000
1777+++ account_payment_sale_stock/__init__.py 2014-06-23 09:47:35 +0000
1778@@ -0,0 +1,23 @@
1779+# -*- encoding: utf-8 -*-
1780+##############################################################################
1781+#
1782+# Account Payment Sale Stock module for OpenERP
1783+# Copyright (C) 2014 Akretion (http://www.akretion.com)
1784+# @author Alexis de Lattre <alexis.delattre@akretion.com>
1785+#
1786+# This program is free software: you can redistribute it and/or modify
1787+# it under the terms of the GNU Affero General Public License as
1788+# published by the Free Software Foundation, either version 3 of the
1789+# License, or (at your option) any later version.
1790+#
1791+# This program is distributed in the hope that it will be useful,
1792+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1793+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1794+# GNU Affero General Public License for more details.
1795+#
1796+# You should have received a copy of the GNU Affero General Public License
1797+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1798+#
1799+##############################################################################
1800+
1801+from . import model
1802
1803=== added file 'account_payment_sale_stock/__openerp__.py'
1804--- account_payment_sale_stock/__openerp__.py 1970-01-01 00:00:00 +0000
1805+++ account_payment_sale_stock/__openerp__.py 2014-06-23 09:47:35 +0000
1806@@ -0,0 +1,46 @@
1807+# -*- encoding: utf-8 -*-
1808+##############################################################################
1809+#
1810+# Account Payment Sale Stock module for OpenERP
1811+# Copyright (C) 2014 Akretion (http://www.akretion.com).
1812+# @author Alexis de Lattre <alexis.delattre@akretion.com>
1813+#
1814+# This program is free software: you can redistribute it and/or modify
1815+# it under the terms of the GNU Affero General Public License as
1816+# published by the Free Software Foundation, either version 3 of the
1817+# License, or (at your option) any later version.
1818+#
1819+# This program is distributed in the hope that it will be useful,
1820+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1821+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1822+# GNU Affero General Public License for more details.
1823+#
1824+# You should have received a copy of the GNU Affero General Public License
1825+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1826+#
1827+##############################################################################
1828+
1829+{
1830+ 'name': 'Account Payment Sale Stock',
1831+ 'version': '1.0',
1832+ 'category': 'Banking addons',
1833+ 'license': 'AGPL-3',
1834+ 'summary': "Manage Payment Mode when invoicing from picking",
1835+ 'description': """
1836+Account Payment Sale Stock
1837+==========================
1838+
1839+This modules copies *Payment Mode* from Sale Order to Invoice when the
1840+Invoice is generated from the Picking.
1841+
1842+Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com>
1843+for any help or question about this module.
1844+ """,
1845+ 'author': 'Akretion',
1846+ 'website': 'http://www.akretion.com',
1847+ 'depends': ['sale_stock', 'account_payment_sale'],
1848+ 'conflicts': ['account_payment_extension'],
1849+ 'data': [],
1850+ 'auto_install': True,
1851+ 'active': False,
1852+}
1853
1854=== added directory 'account_payment_sale_stock/model'
1855=== added file 'account_payment_sale_stock/model/__init__.py'
1856--- account_payment_sale_stock/model/__init__.py 1970-01-01 00:00:00 +0000
1857+++ account_payment_sale_stock/model/__init__.py 2014-06-23 09:47:35 +0000
1858@@ -0,0 +1,23 @@
1859+# -*- encoding: utf-8 -*-
1860+##############################################################################
1861+#
1862+# Account Payment Sale Stock module for OpenERP
1863+# Copyright (C) 2014 Akretion (http://www.akretion.com)
1864+# @author Alexis de Lattre <alexis.delattre@akretion.com>
1865+#
1866+# This program is free software: you can redistribute it and/or modify
1867+# it under the terms of the GNU Affero General Public License as
1868+# published by the Free Software Foundation, either version 3 of the
1869+# License, or (at your option) any later version.
1870+#
1871+# This program is distributed in the hope that it will be useful,
1872+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1873+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1874+# GNU Affero General Public License for more details.
1875+#
1876+# You should have received a copy of the GNU Affero General Public License
1877+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1878+#
1879+##############################################################################
1880+
1881+from . import stock
1882
1883=== added file 'account_payment_sale_stock/model/stock.py'
1884--- account_payment_sale_stock/model/stock.py 1970-01-01 00:00:00 +0000
1885+++ account_payment_sale_stock/model/stock.py 2014-06-23 09:47:35 +0000
1886@@ -0,0 +1,43 @@
1887+# -*- encoding: utf-8 -*-
1888+##############################################################################
1889+#
1890+# Account Payment Sale Stock module for OpenERP
1891+# Copyright (C) 2014 Akretion (http://www.akretion.com)
1892+# @author Alexis de Lattre <alexis.delattre@akretion.com>
1893+#
1894+# This program is free software: you can redistribute it and/or modify
1895+# it under the terms of the GNU Affero General Public License as
1896+# published by the Free Software Foundation, either version 3 of the
1897+# License, or (at your option) any later version.
1898+#
1899+# This program is distributed in the hope that it will be useful,
1900+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1901+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1902+# GNU Affero General Public License for more details.
1903+#
1904+# You should have received a copy of the GNU Affero General Public License
1905+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1906+#
1907+##############################################################################
1908+
1909+from openerp.osv import orm
1910+
1911+
1912+class stock_picking(orm.Model):
1913+ _inherit = "stock.picking"
1914+
1915+ def _prepare_invoice(
1916+ self, cr, uid, picking, partner, inv_type, journal_id,
1917+ context=None):
1918+ """Copy payment mode from sale order to invoice"""
1919+ invoice_vals = super(stock_picking, self)._prepare_invoice(
1920+ cr, uid, picking, partner, inv_type, journal_id, context=context)
1921+ if picking.sale_id:
1922+ invoice_vals.update({
1923+ 'partner_bank_id':
1924+ picking.sale_id.payment_mode_id and
1925+ picking.sale_id.payment_mode_id.bank_id.id or False,
1926+ 'payment_mode_id':
1927+ picking.sale_id.payment_mode_id.id or False,
1928+ })
1929+ return invoice_vals

Subscribers

People subscribed via source and target branches

to status/vote changes: