summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis de Lattre <alexis@via.ecp.fr>2012-01-19 22:40:53 +0100
committerAlexis de Lattre <alexis@via.ecp.fr>2012-01-19 22:40:53 +0100
commit7b6622a2ebff7e1ace500e88d8a63592f2c0ea95 (patch)
treef55ddade00df68bca7bca08552b8df9f7c303901
parent13e80f5e0e7ad934d386c06ce3ead24d5298a5fe (diff)
Document the new methods I introduced with the standard @param and @return syntax
Remove a print bzr revid: alexis@via.ecp.fr-20120119214053-8tf189abeszi208b
-rw-r--r--addons/purchase/stock.py3
-rw-r--r--addons/sale/stock.py3
-rw-r--r--addons/stock/stock.py28
3 files changed, 29 insertions, 5 deletions
diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py
index acb4ae13c05..e9346d230d9 100644
--- a/addons/purchase/stock.py
+++ b/addons/purchase/stock.py
@@ -59,6 +59,9 @@ class stock_picking(osv.osv):
}
def _get_partner_to_invoice(self, cr, uid, picking, context=None):
+ """Inherit the original function of the 'stock' module
+ We select the partner of the sale order as the partner of the customer invoice
+ """
if picking.purchase_id:
return picking.purchase_id.partner_id
return super(stock_picking, self)._get_partner_to_invoice(cr, uid, picking, context=context)
diff --git a/addons/sale/stock.py b/addons/sale/stock.py
index f42f09eb20c..e78f3c77e33 100644
--- a/addons/sale/stock.py
+++ b/addons/sale/stock.py
@@ -49,6 +49,9 @@ class stock_picking(osv.osv):
return super(stock_picking, self).get_currency_id(cursor, user, picking)
def _get_partner_to_invoice(self, cr, uid, picking, context=None):
+ """Inherit the original function of the 'stock' module
+ We select the partner of the sale order as the partner of the customer invoice
+ """
if picking.sale_id:
return picking.sale_id.partner_id
return super(stock_picking, self)._get_partner_to_invoice(cr, uid, picking, context=context)
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index e16b982aee9..5942e148df5 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -878,7 +878,8 @@ class stock_picking(osv.osv):
def _get_partner_to_invoice(self, cr, uid, picking, context=None):
""" Gets the partner that will be invoiced
Note that this function is inherited in the sale module
- @return: partner object
+ @param picking: object of the picking for which we are selecting the partner to invoice
+ @return: object of the partner to invoice
"""
return picking.address_id and picking.address_id.partner_id
@@ -961,7 +962,12 @@ class stock_picking(osv.osv):
return inv_type
def _prepare_invoice_group(self, cr, uid, picking, partner, invoice, context=None):
- """Builds the dict for grouped invoices"""
+ """Builds the dict for grouped invoices
+ @param picking: picking object
+ @param partner: object of the partner to invoice (not used here, but may be usefull if this function is inherited)
+ @param invoice: object of the invoice that we are updating
+ @return: dict that will be used to update the invoice
+ """
comment = self._get_comment_invoice(cr, uid, picking)
return {
@@ -973,7 +979,13 @@ class stock_picking(osv.osv):
}
def _prepare_invoice(self, cr, uid, picking, partner, inv_type, journal_id, context=None):
- """Builds the dict containing the values for the invoice"""
+ """Builds the dict containing the values for the invoice
+ @param picking: picking object
+ @param partner: object of the partner to invoice
+ @param inv_type: type of the invoice ('out_invoice', 'in_invoice', ...)
+ @param journal_id: ID of the accounting journal
+ @return: dict that will be used to create the invoice object
+ """
if inv_type in ('out_invoice', 'out_refund'):
account_id = partner.property_account_receivable.id
else:
@@ -1007,7 +1019,14 @@ class stock_picking(osv.osv):
def _prepare_invoice_line(self, cr, uid, group, picking, move_line, invoice_id,
invoice_vals, context=None):
- """Builds the dict containing the values for the invoice line"""
+ """Builds the dict containing the values for the invoice line
+ @param group: True or False
+ @param picking: picking object
+ @param: move_line: move_line object
+ @param: invoice_id: ID of the related invoice
+ @param: invoice_vals: dict used to created the invoice
+ @return: dict that will be used to create the invoice line
+ """
if group:
name = (picking.name or '') + '-' + move_line.name
else:
@@ -1092,7 +1111,6 @@ class stock_picking(osv.osv):
for move_line in picking.move_lines:
if move_line.state == 'cancel':
continue
- print "invoice_vals=", invoice_vals
invoice_line_id = invoice_line_obj.create(cr, uid,
self._prepare_invoice_line(cr, uid, group, picking, move_line,
invoice_id, invoice_vals, context=context),