[MERGE]: Merge with lp:openobject-trunk-dev-addons2

bzr revid: ksa@tinyerp.co.in-20101115045510-0qmgqiz8n20fmtnm
This commit is contained in:
ksa (Open ERP)
2010-11-15 10:25:10 +05:30
16 changed files with 146 additions and 90 deletions
+1 -1
View File
@@ -67,4 +67,4 @@
"access_stock_picking_mrp_manager","stock.picking mrp_manager","stock.model_stock_picking","mrp.group_mrp_manager",1,0,0,0
"access_report_mrp_inout_user","report.mrp.inout user","model_report_mrp_inout","mrp.group_mrp_user",1,0,0,0
"access_report_workcenter_load_user","report.workcenter.load.user","model_report_workcenter_load","mrp.group_mrp_user",1,0,0,0
"access_mrp_production","mrp.production user","model_mrp_production","purchase.group_purchase_user",1,0,0,0
"access_mrp_bom","mrp.bom","model_mrp_bom","base.group_sale_salesman",1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
67 access_stock_picking_mrp_manager stock.picking mrp_manager stock.model_stock_picking mrp.group_mrp_manager 1 0 0 0
68 access_report_mrp_inout_user report.mrp.inout user model_report_mrp_inout mrp.group_mrp_user 1 0 0 0
69 access_report_workcenter_load_user report.workcenter.load.user model_report_workcenter_load mrp.group_mrp_user 1 0 0 0
70 access_mrp_production access_mrp_bom mrp.production user mrp.bom model_mrp_production model_mrp_bom purchase.group_purchase_user base.group_sale_salesman 1 0 0 0
+1 -1
View File
@@ -26,7 +26,7 @@ class mrp_product_produce(osv.osv_memory):
_description = "Product Produce"
_columns = {
'product_qty': fields.float('Quantity', required=True),
'product_qty': fields.float('Select Quantity', required=True),
'mode': fields.selection([('consume_produce', 'Consume & Produce'),
('consume', 'Consume Only')], 'Mode', required=True,
help="'Consume only' mode will only consume the products with the quantity selected.\n"
+2 -2
View File
@@ -69,7 +69,7 @@ class product_uom(osv.osv):
'name': fields.char('Name', size=64, required=True, translate=True),
'category_id': fields.many2one('product.uom.categ', 'UoM Category', required=True, ondelete='cascade',
help="Quantity conversions may happen automatically between Units of Measure in the same category, according to their respective ratios."),
'factor': fields.float('Ratio', required=True,digits=(12, 6),
'factor': fields.float('Ratio', required=True,digits=(12, 12),
help='How many times this UoM is smaller than the reference UoM in this category:\n'\
'1 * (reference unit) = ratio * (this unit)'),
'factor_inv': fields.function(_factor_inv, digits_compute=dp.get_precision('Product UoM'),
@@ -347,7 +347,7 @@ class product_product(osv.osv):
def _product_price(self, cr, uid, ids, name, arg, context={}):
res = {}
quantity = context.get('quantity', 1)
quantity = context.get('quantity') or 1.0
pricelist = context.get('pricelist', False)
if pricelist:
for id in ids:
+6 -7
View File
@@ -45,19 +45,19 @@ class stock_production_lot(osv.osv):
_columns = {
'life_date': fields.datetime('End of Life Date',
help='The date the lot may become dangerous and should not be consumed.'),
help='The date on which the lot may become dangerous and should not be consumed.'),
'use_date': fields.datetime('Best before Date',
help='The date the lot starts deteriorating without becoming dangerous.'),
help='The date on which the lot starts deteriorating without becoming dangerous.'),
'removal_date': fields.datetime('Removal Date',
help='The date the lot should be removed.'),
'alert_date': fields.datetime('Alert Date', help="The date signifying an alert to notify about the production lot."),
help='The date on which the lot should be removed.'),
'alert_date': fields.datetime('Alert Date', help="The date on which an alert should be notified about the production lot."),
}
# Assign dates according to products data
def create(self, cr, uid, vals, context=None):
newid = super(stock_production_lot, self).create(cr, uid, vals, context=context)
obj = self.browse(cr, uid, newid, context=context)
towrite = []
for f in ('life_date','use_date','removal_date','alert_date'):
for f in ('life_date', 'use_date', 'removal_date', 'alert_date'):
if not getattr(obj, f):
towrite.append(f)
context = context or {}
@@ -82,8 +82,7 @@ class product_product(osv.osv):
help='The number of days before a production lot starts deteriorating without becoming dangerous.'),
'removal_time': fields.integer('Product Removal Time',
help='The number of days before a production lot should be removed.'),
'alert_time': fields.integer('Product Alert Time', help="The number of days after which, needs an alert to notify about the production lot."),
'alert_time': fields.integer('Product Alert Time', help="The number of days after which an alert should be notified about the production lot."),
}
product_product()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -43,7 +43,7 @@ class sale_order_line(osv.osv):
uom=False, qty_uos=0, uos=False, name='', partner_id=False,
lang=False, update_tax=True,date_order=False,packaging=False,fiscal_position=False, flag=False):
def get_real_price(res_dict, product_id, pricelist):
def get_real_price(res_dict, product_id, qty, uom, pricelist):
item_obj = self.pool.get('product.pricelist.item')
price_type_obj = self.pool.get('product.price.type')
product_obj = self.pool.get('product.product')
@@ -56,10 +56,17 @@ class sale_order_line(osv.osv):
if item_base > 0:
field_name = price_type_obj.browse(cr, uid, item_base).field
product_tmpl_id = product_obj.browse(cr, uid, product_id, context).product_tmpl_id.id
product = product_obj.browse(cr, uid, product_id, context)
product_tmpl_id = product.product_tmpl_id.id
product_read = template_obj.read(cr, uid, product_tmpl_id, [field_name], context)
return product_read[field_name]
factor = 1.0
if uom and uom != product.uom_id.id:
product_uom_obj = self.pool.get('product.uom')
uom_data = product_uom_obj.browse(cr, uid, product.uom_id.id)
factor = uom_data.factor
return product_read[field_name] * factor
res=super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty,
@@ -84,7 +91,7 @@ class sale_order_line(osv.osv):
pricelists = pricelist_obj.read(cr,uid,[pricelist],['visible_discount'])
old_uom = product.uos_id or product.uom_id
new_list_price = get_real_price(list_price, product.id, pricelist)
new_list_price = get_real_price(list_price, product.id, qty, uom, pricelist)
if(len(pricelists)>0 and pricelists[0]['visible_discount'] and list_price[pricelist] != 0):
discount = (new_list_price - price) / new_list_price * 100
result['price_unit'] = new_list_price
@@ -101,7 +108,7 @@ class account_invoice_line(osv.osv):
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context={}):
res = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context)
def get_real_price(res_dict, product_id, pricelist):
def get_real_price(res_dict, product_id, qty, uom, pricelist):
item_obj = self.pool.get('product.pricelist.item')
price_type_obj = self.pool.get('product.price.type')
product_obj = self.pool.get('product.product')
@@ -114,10 +121,17 @@ class account_invoice_line(osv.osv):
if item_base > 0:
field_name = price_type_obj.browse(cr, uid, item_base).field
product_tmpl_id = product_obj.browse(cr, uid, product_id, context).product_tmpl_id.id
product = product_obj.browse(cr, uid, product_id, context)
product_tmpl_id = product.product_tmpl_id.id
product_read = template_obj.read(cr, uid, product_tmpl_id, [field_name], context)
return product_read[field_name]
factor = 1.0
if uom and uom != product.uom_id.id:
product_uom_obj = self.pool.get('product.uom')
uom_data = product_uom_obj.browse(cr, uid, product.uom_id.id)
factor = uom_data.factor
return product_read[field_name] * factor
if product:
pricelist_obj = self.pool.get('product.pricelist')
@@ -133,7 +147,7 @@ class account_invoice_line(osv.osv):
raise osv.except_osv(_('No Purchase Pricelist Found !'),_("You must first define a pricelist for Supplier !"))
price_unit_res = pricelist_obj.price_get(cr, uid, [pricelist], product.id, qty or 1.0, partner_id, {'uom': uom})[pricelist]
price_unit = price_unit_res[pricelist]
real_price = get_real_price(price_unit_res, product.id, pricelist)
real_price = get_real_price(price_unit_res, product.id, qty, uom, pricelist)
else:
if partner_id:
pricelist = partner_obj.browse(cr, uid, partner_id).property_product_pricelist.id
@@ -142,7 +156,7 @@ class account_invoice_line(osv.osv):
price_unit_res = pricelist_obj.price_get(cr, uid, [pricelist], product.id, qty or 1.0, partner_id, {'uom': uom})
price_unit = price_unit_res[pricelist]
real_price = get_real_price(price_unit_res, product.id, pricelist)
real_price = get_real_price(price_unit_res, product.id, qty, uom, pricelist)
if pricelist:
pricelists=pricelist_obj.read(cr,uid,[pricelist],['visible_discount'])
if(len(pricelists)>0 and pricelists[0]['visible_discount'] and real_price != 0):
@@ -138,7 +138,7 @@
pick_ids = [x.id for x in pur_id1.picking_ids]
id = self.create(cr, uid, {'invoice_date': '2010-05-11', 'journal_id': ref('account.expenses_journal')},
{'active_ids': pick_ids})
self.create_invoice(cr, uid, [id], {"active_ids": pick_ids})
self.create_invoice(cr, uid, [id], {"active_ids": pick_ids, "active_id": pick_ids[0]})
-
I check that an invoice_id field of Delivery&Invoices gets bind with the value.
-
+1 -1
View File
@@ -1,5 +1,5 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_sale_shop","sale.shop","model_sale_shop","base.group_user",1,0,0,0
"access_sale_shop","sale.shop","model_sale_shop","base.group_user",1,1,0,0
"access_sale_order","sale.order","model_sale_order","base.group_sale_salesman",1,1,1,0
"access_sale_order_line","sale.order.line","model_sale_order_line","base.group_sale_salesman",1,1,1,1
"access_account_invoice_tax_salesman","account_invoice_tax salesman","account.model_account_invoice_tax","base.group_sale_salesman",1,1,1,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_sale_shop sale.shop model_sale_shop base.group_user 1 0 1 0 0
3 access_sale_order sale.order model_sale_order base.group_sale_salesman 1 1 1 0
4 access_sale_order_line sale.order.line model_sale_order_line base.group_sale_salesman 1 1 1 1
5 access_account_invoice_tax_salesman account_invoice_tax salesman account.model_account_invoice_tax base.group_sale_salesman 1 1 1 0
+1 -1
View File
@@ -74,7 +74,7 @@
ids = [x.id for x in sale_id.picking_ids]
wiz_id = self.create(cr, uid, {'invoice_date': '2010-07-17', 'journal_id': ref('account.sales_journal')},
{'active_ids': ids})
self.create_invoice(cr, uid, [wiz_id], {"active_ids": ids})
self.create_invoice(cr, uid, [wiz_id], {"active_ids": ids, "active_id": ids[0]})
-
I verify whether the invoice has been generated for SO
-
+1 -1
View File
@@ -67,7 +67,7 @@
ids = [x.id for x in sale_id.picking_ids]
wiz_id = self.create(cr, uid, {'invoice_date': '2010-07-15', 'journal_id': ref('account.sales_journal')},
{'active_ids': ids})
self.create_invoice(cr, uid, [wiz_id], {"active_ids": ids})
self.create_invoice(cr, uid, [wiz_id], {"active_ids": ids, "active_id": ids[0]})
-
I check that an invoice has been created.
-
+33 -11
View File
@@ -930,6 +930,25 @@ class stock_picking(osv.osv):
'''Call after the creation of the invoice'''
return
def _get_invoice_type(self, pick):
src_usage = dest_usage = None
inv_type = None
if pick.invoice_state == '2binvoiced':
if pick.move_lines:
src_usage = pick.move_lines[0].location_id.usage
dest_usage = pick.move_lines[0].location_dest_id.usage
if pick.type == 'out' and dest_usage == 'supplier':
inv_type = 'in_refund'
elif pick.type == 'out' and dest_usage == 'customer':
inv_type = 'out_invoice'
elif pick.type == 'in' and src_usage == 'supplier':
inv_type = 'in_invoice'
elif pick.type == 'in' and src_usage == 'customer':
inv_type = 'out_refund'
else:
inv_type = 'out_invoice'
return inv_type
def action_invoice_create(self, cr, uid, ids, journal_id=False,
group=False, type='out_invoice', context=None):
""" Creates invoice based on the invoice state selected for picking.
@@ -945,7 +964,7 @@ class stock_picking(osv.osv):
invoice_line_obj = self.pool.get('account.invoice.line')
invoices_group = {}
res = {}
inv_type = type
for picking in self.browse(cr, uid, ids, context=context):
if picking.invoice_state != '2binvoiced':
continue
@@ -954,8 +973,11 @@ class stock_picking(osv.osv):
if not partner:
raise osv.except_osv(_('Error, no partner !'),
_('Please put a partner on the picking list if you want to generate invoice.'))
if not inv_type:
inv_type = self._get_invoice_type(picking)
if type in ('out_invoice', 'out_refund'):
if inv_type in ('out_invoice', 'out_refund'):
account_id = partner.property_account_receivable.id
payment_term_id = self._get_payment_term(cr, uid, picking)
else:
@@ -980,7 +1002,7 @@ class stock_picking(osv.osv):
invoice_vals = {
'name': picking.name,
'origin': (picking.name or '') + (picking.origin and (':' + picking.origin) or ''),
'type': type,
'type': inv_type,
'account_id': account_id,
'partner_id': partner.id,
'address_invoice_id': address_invoice_id,
@@ -1012,7 +1034,7 @@ class stock_picking(osv.osv):
else:
name = move_line.name
if type in ('out_invoice', 'out_refund'):
if inv_type in ('out_invoice', 'out_refund'):
account_id = move_line.product_id.product_tmpl_id.\
property_account_income.id
if not account_id:
@@ -1026,14 +1048,14 @@ class stock_picking(osv.osv):
property_account_expense_categ.id
price_unit = self._get_price_unit_invoice(cr, uid,
move_line, type)
move_line, inv_type)
discount = self._get_discount_invoice(cr, uid, move_line)
tax_ids = self._get_taxes_invoice(cr, uid, move_line, type)
tax_ids = self._get_taxes_invoice(cr, uid, move_line, inv_type)
account_analytic_id = self._get_account_analytic_invoice(cr, uid, picking, move_line)
#set UoS if it's a sale and the picking doesn't have one
uos_id = move_line.product_uos and move_line.product_uos.id or False
if not uos_id and type in ('out_invoice', 'out_refund'):
if not uos_id and inv_type in ('out_invoice', 'out_refund'):
uos_id = move_line.product_uom.id
account_id = self.pool.get('account.fiscal.position').map_account(cr, uid, partner.property_account_position, account_id)
@@ -1053,7 +1075,7 @@ class stock_picking(osv.osv):
self._invoice_line_hook(cr, uid, move_line, invoice_line_id)
invoice_obj.button_compute(cr, uid, [invoice_id], context=context,
set_total=(type in ('in_invoice', 'in_refund')))
set_total=(inv_type in ('in_invoice', 'in_refund')))
self.write(cr, uid, [picking.id], {
'invoice_state': 'invoiced',
}, context=context)
@@ -1353,7 +1375,7 @@ class stock_production_lot(osv.osv):
'name': fields.char('Serial Number', size=64, required=True, help="Unique serial number, will be displayed as: PREFIX/SERIAL [INT_REF]"),
'ref': fields.char('Internal Reference', size=256, help="Internal reference number in case it differs from the manufacturer's serial number"),
'prefix': fields.char('Prefix', size=64, help="Optional prefix to prepend when displaying this serial number: PREFIX/SERIAL [INT_REF]"),
'product_id': fields.many2one('product.product', 'Product', required=True),
'product_id': fields.many2one('product.product', 'Product', required=True, domain=[('type', '<>', 'service')]),
'date': fields.datetime('Creation Date', required=True),
'stock_available': fields.function(_get_stock, fnct_search=_stock_search, method=True, type="float", string="Available", select=True,
help="Current quantity of products with this Production Lot Number available in company warehouses",
@@ -1480,7 +1502,7 @@ class stock_move(osv.osv):
'move_dest_id': fields.many2one('stock.move', 'Destination Move', help="Optional: next stock move when chaining them", select=True),
'move_history_ids': fields.many2many('stock.move', 'stock_move_history_ids', 'parent_id', 'child_id', 'Move History (child moves)'),
'move_history_ids2': fields.many2many('stock.move', 'stock_move_history_ids', 'child_id', 'parent_id', 'Move History (parent moves)'),
'picking_id': fields.many2one('stock.picking', 'Picking List', select=True,states={'done': [('readonly', True)]}),
'picking_id': fields.many2one('stock.picking', 'Reference', select=True,states={'done': [('readonly', True)]}),
'note': fields.text('Notes'),
'state': fields.selection([('draft', 'Draft'), ('waiting', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, select=True,
help='When the stock move is created it is in the \'Draft\' state.\n After that it is set to \'Confirmed\' state.\n If stock is available state is set to \'Available\'.\n When the picking is done the state is \'Done\'.\
@@ -2231,7 +2253,7 @@ class stock_move(osv.osv):
quantity_rest = quantity
uos_qty_rest = uos_qty
if move.product_id.track_production and location_id:
res += self.split_lines(cr, uid, [move.id], quantity_rest, split_by_qty=1, context=context)
res += self.action_split(cr, uid, [move.id], quantity_rest, split_by_qty=1, context=context)
else:
res += [move.id]
update_val = {
+4 -4
View File
@@ -465,7 +465,7 @@
<group col="2" colspan="2" groups="base.group_extended">
<separator string="Chained Locations" colspan="2"/>
<field name="chained_location_type"/>
<field name="chained_location_id"/>
<field name="chained_location_id" attrs="{'required':[('chained_location_type','=','fixed')]}"/>
<field name="chained_auto_packing"/>
<field name="chained_delay"/>
<field name="chained_journal_id"/>
@@ -746,7 +746,7 @@
<button name="action_assign" states="confirmed" string="Check Availability" type="object" icon="gtk-find"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="action_process" states="assigned" string="Process" type="object" icon="gtk-go-forward"/>
<button states="done" name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-gtk-go-back-rtl" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/>
<button states="done" name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-gtk-go-back-rtl" />
</group>
</page>
<page string="Additional info" groups="base.group_extended,base.group_multi_company">
@@ -939,7 +939,7 @@
<button name="action_assign" states="confirmed" string="Check Availability" type="object" groups="base.group_extended" icon="gtk-find"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="action_process" states="assigned" string="Process" type="object" icon="gtk-go-forward"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" states="done" type="action" icon="terp-gtk-go-back-rtl" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" states="done" type="action" icon="terp-gtk-go-back-rtl"/>
</group>
</page>
<page string="Additional info" groups="base.group_extended,base.group_multi_company">
@@ -1159,7 +1159,7 @@
<button name="force_assign" states="confirmed" string="Force Availability" type="object" groups="base.group_extended" icon="gtk-jump-to"/>
<button name="action_process" states="assigned" string="Process" type="object" icon="gtk-go-forward"/>
<group colspan="1" states="done">
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-gtk-go-back-rtl" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-gtk-go-back-rtl"/>
</group>
</group>
</page>
+67 -46
View File
@@ -24,14 +24,52 @@ from osv import fields, osv
from tools.translate import _
class stock_invoice_onshipping(osv.osv_memory):
def _get_journal_id(self, cr, uid, context=None):
if context is None:
context = {}
model = context.get('active_model')
if not model or model != 'stock.picking':
return []
model_pool = self.pool.get(model)
acct_obj = self.pool.get('account.journal')
res_ids = context and context.get('active_ids', [])
vals=[]
pick_types = list(set(map(lambda x: x.type, model_pool.browse(cr, uid, res_ids, context=context))))
for type in pick_types:
if type == 'out':
value = acct_obj.search(cr, uid, [('type', 'in',('sale','sale_refund') )])
for jr_type in acct_obj.browse(cr, uid, value, context=context):
t1 = jr_type.id,jr_type.name
vals.append(t1)
elif type == 'in':
value = acct_obj.search(cr, uid, [('type', 'in',('purchase','purchase_refund') )])
for jr_type in acct_obj.browse(cr, uid, value, context=context):
t1 = jr_type.id,jr_type.name
vals.append(t1)
else:
value = acct_obj.search(cr, uid, [('type', 'in',('cash','bank','general','situation') )])
for jr_type in acct_obj.browse(cr, uid, value, context=context):
t1 = jr_type.id,jr_type.name
vals.append(t1)
return vals
_name = "stock.invoice.onshipping"
_description = "Stock Invoice Onshipping"
_columns = {
'journal_id': fields.many2one('account.journal', 'Destination Journal', required=True),
# 'journal_id': fields.many2one('account.journal', 'Destination Journal', required=True,selection=_get_journal_id),
'journal_id': fields.selection(_get_journal_id, 'Destination Journal',required=True),
'group': fields.boolean("Group by partner"),
'invoice_date': fields.date('Invoiced date'),
}
def view_init(self, cr, uid, fields_list, context=None):
if context is None:
context = {}
@@ -48,30 +86,13 @@ class stock_invoice_onshipping(osv.osv_memory):
raise osv.except_osv(_('Warning !'), _('None of these picking lists require invoicing.'))
return res
def _get_type(self, pick):
src_usage = dest_usage = None
pick_type = None
if pick.invoice_state=='2binvoiced':
if pick.move_lines:
src_usage = pick.move_lines[0].location_id.usage
dest_usage = pick.move_lines[0].location_dest_id.usage
if pick.type == 'out' and dest_usage == 'supplier':
pick_type = 'in_refund'
elif pick.type == 'out' and dest_usage == 'customer':
pick_type = 'out_invoice'
elif pick.type == 'in' and src_usage == 'supplier':
pick_type = 'in_invoice'
elif pick.type == 'in' and src_usage == 'customer':
pick_type = 'out_refund'
else:
pick_type = 'out_invoice'
return pick_type
def create_invoice(self, cr, uid, ids, context=None):
if context is None:
context = {}
result = []
picking_obj = self.pool.get('stock.picking')
picking_pool = self.pool.get('stock.picking')
data_pool = self.pool.get('ir.model.data')
onshipdata_obj = self.read(cr, uid, ids[0], ['journal_id', 'group', 'invoice_date'])
if context.get('new_picking', False):
onshipdata_obj['id'] = onshipdata_obj.new_picking
@@ -79,33 +100,33 @@ class stock_invoice_onshipping(osv.osv_memory):
context['date_inv'] = onshipdata_obj['invoice_date']
invoice_ids = []
for picking in picking_obj.browse(cr, uid, context.get('active_ids', []), context=context):
if picking.invoice_state == '2binvoiced':
res = picking_obj.action_invoice_create(cr, uid, [picking.id],
journal_id = onshipdata_obj['journal_id'],
group=onshipdata_obj['group'],
type=self._get_type(picking),
context=context)
invoice_ids.extend(res.values())
context['journal_type'] = {
'out_invoice': 'sale',
'out_refund': 'sale_refund',
'in_invoice': 'purchase',
'in_refund': 'purchase_refund'
}.get(self._get_type(picking), 'sale')
active_ids = context.get('active_ids', [])
active_picking = picking_pool.browse(cr, uid, context.get('active_id',False), context=context)
inv_type = picking_pool._get_invoice_type(active_picking)
res = picking_pool.action_invoice_create(cr, uid, active_ids,
journal_id = onshipdata_obj['journal_id'],
group = onshipdata_obj['group'],
type = None,
context=context)
invoice_ids += res.values()
if not invoice_ids:
raise osv.except_osv(_('Error'), _('No invoice were created'))
return {
'domain': "[('id','in', ["+','.join(map(str,invoice_ids))+"])]",
'name' : _('Invoices'),
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.invoice',
'context': context,
'type': 'ir.actions.act_window',
}
raise osv.except_osv(_('Error'), _('No Invoices were created'))
action_model = False
action = {}
if inv_type == "out_invoice":
action_model,action_id = data_pool.get_object_reference(cr, uid, 'account', "action_invoice_tree1")
elif inv_type == "in_invoice":
action_model,action_id = data_pool.get_object_reference(cr, uid, 'account', "action_invoice_tree2")
elif inv_type == "out_refund":
action_model,action_id = data_pool.get_object_reference(cr, uid, 'account', "action_invoice_tree3")
elif inv_type == "in_refund":
action_model,action_id = data_pool.get_object_reference(cr, uid, 'account', "action_invoice_tree4")
if action_model:
action_pool = self.pool.get(action_model)
action = action_pool.read(cr, uid, action_id, context=context)
action['domain'] = "[('id','in', ["+','.join(map(str,invoice_ids))+"])]"
return action
stock_invoice_onshipping()
+1 -1
View File
@@ -40,7 +40,7 @@
<form string="Consume Move">
<separator string="Consume Products" colspan="4"/>
<field name="product_id" colspan="4" readonly="1"/>
<field name="location_id" colspan="4" widget="selection"/>
<field name="location_id" colspan="4" />
<field name="product_qty" colspan="2"/>
<field name="product_uom" nolabel="1" readonly="1"/>
<newline/>
+1 -2
View File
@@ -149,10 +149,9 @@ class stock_return_picking(osv.osv_memory):
new_picking = None
date_cur = time.strftime('%Y-%m-%d %H:%M:%S')
move_ids = [m.id for m in [line for line in pick.move_lines]]
set_invoice_state_to_none = True
returned_lines = 0
for move in move_obj.browse(cr, uid, move_ids):
for move in pick.move_lines:
if not new_picking:
if pick.type=='out':
new_type = 'in'
+1 -2
View File
@@ -104,8 +104,7 @@ class stock_split_move_line(osv.osv_memory):
pick_obj = self.pool.get('stock.picking')
pick = pick_obj.browse(cr, uid, record_id, context=context)
data = self.read(cr, uid, ids[0])
move_ids = [m.id for m in [line for line in pick.move_lines]]
for move in move_obj.browse(cr, uid, move_ids, context=context):
for move in pick.move_lines:
quantity = data['move%s' % move.id]
if 0 < quantity < move.product_qty:
new_qty = move.product_qty - quantity
@@ -6,3 +6,5 @@
"access_stock_location_path_manager","stock location path manager","model_stock_location_path","stock.group_stock_manager",1,1,1,1
"access_stock_location_path_partner_manager","stock.location.path partner manager","model_stock_location_path","product.group_product_manager",1,1,1,1
"access_stock_location_path_stock_user","stock.location.path stock user","model_stock_location_path","stock.group_stock_user",1,1,1,1
"access_stock_location_path","stock.location.path","model_stock_location_path","base.group_sale_salesman",1,0,0,0
"access_product_pulled_flow","product.pulled.flow","model_product_pulled_flow","base.group_sale_salesman",1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
6 access_stock_location_path_manager stock location path manager model_stock_location_path stock.group_stock_manager 1 1 1 1
7 access_stock_location_path_partner_manager stock.location.path partner manager model_stock_location_path product.group_product_manager 1 1 1 1
8 access_stock_location_path_stock_user stock.location.path stock user model_stock_location_path stock.group_stock_user 1 1 1 1
9 access_stock_location_path stock.location.path model_stock_location_path base.group_sale_salesman 1 0 0 0
10 access_product_pulled_flow product.pulled.flow model_product_pulled_flow base.group_sale_salesman 1 0 0 0