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
=== modified file 'account_banking_pain_base/__openerp__.py'
--- account_banking_pain_base/__openerp__.py 2013-12-24 14:30:37 +0000
+++ account_banking_pain_base/__openerp__.py 2014-06-23 09:47:35 +0000
@@ -1,3 +1,4 @@
1# -*- encoding: utf-8 -*-
1##############################################################################2##############################################################################
2#3#
3# PAIN base module for OpenERP4# PAIN base module for OpenERP
45
=== modified file 'account_banking_payment/model/account_payment.py'
--- account_banking_payment/model/account_payment.py 2014-02-16 16:13:15 +0000
+++ account_banking_payment/model/account_payment.py 2014-06-23 09:47:35 +0000
@@ -3,7 +3,7 @@
3#3#
4# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).4# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
5# (C) 2011 - 2013 Therp BV (<http://therp.nl>).5# (C) 2011 - 2013 Therp BV (<http://therp.nl>).
6# 6#
7# All other contributions are (C) by their respective contributors7# All other contributions are (C) by their respective contributors
8#8#
9# All Rights Reserved9# All Rights Reserved
@@ -63,11 +63,11 @@
63 ),63 ),
64 'state': fields.selection([64 'state': fields.selection([
65 ('draft', 'Draft'),65 ('draft', 'Draft'),
66 ('open','Confirmed'),66 ('open', 'Confirmed'),
67 ('cancel','Cancelled'),67 ('cancel', 'Cancelled'),
68 ('sent', 'Sent'),68 ('sent', 'Sent'),
69 ('rejected', 'Rejected'),69 ('rejected', 'Rejected'),
70 ('done','Done'),70 ('done', 'Done'),
71 ], 'State', select=True71 ], 'State', select=True
72 ),72 ),
73 'line_ids': fields.one2many(73 'line_ids': fields.one2many(
@@ -81,7 +81,7 @@
81 },81 },
82 ),82 ),
83 'user_id': fields.many2one(83 'user_id': fields.many2one(
84 'res.users','User', required=True,84 'res.users', 'User', required=True,
85 states={85 states={
86 'sent': [('readonly', True)],86 'sent': [('readonly', True)],
87 'rejected': [('readonly', True)],87 'rejected': [('readonly', True)],
@@ -98,18 +98,19 @@
98 'rejected': [('readonly', True)],98 'rejected': [('readonly', True)],
99 'done': [('readonly', True)]99 'done': [('readonly', True)]
100 },100 },
101 help=("Choose an option for the Payment Order:'Fixed' stands for a "101 help=("Choose an option for the Payment Order:'Fixed' stands for "
102 "date specified by you.'Directly' stands for the direct "102 "a date specified by you.'Directly' stands for the direct "
103 "execution.'Due date' stands for the scheduled date of "103 "execution.'Due date' stands for the scheduled date of "
104 "execution."104 "execution."
105 )105 )
106 ),106 ),
107 'date_sent': fields.date('Send date', readonly=True),107 'date_sent': fields.date('Send date', readonly=True),
108 }108 }
109109
110 def _write_payment_lines(self, cr, uid, ids, **kwargs):110 def _write_payment_lines(self, cr, uid, ids, **kwargs):
111 '''111 '''
112 ORM method for setting attributes of corresponding payment.line objects.112 ORM method for setting attributes of corresponding payment.line
113 objects.
113 Note that while this is ORM compliant, it is also very ineffecient due114 Note that while this is ORM compliant, it is also very ineffecient due
114 to the absence of filters on writes and hence the requirement to115 to the absence of filters on writes and hence the requirement to
115 filter on the client(=OpenERP server) side.116 filter on the client(=OpenERP server) side.
@@ -143,7 +144,7 @@
143 cr, uid, ids, *args144 cr, uid, ids, *args
144 )145 )
145146
146 def debit_reconcile_transfer(self, cr, uid, payment_order_id, 147 def debit_reconcile_transfer(self, cr, uid, payment_order_id,
147 amount, currency, context=None):148 amount, currency, context=None):
148 """149 """
149 During import of bank statements, create the reconcile on the transfer150 During import of bank statements, create the reconcile on the transfer
@@ -163,10 +164,10 @@
163 if line.account_id.type == 'other' and not line.reconcile_id:164 if line.account_id.type == 'other' and not line.reconcile_id:
164 line_ids.append(line.id)165 line_ids.append(line.id)
165 if self.pool.get('res.currency').is_zero(166 if self.pool.get('res.currency').is_zero(
166 cr, uid, currency,167 cr, uid, currency,
167 move_line_obj.get_balance(cr, uid, line_ids) - amount):168 move_line_obj.get_balance(cr, uid, line_ids) - amount):
168 reconcile_id = self.pool.get('account.move.reconcile').create(169 reconcile_id = self.pool.get('account.move.reconcile').create(
169 cr, uid, 170 cr, uid,
170 {'type': 'auto', 'line_id': [(6, 0, line_ids)]},171 {'type': 'auto', 'line_id': [(6, 0, line_ids)]},
171 context)172 context)
172 # set direct debit order to finished state173 # set direct debit order to finished state
@@ -175,8 +176,9 @@
175 uid, 'payment.order', payment_order_id, 'done', cr)176 uid, 'payment.order', payment_order_id, 'done', cr)
176 return reconcile_id177 return reconcile_id
177178
178 def debit_unreconcile_transfer(self, cr, uid, payment_order_id, reconcile_id,179 def debit_unreconcile_transfer(
179 amount, currency, context=None):180 self, cr, uid, payment_order_id, reconcile_id, amount, currency,
181 context=None):
180 """182 """
181 Due to a cancelled bank statements import, unreconcile the move on183 Due to a cancelled bank statements import, unreconcile the move on
182 the transfer account. Delegate the conditions to the workflow.184 the transfer account. Delegate the conditions to the workflow.
@@ -194,12 +196,12 @@
194 if state != 'sent':196 if state != 'sent':
195 raise orm.except_orm(197 raise orm.except_orm(
196 _("Cannot unreconcile"),198 _("Cannot unreconcile"),
197 _("Cannot unreconcile payment order: "+199 _("Cannot unreconcile payment order: "
198 "Workflow will not allow it."))200 "Workflow will not allow it."))
199 return True201 return True
200202
201 def test_undo_done(self, cr, uid, ids, context=None):203 def test_undo_done(self, cr, uid, ids, context=None):
202 """ 204 """
203 Called from the workflow. Used to unset done state on205 Called from the workflow. Used to unset done state on
204 payment orders that were reconciled with bank transfers206 payment orders that were reconciled with bank transfers
205 which are being cancelled.207 which are being cancelled.
@@ -213,14 +215,72 @@
213 for order in self.browse(cr, uid, ids, context=context):215 for order in self.browse(cr, uid, ids, context=context):
214 for order_line in order.line_ids:216 for order_line in order.line_ids:
215 if order_line.transit_move_line_id.move_id:217 if order_line.transit_move_line_id.move_id:
216 for line in order_line.transit_move_line_id.move_id.line_id:218 for line in \
219 order_line.transit_move_line_id.move_id.line_id:
217 if (line.account_id.type == 'other' and220 if (line.account_id.type == 'other' and
218 line.reconcile_id):221 line.reconcile_id):
219 return False222 return False
220 return True223 return True
221 224
225 def _prepare_transfer_move(
226 self, cr, uid, order, line, labels, context=None):
227 vals = {
228 'journal_id': order.mode.transfer_journal_id.id,
229 'name': '%s %s' % (labels[order.payment_order_type],
230 line.move_line_id
231 and line.move_line_id.move_id.name
232 or line.communication),
233 'ref': '%s %s' % (order.payment_order_type[:3].upper(),
234 line.move_line_id
235 and line.move_line_id.move_id.name
236 or line.communication),
237 }
238 return vals
239
240 def _prepare_move_line_transfer_account(
241 self, cr, uid, order, line, move_id, labels, context=None):
242 vals = {
243 'name': _('%s for %s') % (
244 labels[order.payment_order_type],
245 line.move_line_id and (line.move_line_id.invoice
246 and line.move_line_id.invoice.number
247 or line.move_line_id.name)
248 or line.communication),
249 'move_id': move_id,
250 'partner_id': False,
251 'account_id': order.mode.transfer_account_id.id,
252 'credit': (order.payment_order_type == 'payment'
253 and line.amount or 0.0),
254 'debit': (order.payment_order_type == 'debit'
255 and line.amount or 0.0),
256 'date': fields.date.context_today(
257 self, cr, uid, context=context),
258 }
259 return vals
260
261 def _update_move_line_partner_account(
262 self, cr, uid, order, line, vals, context=None):
263 vals.update({
264 'partner_id': line.partner_id.id,
265 'account_id': (line.move_line_id
266 and line.move_line_id.account_id.id
267 or False),
268 # if not line.move_line_id, the field 'account_id' must be set by
269 # another module that inherit this function, like for example in
270 # the module purchase_payment_order
271 'credit': (order.payment_order_type == 'debit'
272 and line.amount or 0.0),
273 'debit': (order.payment_order_type == 'payment'
274 and line.amount or 0.0),
275 })
276 return vals
277
278 def action_sent_no_move_line_hook(self, cr, uid, pay_line, context=None):
279 """This function is designed to be inherited"""
280 return
281
222 def action_sent(self, cr, uid, ids, context=None):282 def action_sent(self, cr, uid, ids, context=None):
223 """ 283 """
224 Create the moves that pay off the move lines from284 Create the moves that pay off the move lines from
225 the debit order. This happens when the debit order file is285 the debit order. This happens when the debit order file is
226 generated.286 generated.
@@ -233,63 +293,35 @@
233 'debit': _('Direct debit order'),293 'debit': _('Direct debit order'),
234 }294 }
235 for order in self.browse(cr, uid, ids, context=context):295 for order in self.browse(cr, uid, ids, context=context):
236 if not order.mode.transfer_journal_id or not order.mode.transfer_account_id:296 if not order.mode.transfer_journal_id \
297 or not order.mode.transfer_account_id:
237 continue298 continue
238 for line in order.line_ids:299 for line in order.line_ids:
239 # basic checks300 # basic checks
240 if not line.move_line_id:301 if line.move_line_id and line.move_line_id.reconcile_id:
241 raise orm.except_orm(302 raise orm.except_orm(
242 _('Error'),303 _('Error'),
243 _('No move line provided for line %s') % line.name)304 _('Move line %s has already been paid/reconciled')
244 if line.move_line_id.reconcile_id:305 % line.move_line_id.name)
245 raise orm.except_orm(
246 _('Error'),
247 _('Move line %s has already been paid/reconciled') %
248 line.move_line_id.name
249 )
250306
251 move_id = account_move_obj.create(cr, uid, {307 move_id = account_move_obj.create(
252 'journal_id': order.mode.transfer_journal_id.id,308 cr, uid, self._prepare_transfer_move(
253 'name': '%s %s' % (labels[order.payment_order_type], 309 cr, uid, order, line, labels, context=context),
254 line.move_line_id.move_id.name),310 context=context)
255 'ref': '%s%s' % (order.payment_order_type[:3].upper(),
256 line.move_line_id.move_id.name),
257 }, context=context)
258311
259 # TODO: take multicurrency into account312 # TODO: take multicurrency into account
260 313
261 # create the debit move line on the transfer account314 # create the debit move line on the transfer account
262 vals = {315 ml_vals = self._prepare_move_line_transfer_account(
263 'name': _('%s for %s') % (316 cr, uid, order, line, move_id, labels, context=context)
264 labels[order.payment_order_type],317 account_move_line_obj.create(cr, uid, ml_vals, context=context)
265 line.move_line_id.invoice and
266 line.move_line_id.invoice.number or
267 line.move_line_id.name),
268 'move_id': move_id,
269 'partner_id': False,
270 'account_id': order.mode.transfer_account_id.id,
271 'credit': (order.payment_order_type == 'payment'
272 and line.amount or 0.0),
273 'debit': (order.payment_order_type == 'debit'
274 and line.amount or 0.0),
275 'date': fields.date.context_today(
276 self, cr, uid, context=context),
277 }
278 transfer_move_line_id = account_move_line_obj.create(
279 cr, uid, vals, context=context)
280318
281 # create the debit move line on the receivable account319 # create the debit move line on the partner account
282 vals.update({320 self._update_move_line_partner_account(
283 'partner_id': line.partner_id.id,321 cr, uid, order, line, ml_vals, context=context)
284 'account_id': line.move_line_id.account_id.id,
285 'credit': (order.payment_order_type == 'debit'
286 and line.amount or 0.0),
287 'debit': (order.payment_order_type == 'payment'
288 and line.amount or 0.0),
289 })
290 reconcile_move_line_id = account_move_line_obj.create(322 reconcile_move_line_id = account_move_line_obj.create(
291 cr, uid, vals, context=context)323 cr, uid, ml_vals, context=context)
292 324
293 # register the debit move line on the payment line325 # register the debit move line on the payment line
294 # and call reconciliation on it326 # and call reconciliation on it
295 payment_line_obj.write(327 payment_line_obj.write(
@@ -297,16 +329,18 @@
297 {'transit_move_line_id': reconcile_move_line_id},329 {'transit_move_line_id': reconcile_move_line_id},
298 context=context)330 context=context)
299331
300 payment_line_obj.debit_reconcile(332 if line.move_line_id:
301 cr, uid, line.id, context=context)333 payment_line_obj.debit_reconcile(
334 cr, uid, line.id, context=context)
335 else:
336 self.action_sent_no_move_line_hook(
337 cr, uid, line, context=context)
302 account_move_obj.post(cr, uid, [move_id], context=context)338 account_move_obj.post(cr, uid, [move_id], context=context)
303339
304 # State field is written by act_sent_wait340 # State field is written by act_sent_wait
305 self.write(cr, uid, ids, {341 self.write(cr, uid, ids, {
306 'date_sent': fields.date.context_today(342 'date_sent': fields.date.context_today(
307 self, cr, uid, context=context),343 self, cr, uid, context=context),
308 }, context=context)344 }, context=context)
309345
310 return True346 return True
311
312
313347
=== modified file 'account_banking_payment_export/demo/banking_demo.xml'
--- account_banking_payment_export/demo/banking_demo.xml 2014-02-16 14:01:09 +0000
+++ account_banking_payment_export/demo/banking_demo.xml 2014-06-23 09:47:35 +0000
@@ -21,6 +21,15 @@
21 <field name="country" ref="base.fr"/>21 <field name="country" ref="base.fr"/>
22</record>22</record>
2323
24<record id="bank_societe_generale" model="res.bank">
25 <field name="name">Société Générale</field>
26 <field name="bic">SOGEFRPPXXX</field>
27 <field name="street">1 avenue du Roi Fabien 1er</field>
28 <field name="zip">75008</field>
29 <field name="city">Paris</field>
30 <field name="country" ref="base.fr"/>
31</record>
32
24<record id="main_company_iban" model="res.partner.bank">33<record id="main_company_iban" model="res.partner.bank">
25 <field name="acc_number">FR76 4242 4242 4242 4242 4242 424</field>34 <field name="acc_number">FR76 4242 4242 4242 4242 4242 424</field>
26 <field name="state">iban</field>35 <field name="state">iban</field>
@@ -30,6 +39,15 @@
30 <field name="bank_bic">PSSTFRPPXXX</field>39 <field name="bank_bic">PSSTFRPPXXX</field>
31</record>40</record>
3241
42<record id="main_company_iban2" model="res.partner.bank">
43 <field name="acc_number">FR20 1242 1242 1242 1242 1242 124</field>
44 <field name="state">iban</field>
45 <field name="bank" ref="bank_societe_generale"/>
46 <field name="partner_id" ref="base.main_partner" />
47 <field name="bank_name">Société Générale</field>
48 <field name="bank_bic">SOGEFRPPXXX</field>
49</record>
50
33<record id="res_partner_12_iban" model="res.partner.bank">51<record id="res_partner_12_iban" model="res.partner.bank">
34 <field name="acc_number">FR66 1212 1212 1212 1212 1212 121</field>52 <field name="acc_number">FR66 1212 1212 1212 1212 1212 121</field>
35 <field name="state">iban</field>53 <field name="state">iban</field>
@@ -39,5 +57,22 @@
39 <field name="bank_bic">FTNOFRP1XXX</field>57 <field name="bank_bic">FTNOFRP1XXX</field>
40</record>58</record>
4159
60<record id="payment_mode_2" model="payment.mode">
61 <field name="name">Credit Trf Banque Postale</field>
62 <field name="journal" ref="account.bank_journal"/>
63 <field name="bank_id" ref="main_company_iban"/>
64 <field name="company_id" ref="base.main_company"/>
65 <field name="type" ref="account_banking_payment_export.manual_bank_tranfer"/>
66</record>
67
68<record id="payment_mode_3" model="payment.mode">
69 <field name="name">Credit Trf Société Générale</field>
70 <field name="journal" ref="account.bank_journal"/>
71 <field name="bank_id" ref="main_company_iban2"/>
72 <field name="company_id" ref="base.main_company"/>
73 <field name="type" ref="account_banking_payment_export.manual_bank_tranfer"/>
74</record>
75
76
42</data>77</data>
43</openerp>78</openerp>
4479
=== modified file 'account_banking_payment_export/model/__init__.py'
--- account_banking_payment_export/model/__init__.py 2014-02-16 14:03:28 +0000
+++ account_banking_payment_export/model/__init__.py 2014-06-23 09:47:35 +0000
@@ -1,3 +1,4 @@
1# -*- coding: utf-8 -*-
1from . import account_move_line2from . import account_move_line
2from . import account_payment3from . import account_payment
3from . import bank_payment_manual4from . import bank_payment_manual
45
=== modified file 'account_banking_payment_export/model/account_payment.py'
--- account_banking_payment_export/model/account_payment.py 2014-02-16 16:13:15 +0000
+++ account_banking_payment_export/model/account_payment.py 2014-06-23 09:47:35 +0000
@@ -37,6 +37,9 @@
37 'Payment order type', required=True,37 'Payment order type', required=True,
38 readonly=True, states={'draft': [('readonly', False)]},38 readonly=True, states={'draft': [('readonly', False)]},
39 ),39 ),
40 'mode_type': fields.related(
41 'mode', 'type', type='many2one', relation='payment.mode.type',
42 string='Payment Type'),
40 }43 }
4144
42 _defaults = {45 _defaults = {
4346
=== modified file 'account_banking_payment_export/model/payment_mode.py'
--- account_banking_payment_export/model/payment_mode.py 2014-02-16 16:13:15 +0000
+++ account_banking_payment_export/model/payment_mode.py 2014-06-23 09:47:35 +0000
@@ -53,4 +53,9 @@
53 'type', 'payment_order_type', readonly=True, type='selection',53 'type', 'payment_order_type', readonly=True, type='selection',
54 selection=[('payment', 'Payment'), ('debit', 'Direct debit')],54 selection=[('payment', 'Payment'), ('debit', 'Direct debit')],
55 string="Payment Order Type"),55 string="Payment Order Type"),
56 'active': fields.boolean('Active'),
57 }
58
59 _defaults = {
60 'active': True,
56 }61 }
5762
=== modified file 'account_banking_payment_export/model/payment_mode_type.py'
--- account_banking_payment_export/model/payment_mode_type.py 2014-02-16 16:13:15 +0000
+++ account_banking_payment_export/model/payment_mode_type.py 2014-06-23 09:47:35 +0000
@@ -53,10 +53,12 @@
53 [('payment', 'Payment'), ('debit', 'Direct debit')],53 [('payment', 'Payment'), ('debit', 'Direct debit')],
54 'Payment order type', required=True,54 'Payment order type', required=True,
55 ),55 ),
56 'active': fields.boolean('Active'),
56 }57 }
5758
58 _defaults = {59 _defaults = {
59 'payment_order_type': 'payment',60 'payment_order_type': 'payment',
61 'active': True,
60 }62 }
6163
62 def _auto_init(self, cr, context=None):64 def _auto_init(self, cr, context=None):
6365
=== modified file 'account_banking_payment_export/view/account_payment.xml'
--- account_banking_payment_export/view/account_payment.xml 2013-08-09 20:55:49 +0000
+++ account_banking_payment_export/view/account_payment.xml 2014-06-23 09:47:35 +0000
@@ -9,12 +9,13 @@
9 <field name="inherit_id" ref="account_payment.view_payment_order_form" />9 <field name="inherit_id" ref="account_payment.view_payment_order_form" />
10 <field name="model">payment.order</field>10 <field name="model">payment.order</field>
11 <field name="arch" type="xml">11 <field name="arch" type="xml">
12 <data>12 <xpath expr="//button[@string='Make Payments']"
13 <xpath expr="//button[@string='Make Payments']"13 position="attributes">
14 position="attributes">14 <attribute name="name">launch_wizard</attribute>
15 <attribute name="name">launch_wizard</attribute>15 </xpath>
16 </xpath>16 <field name="mode" position="after">
17 </data>17 <field name="mode_type" invisible="1"/>
18 </field>
18 </field>19 </field>
19 </record>20 </record>
2021
2122
=== modified file 'account_banking_payment_export/view/payment_mode.xml'
--- account_banking_payment_export/view/payment_mode.xml 2013-08-13 09:18:15 +0000
+++ account_banking_payment_export/view/payment_mode.xml 2014-06-23 09:47:35 +0000
@@ -11,6 +11,7 @@
11 <field name="inherit_id" ref="account_payment.view_payment_mode_form"/>11 <field name="inherit_id" ref="account_payment.view_payment_mode_form"/>
12 <field name="arch" type="xml">12 <field name="arch" type="xml">
13 <field name="company_id" position="after">13 <field name="company_id" position="after">
14 <field name="active"/>
14 <field name="type"/>15 <field name="type"/>
15 </field>16 </field>
16 </field>17 </field>
1718
=== modified file 'account_banking_payment_export/view/payment_mode_type.xml'
--- account_banking_payment_export/view/payment_mode_type.xml 2013-09-12 07:32:00 +0000
+++ account_banking_payment_export/view/payment_mode_type.xml 2014-06-23 09:47:35 +0000
@@ -18,14 +18,42 @@
18 <field name="name">view.payment.mode.type.form</field>18 <field name="name">view.payment.mode.type.form</field>
19 <field name="model">payment.mode.type</field>19 <field name="model">payment.mode.type</field>
20 <field name="arch" type="xml">20 <field name="arch" type="xml">
21 <form string="Payment mode">21 <form string="Payment Type" version="7.0">
22 <field name="name" />22 <group name="main">
23 <field name="code" />23 <field name="name"/>
24 <field name="suitable_bank_types"/>24 <field name="code"/>
25 <field name="active"/>
26 <field name="ir_model_id"/>
27 <field name="suitable_bank_types"/>
28 </group>
29 </form>
30 </field>
31 </record>
32
33 <record id="view_payment_mode_type_tree" model="ir.ui.view">
34 <field name="name">view.payment.mode.type.tree</field>
35 <field name="model">payment.mode.type</field>
36 <field name="arch" type="xml">
37 <tree string="Payment Types">
38 <field name="name"/>
39 <field name="code"/>
40 <field name="active"/>
25 <field name="ir_model_id"/>41 <field name="ir_model_id"/>
26 </form>42 </tree>
27 </field>43 </field>
28 </record>44 </record>
2945
46 <record id="action_payment_mode_type" model="ir.actions.act_window">
47 <field name="name">Payment Type</field>
48 <field name="res_model">payment.mode.type</field>
49 <field name="view_type">form</field>
50 <field name="view_mode">tree,form</field>
51 <field name="context">{'active_test': False}</field>
52 </record>
53
54 <menuitem id="menu_payment_mode_type"
55 action="action_payment_mode_type"
56 parent="account.menu_configuration_misc" />
57
30 </data>58 </data>
31</openerp>59</openerp>
3260
=== modified file 'account_banking_sepa_credit_transfer/__openerp__.py'
--- account_banking_sepa_credit_transfer/__openerp__.py 2014-02-16 14:01:09 +0000
+++ account_banking_sepa_credit_transfer/__openerp__.py 2014-06-23 09:47:35 +0000
@@ -1,3 +1,4 @@
1# -*- encoding: utf-8 -*-
1##############################################################################2##############################################################################
2#3#
3# SEPA Credit Transfer module for OpenERP4# SEPA Credit Transfer module for OpenERP
45
=== modified file 'account_banking_sepa_credit_transfer/account_banking_sepa.py'
--- account_banking_sepa_credit_transfer/account_banking_sepa.py 2013-12-24 00:01:04 +0000
+++ account_banking_sepa_credit_transfer/account_banking_sepa.py 2014-06-23 09:47:35 +0000
@@ -1,3 +1,4 @@
1# -*- encoding: utf-8 -*-
1##############################################################################2##############################################################################
2#3#
3# SEPA Credit Transfer module for OpenERP4# SEPA Credit Transfer module for OpenERP
@@ -81,7 +82,6 @@
81 'state': fields.selection([82 'state': fields.selection([
82 ('draft', 'Draft'),83 ('draft', 'Draft'),
83 ('sent', 'Sent'),84 ('sent', 'Sent'),
84 ('done', 'Reconciled'),
85 ], 'State', readonly=True),85 ], 'State', readonly=True),
86 }86 }
8787
8888
=== modified file 'account_banking_sepa_credit_transfer/account_banking_sepa_view.xml'
--- account_banking_sepa_credit_transfer/account_banking_sepa_view.xml 2013-11-21 23:41:32 +0000
+++ account_banking_sepa_credit_transfer/account_banking_sepa_view.xml 2014-06-23 09:47:35 +0000
@@ -11,28 +11,24 @@
11 <field name="name">account.banking.export.sepa.form</field>11 <field name="name">account.banking.export.sepa.form</field>
12 <field name="model">banking.export.sepa</field>12 <field name="model">banking.export.sepa</field>
13 <field name="arch" type="xml">13 <field name="arch" type="xml">
14 <form string="SEPA Credit Transfer">14 <form string="SEPA Credit Transfer" version="7.0">
15 <header>
16 <field name="state" widget="statusbar"/>
17 </header>
15 <notebook>18 <notebook>
16 <page string="General Information">19 <page string="General Information">
17 <field name="total_amount" />20 <group name="main">
18 <field name="nb_transactions" />21 <field name="total_amount" />
19 <field name="batch_booking" />22 <field name="nb_transactions" />
20 <field name="charge_bearer"/>23 <field name="batch_booking" />
21 <field name="create_date" />24 <field name="charge_bearer"/>
22 <newline />25 <field name="create_date" />
23 <field name="file" filename="filename"/>26 <field name="file" filename="filename"/>
24 <field name="filename" invisible="True"/>27 <field name="filename" invisible="True"/>
28 </group>
25 </page>29 </page>
26 <page string="Payment Orders">30 <page string="Payment Orders">
27 <field name="payment_order_ids" colspan="4" nolabel="1">31 <field name="payment_order_ids" nolabel="1"/>
28 <tree colors="blue:state in ('draft');gray:state in ('cancel','done');black:state in ('open')" string="Payment Orders">
29 <field name="reference"/>
30 <field name="date_created"/>
31 <field name="date_done"/>
32 <field name="total"/>
33 <field name="state"/>
34 </tree>
35 </field>
36 </page>32 </page>
37 </notebook>33 </notebook>
38 </form>34 </form>
@@ -48,6 +44,7 @@
48 <field name="filename"/>44 <field name="filename"/>
49 <field name="create_date"/>45 <field name="create_date"/>
50 <field name="nb_transactions"/>46 <field name="nb_transactions"/>
47 <field name="state"/>
51 </tree>48 </tree>
52 </field>49 </field>
53</record>50</record>
5451
=== modified file 'account_banking_sepa_direct_debit/__openerp__.py'
--- account_banking_sepa_direct_debit/__openerp__.py 2014-02-16 14:01:09 +0000
+++ account_banking_sepa_direct_debit/__openerp__.py 2014-06-23 09:47:35 +0000
@@ -1,3 +1,4 @@
1# -*- encoding: utf-8 -*-
1##############################################################################2##############################################################################
2#3#
3# SEPA Direct Debit module for OpenERP4# SEPA Direct Debit module for OpenERP
45
=== modified file 'account_banking_sepa_direct_debit/account_banking_sdd.py'
--- account_banking_sepa_direct_debit/account_banking_sdd.py 2014-06-12 16:05:52 +0000
+++ account_banking_sepa_direct_debit/account_banking_sdd.py 2014-06-23 09:47:35 +0000
@@ -1,3 +1,4 @@
1# -*- encoding: utf-8 -*-
1##############################################################################2##############################################################################
2#3#
3# SEPA Direct Debit module for OpenERP4# SEPA Direct Debit module for OpenERP
@@ -89,7 +90,6 @@
89 'state': fields.selection([90 'state': fields.selection([
90 ('draft', 'Draft'),91 ('draft', 'Draft'),
91 ('sent', 'Sent'),92 ('sent', 'Sent'),
92 ('done', 'Reconciled'),
93 ], 'State', readonly=True),93 ], 'State', readonly=True),
94 }94 }
9595
9696
=== modified file 'account_banking_sepa_direct_debit/account_banking_sdd_view.xml'
--- account_banking_sepa_direct_debit/account_banking_sdd_view.xml 2013-12-12 22:19:53 +0000
+++ account_banking_sepa_direct_debit/account_banking_sdd_view.xml 2014-06-23 09:47:35 +0000
@@ -11,28 +11,24 @@
11 <field name="name">account.banking.export.sdd.form</field>11 <field name="name">account.banking.export.sdd.form</field>
12 <field name="model">banking.export.sdd</field>12 <field name="model">banking.export.sdd</field>
13 <field name="arch" type="xml">13 <field name="arch" type="xml">
14 <form string="SEPA Direct Debit">14 <form string="SEPA Direct Debit" version="7.0">
15 <header>
16 <field name="state" widget="statusbar"/>
17 </header>
15 <notebook>18 <notebook>
16 <page string="General Information">19 <page string="General Information">
17 <field name="total_amount" />20 <group name="main">
18 <field name="nb_transactions" />21 <field name="total_amount" />
19 <field name="batch_booking" />22 <field name="nb_transactions" />
20 <field name="charge_bearer"/>23 <field name="batch_booking" />
21 <field name="create_date" />24 <field name="charge_bearer"/>
22 <newline />25 <field name="create_date" />
23 <field name="file" filename="filename"/>26 <field name="file" filename="filename"/>
24 <field name="filename" invisible="True"/>27 <field name="filename" invisible="True"/>
28 </group>
25 </page>29 </page>
26 <page string="Payment Orders">30 <page string="Payment Orders">
27 <field name="payment_order_ids" colspan="4" nolabel="1">31 <field name="payment_order_ids" nolabel="1"/>
28 <tree colors="blue:state in ('draft');gray:state in ('cancel','done');black:state in ('open')" string="Payment Orders">
29 <field name="reference"/>
30 <field name="date_created"/>
31 <field name="date_done"/>
32 <field name="total"/>
33 <field name="state"/>
34 </tree>
35 </field>
36 </page>32 </page>
37 </notebook>33 </notebook>
38 </form>34 </form>
@@ -48,6 +44,7 @@
48 <field name="filename"/>44 <field name="filename"/>
49 <field name="create_date"/>45 <field name="create_date"/>
50 <field name="nb_transactions"/>46 <field name="nb_transactions"/>
47 <field name="state"/>
51 </tree>48 </tree>
52 </field>49 </field>
53</record>50</record>
5451
=== modified file 'account_banking_sepa_direct_debit/company.py'
--- account_banking_sepa_direct_debit/company.py 2013-12-24 00:01:04 +0000
+++ account_banking_sepa_direct_debit/company.py 2014-06-23 09:47:35 +0000
@@ -1,3 +1,4 @@
1# -*- encoding: utf-8 -*-
1##############################################################################2##############################################################################
2#3#
3# SEPA Direct Debit module for OpenERP4# SEPA Direct Debit module for OpenERP
45
=== added directory 'account_payment_partner'
=== added file 'account_payment_partner/__init__.py'
--- account_payment_partner/__init__.py 1970-01-01 00:00:00 +0000
+++ account_payment_partner/__init__.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,23 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Partner module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from . import model
024
=== added file 'account_payment_partner/__openerp__.py'
--- account_payment_partner/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_payment_partner/__openerp__.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,55 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Partner module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23
24{
25 'name': 'Account Payment Partner',
26 'version': '0.1',
27 'category': 'Banking addons',
28 'license': 'AGPL-3',
29 'summary': 'Adds payment mode on partners and invoices',
30 'description': """
31Account Payment Partner
32=======================
33
34This module adds severals fields :
35
36* the *Supplier Payment Mode* and *Customer Payment Mode* on Partners,
37
38* the *Payment Mode* on Invoices.
39
40On a Payment Order, in the wizard *Select Invoices to Pay*, the invoices will
41be filtered per Payment Mode.
42
43Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com>
44for any help or question about this module.
45 """,
46 'author': 'Akretion',
47 'website': 'http://www.akretion.com',
48 'depends': ['account_banking_payment_export'],
49 'data': [
50 'view/partner.xml',
51 'view/account_invoice.xml',
52 ],
53 'demo': ['demo/partner_demo.xml'],
54 'active': False,
55}
056
=== added directory 'account_payment_partner/demo'
=== added file 'account_payment_partner/demo/partner_demo.xml'
--- account_payment_partner/demo/partner_demo.xml 1970-01-01 00:00:00 +0000
+++ account_payment_partner/demo/partner_demo.xml 2014-06-23 09:47:35 +0000
@@ -0,0 +1,51 @@
1<?xml version="1.0" encoding="utf-8"?>
2
3<openerp>
4<data noupdate="1">
5
6<!-- Camptocamp -->
7<record id="supplier_payment_mode_12" model="ir.property" forcecreate="True">
8 <field name="name">supplier_payment_mode_12</field>
9 <field name="fields_id"
10 search="[('model','=','res.partner'),('name','=','supplier_payment_mode')]"/>
11 <field name="value"
12 eval="'payment.mode,'+str(ref('account_banking_payment_export.payment_mode_2'))"/>
13 <field name="company_id" ref="base.main_company"/>
14 <field name="res_id" ref="base.res_partner_12"/>
15</record>
16
17<record id="customer_payment_mode_12" model="ir.property" forcecreate="True">
18 <field name="name">customer_payment_mode_12</field>
19 <field name="fields_id"
20 search="[('model','=','res.partner'),('name','=','customer_payment_mode')]"/>
21 <field name="value"
22 eval="'payment.mode,'+str(ref('account_banking_payment_export.payment_mode_2'))"/>
23 <field name="company_id" ref="base.main_company"/>
24 <field name="res_id" ref="base.res_partner_12"/>
25</record>
26
27<!-- Agrolait -->
28<record id="customer_payment_mode_2" model="ir.property" forcecreate="True">
29 <field name="name">customer_payment_mode_2</field>
30 <field name="fields_id"
31 search="[('model','=','res.partner'),('name','=','customer_payment_mode')]"/>
32 <field name="value"
33 eval="'payment.mode,'+str(ref('account_banking_payment_export.payment_mode_3'))"/>
34 <field name="company_id" ref="base.main_company"/>
35 <field name="res_id" ref="base.res_partner_2"/>
36</record>
37
38<!-- Asustek -->
39<record id="supplier_payment_mode_1" model="ir.property" forcecreate="True">
40 <field name="name">supplier_payment_mode_1</field>
41 <field name="fields_id"
42 search="[('model','=','res.partner'),('name','=','supplier_payment_mode')]"/>
43 <field name="value"
44 eval="'payment.mode,'+str(ref('account_banking_payment_export.payment_mode_2'))"/>
45 <field name="company_id" ref="base.main_company"/>
46 <field name="res_id" ref="base.res_partner_1"/>
47</record>
48
49
50</data>
51</openerp>
052
=== added directory 'account_payment_partner/i18n'
=== added file 'account_payment_partner/i18n/account_payment_partner.pot'
--- account_payment_partner/i18n/account_payment_partner.pot 1970-01-01 00:00:00 +0000
+++ account_payment_partner/i18n/account_payment_partner.pot 2014-06-23 09:47:35 +0000
@@ -0,0 +1,57 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * account_payment_partner
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-06-09 23:22+0000\n"
10"PO-Revision-Date: 2014-06-09 23:22+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: account_payment_partner
19#: field:res.partner,customer_payment_mode:0
20msgid "Customer Payment Mode"
21msgstr ""
22
23#. module: account_payment_partner
24#: model:ir.model,name:account_payment_partner.model_account_invoice
25msgid "Invoice"
26msgstr ""
27
28#. module: account_payment_partner
29#: model:ir.model,name:account_payment_partner.model_res_partner
30msgid "Partner"
31msgstr ""
32
33#. module: account_payment_partner
34#: field:account.invoice,payment_mode_id:0
35msgid "Payment Mode"
36msgstr ""
37
38#. module: account_payment_partner
39#: help:res.partner,customer_payment_mode:0
40msgid "Select the default payment mode for this customer."
41msgstr ""
42
43#. module: account_payment_partner
44#: help:res.partner,supplier_payment_mode:0
45msgid "Select the default payment mode for this supplier."
46msgstr ""
47
48#. module: account_payment_partner
49#: field:res.partner,supplier_payment_mode:0
50msgid "Supplier Payment Mode"
51msgstr ""
52
53#. module: account_payment_partner
54#: model:ir.model,name:account_payment_partner.model_payment_order_create
55msgid "payment.order.create"
56msgstr ""
57
058
=== added directory 'account_payment_partner/model'
=== added file 'account_payment_partner/model/__init__.py'
--- account_payment_partner/model/__init__.py 1970-01-01 00:00:00 +0000
+++ account_payment_partner/model/__init__.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,25 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Partner module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from . import partner
24from . import account_invoice
25from . import payment_order_create
026
=== added file 'account_payment_partner/model/account_invoice.py'
--- account_payment_partner/model/account_invoice.py 1970-01-01 00:00:00 +0000
+++ account_payment_partner/model/account_invoice.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,56 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Partner module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.osv import orm, fields
24
25
26class account_invoice(orm.Model):
27 _inherit = 'account.invoice'
28
29 _columns = {
30 'payment_mode_id': fields.many2one(
31 'payment.mode', 'Payment Mode'),
32 }
33
34 def onchange_partner_id(
35 self, cr, uid, ids, type, partner_id, date_invoice=False,
36 payment_term=False, partner_bank_id=False, company_id=False):
37 res = super(account_invoice, self).onchange_partner_id(
38 cr, uid, ids, type, partner_id, date_invoice=date_invoice,
39 payment_term=payment_term, partner_bank_id=partner_bank_id,
40 company_id=company_id)
41 if partner_id:
42 partner = self.pool['res.partner'].browse(cr, uid, partner_id)
43 if type == 'in_invoice':
44 res['value']['payment_mode_id'] = \
45 partner.supplier_payment_mode.id or False
46 elif type == 'out_invoice':
47 res['value'].update({
48 'payment_mode_id':
49 partner.customer_payment_mode.id or False,
50 'partner_bank_id':
51 partner.customer_payment_mode and
52 partner.customer_payment_mode.bank_id.id or False,
53 })
54 else:
55 res['value']['payment_mode_id'] = False
56 return res
057
=== added file 'account_payment_partner/model/partner.py'
--- account_payment_partner/model/partner.py 1970-01-01 00:00:00 +0000
+++ account_payment_partner/model/partner.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,44 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Partner module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.osv import orm, fields
24
25
26class res_partner(orm.Model):
27 _inherit = 'res.partner'
28
29 _columns = {
30 'supplier_payment_mode': fields.property(
31 'payment.mode', type='many2one', relation='payment.mode',
32 string='Supplier Payment Mode', view_load=True,
33 help="Select the default payment mode for this supplier."),
34 'customer_payment_mode': fields.property(
35 'payment.mode', type='many2one', relation='payment.mode',
36 string='Customer Payment Mode', view_load=True,
37 help="Select the default payment mode for this customer."),
38 }
39
40 def _commercial_fields(self, cr, uid, context=None):
41 res = super(res_partner, self)._commercial_fields(
42 cr, uid, context=context)
43 res += ['supplier_payment_mode', 'customer_payment_mode']
44 return res
045
=== added file 'account_payment_partner/model/payment_order_create.py'
--- account_payment_partner/model/payment_order_create.py 1970-01-01 00:00:00 +0000
+++ account_payment_partner/model/payment_order_create.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,39 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Partner module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.osv import orm
24
25
26class payment_order_create(orm.TransientModel):
27 _inherit = 'payment.order.create'
28
29 def extend_payment_order_domain(
30 self, cr, uid, payment_order, domain, context=None):
31 super(payment_order_create, self).extend_payment_order_domain(
32 cr, uid, payment_order, domain, context=context)
33 domain += [
34 '|', '|',
35 ('invoice', '=', False),
36 ('invoice.payment_mode_id', '=', False),
37 ('invoice.payment_mode_id', '=', payment_order.mode.id)
38 ]
39 return True
040
=== added directory 'account_payment_partner/view'
=== added file 'account_payment_partner/view/account_invoice.xml'
--- account_payment_partner/view/account_invoice.xml 1970-01-01 00:00:00 +0000
+++ account_payment_partner/view/account_invoice.xml 2014-06-23 09:47:35 +0000
@@ -0,0 +1,38 @@
1<?xml version="1.0" encoding="utf-8"?>
2
3<!--
4 Copyright (C) 2014 Akretion (http://www.akretion.com/)
5 @author Alexis de Lattre <alexis.delattre@akretion.com>
6 The licence is in the file __openerp__.py
7-->
8
9<openerp>
10<data>
11
12
13<record id="invoice_form" model="ir.ui.view">
14 <field name="name">account_payment_partner.invoice_form</field>
15 <field name="model">account.invoice</field>
16 <field name="inherit_id" ref="account.invoice_form" />
17 <field name="arch" type="xml">
18 <field name="partner_bank_id" position="after">
19 <field name="payment_mode_id"/>
20 </field>
21 </field>
22</record>
23
24
25<record id="invoice_supplier_form" model="ir.ui.view">
26 <field name="name">account_payment_partner.invoice_supplier_form</field>
27 <field name="model">account.invoice</field>
28 <field name="inherit_id" ref="account.invoice_supplier_form" />
29 <field name="arch" type="xml">
30 <field name="partner_bank_id" position="after">
31 <field name="payment_mode_id"/>
32 </field>
33 </field>
34</record>
35
36
37</data>
38</openerp>
039
=== added file 'account_payment_partner/view/partner.xml'
--- account_payment_partner/view/partner.xml 1970-01-01 00:00:00 +0000
+++ account_payment_partner/view/partner.xml 2014-06-23 09:47:35 +0000
@@ -0,0 +1,31 @@
1<?xml version="1.0" encoding="utf-8"?>
2
3<!--
4 Copyright (C) 2014 Akretion (http://www.akretion.com/)
5 @author Alexis de Lattre <alexis.delattre@akretion.com>
6 The licence is in the file __openerp__.py
7-->
8
9<openerp>
10<data>
11
12
13<record id="view_partner_property_form" model="ir.ui.view">
14 <field name="name">account_partner_payment.partner_form</field>
15 <field name="model">res.partner</field>
16 <field name="inherit_id" ref="account.view_partner_property_form" />
17 <field name="arch" type="xml">
18 <field name="property_payment_term" position="after">
19 <field name="customer_payment_mode"
20 attrs="{'invisible': [('customer', '=', False)]}"/>
21 </field>
22 <field name="property_supplier_payment_term" position="after">
23 <field name="supplier_payment_mode"
24 attrs="{'invisible': [('supplier', '=', False)]}"/>
25 </field>
26 </field>
27</record>
28
29
30</data>
31</openerp>
032
=== added directory 'account_payment_purchase'
=== added file 'account_payment_purchase/__init__.py'
--- account_payment_purchase/__init__.py 1970-01-01 00:00:00 +0000
+++ account_payment_purchase/__init__.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,23 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Purchase module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from . import model
024
=== added file 'account_payment_purchase/__openerp__.py'
--- account_payment_purchase/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_payment_purchase/__openerp__.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,55 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Purchase module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com).
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23{
24 'name': 'Account Payment Purchase',
25 'version': '1.0',
26 'category': 'Banking addons',
27 'license': 'AGPL-3',
28 'summary': "Adds Bank Account and Payment Mode on Purchase Orders",
29 'description': """
30Account Payment Purchase
31========================
32
33This modules adds 2 fields on purchase orders : *Bank Account* and *Payment
34Mode*. These fields are copied from partner to purchase order and then from
35purchase order to supplier invoice.
36
37This module is similar to the *purchase_payment* module ; the main difference
38is that it doesn't depend on the *account_payment_extension* module (it's not
39the only module to conflict with *account_payment_extension* ; all the SEPA
40modules in the banking addons conflict with *account_payment_extension*, cf
41banking-addons-70/account_banking_payment_export/__openerp__.py).
42
43Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com>
44for any help or question about this module.
45 """,
46 'author': 'Akretion',
47 'website': 'http://www.akretion.com',
48 'depends': ['purchase', 'account_payment_partner'],
49 'conflicts': ['purchase_payment'],
50 'data': [
51 'view/purchase.xml',
52 ],
53 'installable': True,
54 'active': False,
55}
056
=== added directory 'account_payment_purchase/i18n'
=== added file 'account_payment_purchase/i18n/account_payment_purchase.pot'
--- account_payment_purchase/i18n/account_payment_purchase.pot 1970-01-01 00:00:00 +0000
+++ account_payment_purchase/i18n/account_payment_purchase.pot 2014-06-23 09:47:35 +0000
@@ -0,0 +1,42 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * account_payment_purchase
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-06-09 23:23+0000\n"
10"PO-Revision-Date: 2014-06-09 23:23+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: account_payment_purchase
19#: field:purchase.order,payment_mode_id:0
20msgid "Payment Mode"
21msgstr ""
22
23#. module: account_payment_purchase
24#: model:ir.model,name:account_payment_purchase.model_stock_picking
25msgid "Picking List"
26msgstr ""
27
28#. module: account_payment_purchase
29#: model:ir.model,name:account_payment_purchase.model_purchase_order
30msgid "Purchase Order"
31msgstr ""
32
33#. module: account_payment_purchase
34#: help:purchase.order,supplier_partner_bank_id:0
35msgid "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."
36msgstr ""
37
38#. module: account_payment_purchase
39#: field:purchase.order,supplier_partner_bank_id:0
40msgid "Supplier Bank Account"
41msgstr ""
42
043
=== added file 'account_payment_purchase/i18n/fr.po'
--- account_payment_purchase/i18n/fr.po 1970-01-01 00:00:00 +0000
+++ account_payment_purchase/i18n/fr.po 2014-06-23 09:47:35 +0000
@@ -0,0 +1,42 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * account_payment_purchase
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-02-24 23:09+0000\n"
10"PO-Revision-Date: 2014-02-24 23:09+0000\n"
11"Last-Translator: Alexis de Lattre <alexis.delattre@akretion.com>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: account_payment_purchase
19#: field:purchase.order,payment_mode_type:0
20msgid "Payment Type"
21msgstr "Type de Paiement"
22
23#. module: account_payment_purchase
24#: model:ir.model,name:account_payment_purchase.model_purchase_order
25msgid "Purchase Order"
26msgstr "Bon de commande"
27
28#. module: account_payment_purchase
29#: help:purchase.order,supplier_partner_bank:0
30msgid "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."
31msgstr "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."
32
33#. module: account_payment_purchase
34#: field:purchase.order,supplier_partner_bank:0
35msgid "Supplier Bank Account"
36msgstr "Compte bancaire du fournisseur"
37
38#. module: account_payment_purchase
39#: model:ir.model,name:account_payment_purchase.model_stock_picking
40msgid "Picking List"
41msgstr "Bon de livraison"
42
043
=== added directory 'account_payment_purchase/model'
=== added file 'account_payment_purchase/model/__init__.py'
--- account_payment_purchase/model/__init__.py 1970-01-01 00:00:00 +0000
+++ account_payment_purchase/model/__init__.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,24 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Purchase module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from . import purchase
24from . import stock
025
=== added file 'account_payment_purchase/model/purchase.py'
--- account_payment_purchase/model/purchase.py 1970-01-01 00:00:00 +0000
+++ account_payment_purchase/model/purchase.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,82 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Purchase module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.osv import orm, fields
24
25
26class purchase_order(orm.Model):
27 _inherit = "purchase.order"
28
29 _columns = {
30 'supplier_partner_bank_id': fields.many2one(
31 'res.partner.bank', 'Supplier Bank Account',
32 help="Select the bank account of your supplier on which "
33 "your company should send the payment. This field is copied "
34 "from the partner and will be copied to the supplier invoice."),
35 'payment_mode_id': fields.many2one(
36 'payment.mode', 'Payment Mode'),
37 }
38
39 def _get_default_supplier_partner_bank(
40 self, cr, uid, partner, context=None):
41 '''This function is designed to be inherited'''
42 if partner.bank_ids:
43 return partner.bank_ids[0].id
44 else:
45 return False
46
47 def onchange_partner_id(self, cr, uid, ids, partner_id):
48 res = super(purchase_order, self).onchange_partner_id(
49 cr, uid, ids, partner_id)
50 if partner_id:
51 partner = self.pool['res.partner'].browse(
52 cr, uid, partner_id)
53 res['value'].update({
54 'supplier_partner_bank_id':
55 self._get_default_supplier_partner_bank(
56 cr, uid, partner),
57 'payment_mode_id':
58 partner.supplier_payment_mode.id or False,
59 })
60 else:
61 res['value'].update({
62 'supplier_partner_bank_id': False,
63 'payment_mode_id': False,
64 })
65 return res
66
67 def action_invoice_create(self, cr, uid, ids, context=None):
68 """Copy bank partner + payment type from PO to invoice"""
69 # as of OpenERP 7.0, there is no _prepare function for
70 # the invoice (the _prepare function only exists for invoice lines)
71 res = super(purchase_order, self).action_invoice_create(
72 cr, uid, ids, context=context)
73 for order in self.browse(cr, uid, ids, context=context):
74 for invoice in order.invoice_ids:
75 if invoice.state == 'draft':
76 invoice.write({
77 'partner_bank_id':
78 order.supplier_partner_bank_id.id or False,
79 'payment_mode_id':
80 order.payment_mode_id.id or False,
81 }, context=context)
82 return res
083
=== added file 'account_payment_purchase/model/stock.py'
--- account_payment_purchase/model/stock.py 1970-01-01 00:00:00 +0000
+++ account_payment_purchase/model/stock.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,42 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Purchase module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.osv import orm
24
25
26class stock_picking(orm.Model):
27 _inherit = "stock.picking"
28
29 def _prepare_invoice(
30 self, cr, uid, picking, partner, inv_type, journal_id,
31 context=None):
32 """Copy bank partner and payment type from PO to invoice"""
33 invoice_vals = super(stock_picking, self)._prepare_invoice(
34 cr, uid, picking, partner, inv_type, journal_id, context=context)
35 if picking.purchase_id:
36 invoice_vals.update({
37 'partner_bank_id':
38 picking.purchase_id.supplier_partner_bank.id or False,
39 'payment_mode_type':
40 picking.purchase_id.payment_mode_type.id or False,
41 })
42 return invoice_vals
043
=== added directory 'account_payment_purchase/view'
=== added file 'account_payment_purchase/view/purchase.xml'
--- account_payment_purchase/view/purchase.xml 1970-01-01 00:00:00 +0000
+++ account_payment_purchase/view/purchase.xml 2014-06-23 09:47:35 +0000
@@ -0,0 +1,26 @@
1<?xml version="1.0" encoding="utf-8"?>
2
3<!--
4 Copyright (C) 2014 Akretion (http://www.akretion.com/)
5 @author Alexis de Lattre <alexis.delattre@akretion.com>
6 The licence is in the file __openerp__.py
7-->
8
9<openerp>
10<data>
11
12<record id="purchase_order_form" model="ir.ui.view">
13 <field name="name">account_payment_purchase.purchase_order.form</field>
14 <field name="model">purchase.order</field>
15 <field name="inherit_id" ref="purchase.purchase_order_form"/>
16 <field name="arch" type="xml">
17 <field name="payment_term_id" position="after">
18 <field name="payment_mode_id"/>
19 <field name="supplier_partner_bank_id"
20 domain="[('partner_id', '=', partner_id)]" />
21 </field>
22 </field>
23</record>
24
25</data>
26</openerp>
027
=== added directory 'account_payment_sale'
=== added file 'account_payment_sale/__init__.py'
--- account_payment_sale/__init__.py 1970-01-01 00:00:00 +0000
+++ account_payment_sale/__init__.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,23 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Sale module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from . import model
024
=== added file 'account_payment_sale/__openerp__.py'
--- account_payment_sale/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_payment_sale/__openerp__.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,55 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Sale module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com).
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23{
24 'name': 'Account Payment Sale',
25 'version': '1.0',
26 'category': 'Banking addons',
27 'license': 'AGPL-3',
28 'summary': "Adds Payment Mode on Sale Orders",
29 'description': """
30Account Payment Sale
31====================
32
33This modules adds one field on sale orders : *Payment Mode*.
34This field is copied from partner to sale order and then from sale order to
35customer invoice.
36
37This module is similar to the *sale_payment* module ; the main difference is
38that it doesn't depend on the *account_payment_extension* module (it's not the
39only module to conflict with *account_payment_extension* ; all the SEPA
40modules in the banking addons conflict with *account_payment_extension*, cf
41banking-addons-70/account_banking_payment_export/__openerp__.py).
42
43Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com>
44for any help or question about this module.
45 """,
46 'author': 'Akretion',
47 'website': 'http://www.akretion.com',
48 'depends': ['sale', 'account_payment_partner'],
49 'conflicts': ['sale_payment'],
50 'data': [
51 'view/sale.xml',
52 ],
53 'installable': True,
54 'active': False,
55}
056
=== added directory 'account_payment_sale/i18n'
=== added file 'account_payment_sale/i18n/account_payment_sale.pot'
--- account_payment_sale/i18n/account_payment_sale.pot 1970-01-01 00:00:00 +0000
+++ account_payment_sale/i18n/account_payment_sale.pot 2014-06-23 09:47:35 +0000
@@ -0,0 +1,27 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * account_payment_sale
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-06-09 23:24+0000\n"
10"PO-Revision-Date: 2014-06-09 23:24+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: account_payment_sale
19#: field:sale.order,payment_mode_id:0
20msgid "Payment Mode"
21msgstr ""
22
23#. module: account_payment_sale
24#: model:ir.model,name:account_payment_sale.model_sale_order
25msgid "Sales Order"
26msgstr ""
27
028
=== added directory 'account_payment_sale/model'
=== added file 'account_payment_sale/model/__init__.py'
--- account_payment_sale/model/__init__.py 1970-01-01 00:00:00 +0000
+++ account_payment_sale/model/__init__.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,23 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Sale module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from . import sale
024
=== added file 'account_payment_sale/model/sale.py'
--- account_payment_sale/model/sale.py 1970-01-01 00:00:00 +0000
+++ account_payment_sale/model/sale.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,55 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Sale module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.osv import orm, fields
24
25
26class sale_order(orm.Model):
27 _inherit = "sale.order"
28
29 _columns = {
30 'payment_mode_id': fields.many2one(
31 'payment.mode', 'Payment Mode'),
32 }
33
34 def onchange_partner_id(self, cr, uid, ids, part, context=None):
35 res = super(sale_order, self).onchange_partner_id(
36 cr, uid, ids, part, context=context)
37 if part:
38 partner = self.pool['res.partner'].browse(
39 cr, uid, part, context=context)
40 res['value']['payment_mode_id'] = \
41 partner.customer_payment_mode.id or False,
42 else:
43 res['value']['payment_mode_id'] = False
44 return res
45
46 def _prepare_invoice(self, cr, uid, order, lines, context=None):
47 """Copy bank partner from sale order to invoice"""
48 invoice_vals = super(sale_order, self)._prepare_invoice(
49 cr, uid, order, lines, context=context)
50 invoice_vals.update({
51 'payment_mode_id': order.payment_mode_id.id or False,
52 'partner_bank_id': order.payment_mode_id and
53 order.payment_mode_id.bank_id.id or False,
54 })
55 return invoice_vals
056
=== added directory 'account_payment_sale/view'
=== added file 'account_payment_sale/view/sale.xml'
--- account_payment_sale/view/sale.xml 1970-01-01 00:00:00 +0000
+++ account_payment_sale/view/sale.xml 2014-06-23 09:47:35 +0000
@@ -0,0 +1,24 @@
1<?xml version="1.0" encoding="utf-8"?>
2
3<!--
4 Copyright (C) 2014 Akretion (http://www.akretion.com/)
5 @author Alexis de Lattre <alexis.delattre@akretion.com>
6 The licence is in the file __openerp__.py
7-->
8
9<openerp>
10<data>
11
12<record id="view_order_form" model="ir.ui.view">
13 <field name="name">account_payment_sale.sale_order.form</field>
14 <field name="model">sale.order</field>
15 <field name="inherit_id" ref="sale.view_order_form"/>
16 <field name="arch" type="xml">
17 <field name="payment_term" position="after">
18 <field name="payment_mode_id"/>
19 </field>
20 </field>
21</record>
22
23</data>
24</openerp>
025
=== added directory 'account_payment_sale_stock'
=== added file 'account_payment_sale_stock/__init__.py'
--- account_payment_sale_stock/__init__.py 1970-01-01 00:00:00 +0000
+++ account_payment_sale_stock/__init__.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,23 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Sale Stock module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from . import model
024
=== added file 'account_payment_sale_stock/__openerp__.py'
--- account_payment_sale_stock/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_payment_sale_stock/__openerp__.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,46 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Sale Stock module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com).
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23{
24 'name': 'Account Payment Sale Stock',
25 'version': '1.0',
26 'category': 'Banking addons',
27 'license': 'AGPL-3',
28 'summary': "Manage Payment Mode when invoicing from picking",
29 'description': """
30Account Payment Sale Stock
31==========================
32
33This modules copies *Payment Mode* from Sale Order to Invoice when the
34Invoice is generated from the Picking.
35
36Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com>
37for any help or question about this module.
38 """,
39 'author': 'Akretion',
40 'website': 'http://www.akretion.com',
41 'depends': ['sale_stock', 'account_payment_sale'],
42 'conflicts': ['account_payment_extension'],
43 'data': [],
44 'auto_install': True,
45 'active': False,
46}
047
=== added directory 'account_payment_sale_stock/model'
=== added file 'account_payment_sale_stock/model/__init__.py'
--- account_payment_sale_stock/model/__init__.py 1970-01-01 00:00:00 +0000
+++ account_payment_sale_stock/model/__init__.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,23 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Sale Stock module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from . import stock
024
=== added file 'account_payment_sale_stock/model/stock.py'
--- account_payment_sale_stock/model/stock.py 1970-01-01 00:00:00 +0000
+++ account_payment_sale_stock/model/stock.py 2014-06-23 09:47:35 +0000
@@ -0,0 +1,43 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Account Payment Sale Stock module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.osv import orm
24
25
26class stock_picking(orm.Model):
27 _inherit = "stock.picking"
28
29 def _prepare_invoice(
30 self, cr, uid, picking, partner, inv_type, journal_id,
31 context=None):
32 """Copy payment mode from sale order to invoice"""
33 invoice_vals = super(stock_picking, self)._prepare_invoice(
34 cr, uid, picking, partner, inv_type, journal_id, context=context)
35 if picking.sale_id:
36 invoice_vals.update({
37 'partner_bank_id':
38 picking.sale_id.payment_mode_id and
39 picking.sale_id.payment_mode_id.bank_id.id or False,
40 'payment_mode_id':
41 picking.sale_id.payment_mode_id.id or False,
42 })
43 return invoice_vals

Subscribers

People subscribed via source and target branches

to status/vote changes: