Merge
This commit is contained in:
commit
0b34af6284
4 files changed
+43
-8
No files matched your search
+16
@@ -95,6 +95,22 @@ class Location(OSV):
|
||||
self._tree_qty(qty_by_ltn, childs, ids, to_compute)
|
||||
return qty_by_ltn
|
||||
|
||||
def view_header_get(self, cursor, user, value, view_type='form',
|
||||
context=None):
|
||||
product_obj = self.pool.get('product.product')
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
if context is None:
|
||||
context = {}
|
||||
if context.get('product'):
|
||||
product_name = product_obj.name_get(cursor, user, context['product'],
|
||||
context=context)[0][1]
|
||||
product = product_obj.browse(cursor, user, context['product'],
|
||||
context=context)
|
||||
uom_name = uom_obj.name_get(cursor, user, product.default_uom.id,
|
||||
context=context)[0][1]
|
||||
return value + ': ' + product_name + ' (' + uom_name + ')'
|
||||
return False
|
||||
|
||||
Location()
|
||||
|
||||
|
||||
|
||||
+21
@@ -683,4 +683,25 @@ SelectMove()
|
||||
class PackingOutReport(CompanyReport):
|
||||
_name = 'stock.packing.out'
|
||||
|
||||
def parse(self, cursor, user, report, objects, datas, context):
|
||||
if context is None:
|
||||
context = {}
|
||||
context = context.copy()
|
||||
context['product_id2name'] = {}
|
||||
context['product_names'] = lambda moves, lang: self.product_names(
|
||||
cursor, user, moves, lang, context)
|
||||
return super(PackingOutReport, self).parse(cursor, user, report,
|
||||
objects, datas, context)
|
||||
|
||||
def product_names(self, cursor, user, moves, lang, context):
|
||||
product_obj = self.pool.get('product.product')
|
||||
ctx = context.copy()
|
||||
ctx['language'] = lang
|
||||
product_ids = [x.product.id for x in moves]
|
||||
if product_ids:
|
||||
for product_id, product_name in product_obj.name_get(cursor, user,
|
||||
product_ids, context=ctx):
|
||||
context['product_id2name'][product_id] = product_name
|
||||
return ''
|
||||
|
||||
PackingOutReport()
|
||||
Binary file not shown.
+6
-8
@@ -13,7 +13,7 @@
|
||||
<field name="default_uom" select="2"/>
|
||||
<field name="active" select="2"/>
|
||||
</tree>
|
||||
]]>
|
||||
]]>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -23,23 +23,21 @@
|
||||
<field name="field_childs">childs</field>
|
||||
<field name="arch" type="xml">
|
||||
<![CDATA[
|
||||
<tree string="Locations">
|
||||
<field name="name" select="1"/>
|
||||
<field name="code" select="2"/>
|
||||
<field name="type" select="1"/>
|
||||
<field name="quantity" select="1"/>
|
||||
<field name="active" select="2"/>
|
||||
<tree string="Product Stock">
|
||||
<field name="name"/>
|
||||
<field name="quantity"/>
|
||||
</tree>
|
||||
]]>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window" id="act_location_quantity_tree">
|
||||
<field name="name">Product Availability</field>
|
||||
<field name="name">Product Stock</field>
|
||||
<field name="src_model">product.product</field>
|
||||
<field name="res_model">stock.location</field>
|
||||
<field name="view_type">tree</field>
|
||||
<field name="context">{'product': active_id}</field>
|
||||
<field name="domain">[('parent', '=', False)]</field>
|
||||
<field name="window_name" eval="False"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_location_quantity_tree_view">
|
||||
<field name="sequence" eval="10"/>
|
||||
|
||||
Reference in new issue
Block a user