c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #28289
[Bug 808567] Re: stock.py: Improvement in code when selecting account partner
The code is working fine but it is strictly not correct as it makes the
assumption that that the delivery partner is the same as the invoice
partner. In the current OpenERP model this assumption is correct and
hence this is why you do not see a problem. However, we are trying to
implement a module that models the franchise situation where the
delivery customer is different from the invoice customer. We would
rather not make changes to the base add-ons to accomplish this and the
change we propose is equally applicable to the base as it is to our
requirements - hence this is why we propose this modification.
--
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/808567
Title:
stock.py: Improvement in code when selecting account partner
Status in OpenERP Modules (addons):
Incomplete
Bug description:
The selection of the account partner in stock.py, whilst correct
within the current OpenERP model, is not "strictly" correct as it
assumes the delivery address partner is the account partner. We
propose the following simple change which corrects this issue as we
needed to make this change whilst implementing a franchise sub-partner
payment model. Diff below:
=== modified file 'stock/stock.py'
--- stock/stock.py 2011-06-01 21:07:58 +0000
+++ stock/stock.py 2011-07-11 00:43:43 +0000
@@ -979,6 +979,10 @@
continue
payment_term_id = False
partner = picking.address_id and picking.address_id.partner_id
+
+ if picking.sale_id:
+ partner = picking.sale_id.partner_id
+
if not partner:
raise osv.except_osv(_('Error, no partner !'),
_('Please put a partner on the picking list if you want to generate invoice.'))
@@ -1009,12 +1013,13 @@
}
invoice_obj.write(cr, uid, [invoice_id], invoice_vals, context=context)
else:
+
invoice_vals = {
'name': picking.name,
'origin': (picking.name or '') + (picking.origin and (':' + picking.origin) or ''),
'type': inv_type,
'account_id': account_id,
- 'partner_id': address.partner_id.id,
+ 'partner_id': partner.id,
'address_invoice_id': address_invoice_id,
'address_contact_id': address_contact_id,
'comment': comment,
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/808567/+subscriptions
References