Bharat Devnani (Open ERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-bug-861306-bde into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
Related bugs:
Bug #861306 in OpenERP Addons: "salesman for invoices created from a picking"
https://bugs.launchpad.net/openobject-addons/+bug/861306
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-861306-bde/+merge/77466
Hello Sir,
I have made some modifications in sale.py of Sale Module and made modifications
in stock.py of Stock Module suggested by Manu, the changes are related to users.
Thanks & Regards,
Devnani Bharat R.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-861306-bde/+merge/77466
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-bug-861306-bde.
=== modified file 'sale/sale.py'
--- sale/sale.py 2011-09-27 15:44:36 +0000
+++ sale/sale.py 2011-09-29 07:13:21 +0000
@@ -105,11 +105,11 @@
procurement_order mp on (mp.move_id=m.id)
WHERE
p.sale_id IN %s GROUP BY m.state, mp.state, p.sale_id, p.type''', (tuple(ids),))
-
+
for item in cr.dictfetchall():
if item['move_state'] == 'cancel':
continue
-
+
if item['picking_type'] == 'in':#this is a returned picking
tmp[item['sale_order_id']]['total'] -= item['nbr'] or 0.0 # Deducting the return picking qty
if item['procurement_state'] == 'done' or item['move_state'] == 'done':
@@ -124,7 +124,7 @@
res[order.id] = 100.0
else:
res[order.id] = tmp[order.id]['total'] and (100.0 * tmp[order.id]['picked'] / tmp[order.id]['total']) or 0.0
- return res
+ return res
def _invoiced_rate(self, cursor, user, ids, name, arg, context=None):
res = {}
@@ -341,14 +341,13 @@
pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False
payment_term = part.property_payment_term and part.property_payment_term.id or False
fiscal_position = part.property_account_position and part.property_account_position.id or False
- dedicated_salesman = part.user_id and part.user_id.id or uid
val = {
'partner_invoice_id': addr['invoice'],
'partner_order_id': addr['contact'],
'partner_shipping_id': addr['delivery'],
'payment_term': payment_term,
'fiscal_position': fiscal_position,
- 'user_id': dedicated_salesman,
+ 'user_id': uid,
}
if pricelist:
val['pricelist_id'] = pricelist
@@ -730,7 +729,7 @@
'company_id': order.company_id.id,
'price_unit': line.product_id.standard_price or 0.0
})
-
+
if line.product_id:
proc_id = self.pool.get('procurement.order').create(cr, uid, {
'name': line.name,
@@ -866,7 +865,7 @@
return result[1]
except Exception, ex:
return False
-
+
_name = 'sale.order.line'
_description = 'Sales Order Line'
_columns = {
@@ -1070,7 +1069,7 @@
if not packaging and product_obj.packaging:
packaging = product_obj.packaging[0].id
result['product_packaging'] = packaging
-
+
if packaging:
default_uom = product_obj.uom_id and product_obj.uom_id.id
pack = self.pool.get('product.packaging').browse(cr, uid, packaging, context=context)
@@ -1152,7 +1151,7 @@
max(0,product_obj.qty_available), product_obj.uom_id.name)
warning_msgs += _("Not enough stock ! : ") + warn_msg + "\n\n"
# get unit price
-
+
if not pricelist:
warn_msg = _('You have to select a pricelist or a customer in the sales form !\n'
'Please set one before choosing a product.')
@@ -1173,7 +1172,7 @@
if warning_msgs:
warning = {
'title': _('Configuration Error !'),
- 'message' : warning_msgs
+ 'message' : warning_msgs
}
return {'value': result, 'domain': domain, 'warning': warning}
@@ -1253,7 +1252,7 @@
menu_name = 'menu_invoicing_sales_order_lines'
data_id = data_obj.name_search(cr, uid, menu_name)
menu_id = data_obj.browse(cr,uid,data_id[0][0]).res_id
- menu_obj.write(cr, uid, menu_id, {'groups_id':[(4,group_ids[0]),(4,group_ids[1])]})
+ menu_obj.write(cr, uid, menu_id, {'groups_id':[(4,group_ids[0]),(4,group_ids[1])]})
if wizard.deli_orders:
menu_name = 'menu_action_picking_list_to_invoice'
@@ -1269,7 +1268,7 @@
module_name.append('account_analytic_analysis')
if wizard.charge_delivery:
- module_name.append('delivery')
+ module_name.append('delivery')
if wizard.time_unit:
product_obj = self.pool.get('product.product')
@@ -1292,7 +1291,7 @@
if need_install:
pooler.restart_pool(cr.dbname, update_module=True)[1]
- ir_values_obj.set(cr, uid, 'default', False, 'order_policy', ['sale.order'], wizard.order_policy)
+ ir_values_obj.set(cr, uid, 'default', False, 'order_policy', ['sale.order'], wizard.order_policy)
sale_config_picking_policy()
=== modified file 'stock/stock.py'
--- stock/stock.py 2011-09-27 21:38:03 +0000
+++ stock/stock.py 2011-09-29 07:13:21 +0000
@@ -1003,8 +1003,8 @@
'name': (invoice.name or '') + ', ' + (picking.name or ''),
'origin': (invoice.origin or '') + ', ' + (picking.name or '') + (picking.origin and (':' + picking.origin) or ''),
'comment': (comment and (invoice.comment and invoice.comment+"\n"+comment or comment)) or (invoice.comment and invoice.comment or ''),
- 'date_invoice':context.get('date_inv',False),
- 'user_id':uid
+ 'date_invoice': context.get('date_inv',False),
+ 'user_id': picking.sale_id and picking.sale_id.user_id and picking.sale_id.user_id.id or False
}
invoice_obj.write(cr, uid, [invoice_id], invoice_vals, context=context)
else:
@@ -1021,7 +1021,7 @@
'fiscal_position': partner.property_account_position.id,
'date_invoice': context.get('date_inv',False),
'company_id': picking.company_id.id,
- 'user_id':uid
+ 'user_id': picking.sale_id and picking.sale_id.user_id and picking.sale_id.user_id.id or False
}
cur_id = self.get_currency_id(cr, uid, picking)
if cur_id:
@@ -1774,7 +1774,7 @@
def onchange_date(self, cr, uid, ids, date, date_expected, context=None):
""" On change of Scheduled Date gives a Move date.
- @param date_expected: Scheduled Date
+ @param date_expected: Scheduled Date
@param date: Move Date
@return: Move Date
"""
@@ -2237,7 +2237,7 @@
return super(stock_move, self).unlink(
cr, uid, ids, context=ctx)
- # _create_lot function is not used anywhere
+ # _create_lot function is not used anywhere
def _create_lot(self, cr, uid, ids, product_id, prefix=False):
""" Creates production lot
@return: Production lot id
@@ -2283,7 +2283,7 @@
self.action_done(cr, uid, res)
return res
- # action_split function is not used anywhere
+ # action_split function is not used anywhere
def action_split(self, cr, uid, ids, quantity, split_by_qty=1, prefix=False, with_lot=True, context=None):
""" Split Stock Move lines into production lot which specified split by quantity.
@param cr: the database cursor
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp