[MIG] base_transaction_id: Migrated to 7.0

- Adapt import to fit last recomandation
- Import osv for osv.except
- pep8, pylint, eyeballing
- standardize the naming of the argument 'cr' instead of 'cursor'
- Remove the active key in the __openerp__.py
This commit is contained in:
Joel Grand-Guillaume
2012-12-19 13:58:54 +01:00
committed by Iryna Vyshnevska
parent 6bb761c3a4
commit 1f95188aed
4 changed files with 54 additions and 34 deletions

View File

@@ -24,23 +24,34 @@
'author': 'Camptocamp',
'maintainer': 'Camptocamp',
'category': 'Hidden/Dependency',
'complexity': 'easy', #easy, normal, expert
'depends': ['account', 'sale','stock'],
'complexity': 'easy',
'depends': [
'account',
'sale',
'stock'
],
'description': """
Adds transaction id to invoice and sale models and views. On Sales order, you can specify the transaction ID
used for the payment and it will be propagated to the invoice (even if made from packing).
This is mostly used for e-commerce handling. You can then add a mapping on that SO field to save the e-commerce
financial Transaction ID into the OpenERP SO field. The main purpose is to ease the reconciliation process and
Adds transaction id to invoice and sale models and views.
On Sales order, you can specify the transaction ID used
for the payment and it will be propagated to the invoice
(even if made from packing).
This is mostly used for e-commerce handling.
You can then add a mapping on that SO field to save
the e-commerce financial Transaction ID into the
OpenERP sale order field.
The main purpose is to ease the reconciliation process and
be able to find the partner when importing the bank statement.
""",
'website': 'http://www.openerp.com',
'init_xml': [],
'update_xml': ['invoice_view.xml', 'sale_view.xml'],
'update_xml': [
'invoice_view.xml',
'sale_view.xml'
],
'demo_xml': [],
'test': [],
'installable': True,
'images': [],
'auto_install': False,
'license': 'AGPL-3',
'active': False,
}

View File

@@ -19,17 +19,18 @@
#
##############################################################################
from osv import fields, osv
from tools.translate import _
from openerp.osv.orm import Model
from openerp.osv import fields
class AccountInvoice(osv.osv):
class AccountInvoice(Model):
_inherit = 'account.invoice'
_columns = {
'transaction_id':fields.char(
'transaction_id': fields.char(
'Transaction id',
size=128,
required=False,
select=1,
help="Transction id from the financial institute"
),
help="Transction id from the financial institute"),
}

View File

@@ -19,21 +19,25 @@
#
##############################################################################
from osv import fields, osv
from openerp.osv.orm import Model
from openerp.osv import fields
class SaleOrder(osv.osv):
class SaleOrder(Model):
_inherit = 'sale.order'
_columns = {
'transaction_id':fields.char('Transaction id', size=128,required=False,
help="Transction id from the financial institute"),
'transaction_id': fields.char(
'Transaction id',
size=128,
required=False,
help="Transaction id from the financial institute"),
}
def _prepare_invoice(self, cursor, uid, order, lines, context=None):
def _prepare_invoice(self, cr, uid, order, lines, context=None):
#we put the transaction id in the generated invoices
if context is None:
context = {}
invoice_vals = super(SaleOrder, self)._prepare_invoice(cursor, uid, order, lines, context)
invoice_vals = super(SaleOrder, self)._prepare_invoice(
cr, uid, order, lines, context=context)
invoice_vals.update({
'transaction_id': order.transaction_id})
return invoice_vals

View File

@@ -19,20 +19,24 @@
#
##############################################################################
from osv import osv
from openerp.osv.orm import Model
class StockPicking(osv.osv):
class StockPicking(Model):
_inherit = "stock.picking"
def action_invoice_create(self, cursor, uid, ids, journal_id=False,
group=False, type='out_invoice', context=None):
res = super(StockPicking, self).action_invoice_create(cursor, uid, ids,
journal_id,group, type, context)
def action_invoice_create(
self, cr, uid, ids, journal_id=False, group=False,
type='out_invoice', context=None):
res = super(StockPicking, self).action_invoice_create(
cr, uid, ids, journal_id, group, type, context)
for pick_id in res:
pick = self.browse(cursor, uid, pick_id)
pick = self.browse(cr, uid, pick_id, context=context)
if pick.sale_id and pick.sale_id.transaction_id:
self.pool.get('account.invoice').write(cursor,
uid,
res[pick_id],
{'transaction_id': pick.sale_id.transaction_id})
self.pool.get('account.invoice').write(
cr,
uid,
res[pick_id],
{'transaction_id': pick.sale_id.transaction_id},
context=context)
return res