[MERGE]: Merge with lp:~openerp-dev/openobject-addons/ksa-addons2

bzr revid: rpa@tinyerp.com-20110106124845-fi83ya2dyzpk0p0j
This commit is contained in:
rpa (Open ERP) 2011-01-06 18:18:45 +05:30
commit 62e8c0eba0
5 changed files with 32 additions and 12 deletions

View File

@ -327,7 +327,10 @@ class mrp_repair(osv.osv):
self.write(cr, uid, [o.id], {'state': '2binvoiced'})
else:
self.write(cr, uid, [o.id], {'state': 'confirmed'})
mrp_line_obj.write(cr, uid, [l.id for l in o.operations], {'state': 'confirmed'})
for line in o.operations:
if line.product_id.track_production and not line.prodlot_id:
raise osv.except_osv(_('Warning'), _("Production lot is required for opration line with product '%s'") % (line.product_id.name))
mrp_line_obj.write(cr, uid, [line.id], {'state': 'confirmed'})
return True
def action_cancel(self, cr, uid, ids, context=None):
@ -535,6 +538,7 @@ class mrp_repair(osv.osv):
'location_id': move.location_id.id,
'location_dest_id': move.location_dest_id.id,
'tracking_id': False,
'prodlot_id': move.prodlot_id and move.prodlot_id.id or False,
'state': 'done',
})
repair_line_obj.write(cr, uid, [move.id], {'move_id': move_id, 'state': 'done'}, context=context)
@ -661,6 +665,7 @@ class mrp_repair_line(osv.osv, ProductChangeMixin):
'tax_id': fields.many2many('account.tax', 'repair_operation_line_tax', 'repair_operation_line_id', 'tax_id', 'Taxes'),
'product_uom_qty': fields.float('Quantity (UoM)', digits=(16,2), required=True),
'product_uom': fields.many2one('product.uom', 'Product UoM', required=True),
'prodlot_id': fields.many2one('stock.production.lot', 'Lot Number',domain="[('product_id','=',product_id)]"),
'invoice_line_id': fields.many2one('account.invoice.line', 'Invoice Line', readonly=True),
'location_id': fields.many2one('stock.location', 'Source Location', required=True, select=True),
'location_dest_id': fields.many2one('stock.location', 'Dest. Location', required=True, select=True),

View File

@ -49,7 +49,8 @@
<notebook>
<page string="Repair Line">
<field name="name" colspan="4"/>
<field name="product_id" on_change="product_id_change(parent.pricelist_id,product_id,product_uom,product_uom_qty, parent.partner_id)" colspan="4"/>
<field name="product_id" on_change="product_id_change(parent.pricelist_id,product_id,product_uom,product_uom_qty, parent.partner_id)"/>
<field name='prodlot_id'/>
<field name="product_uom_qty" string="Qty" />
<field name="product_uom" string="UoM"/>
<field name="price_unit"/>
@ -178,7 +179,7 @@
<field name="arch" type="xml">
<search string="Search Reair Orders">
<group col='4' colspan='4'>
<filter icon="terp-document-new" string="Quotations" domain="[('state','=','draft')]"/>
<filter icon="terp-document-new" string="Quotations" domain="[('state','=','draft')]"/>
<filter icon="terp-check" string="Confirmed" domain="[('state','=','confirmed')]" name="current" />
<filter icon="terp-emblem-important" string="Ready To Repair" domain="[('state','=','ready')]"/>
<separator orientation="vertical"/>
@ -202,7 +203,7 @@
</field>
</record>
<record id="action_repair_order_tree" model="ir.actions.act_window">
<field name="name">Repair Orders</field>
@ -212,7 +213,7 @@
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_repair_order_form_filter"/>
<field name="help">Repair orders allow you to organize your product repairs. In a repair order, you can detail the components you remove, add or replace and record the time you spent on the different operations. The repair order uses the warranty date on the production lot in order to know if whether the repair should be invoiced to the customer or not.</field>
</record>
</record>
<menuitem action="action_repair_order_tree" id="menu_repair_order" parent="mrp.menu_mrp_manufacturing" groups="mrp.group_mrp_user" name="Repair Orders" sequence="50"/>

View File

@ -5,7 +5,7 @@
<record id="base.user_demo" model="res.users">
<field eval="[(4, ref('group_purchase_user'))]" name="groups_id"/>
</record>
<!--Resource: purchase.order-->
<record id="order_purchase1" model="purchase.order">
@ -26,7 +26,7 @@
<record id="line1_purchase" model="purchase.order.line">
<field name="order_id" ref="order_purchase1"/>
<field name="date_planned">2010/09/15</field>
<field name="date_planned">2010/12/23</field>
<field name="name">New server config + material</field>
<field model="product.product" name="product_id" search="[]"/>
<field model="product.uom" name="product_uom" search="[]"/>
@ -36,7 +36,7 @@
<record id="line2_purchase" model="purchase.order.line">
<field name="order_id" ref="order_purchase1"/>
<field name="date_planned">2010/09/15</field>
<field name="date_planned">2010/12/23</field>
<field name="name">[PC1] Basic PC</field>
<field name="product_id" ref="product.product_product_pc1"/>
<field name="product_uom" ref="product.product_uom_unit"/>
@ -46,7 +46,7 @@
<record id="line3_purchase" model="purchase.order.line">
<field name="order_id" ref="order_purchase2"/>
<field name="date_planned">2010/09/15</field>
<field name="date_planned">2010/12/23</field>
<field name="name">[PC3] Medium PC</field>
<field name="product_id" ref="product.product_product_pc3"/>
<field name="product_uom" ref="product.product_uom_unit"/>

View File

@ -58,6 +58,19 @@ class stock_picking(osv.osv):
'purchase_id': False,
}
def _get_address_invoice(self, cr, uid, picking):
""" Gets invoice address of a partner
@return {'contact': address, 'invoice': address} for invoice
"""
res = super(stock_picking, self)._get_address_invoice(cr, uid, picking)
if picking.purchase_id:
partner_obj = self.pool.get('res.partner')
partner = picking.purchase_id.partner_id or picking.address_id.partner_id
data = partner_obj.address_get(cr, uid, [partner.id],
['contact', 'invoice'])
res.update(data)
return res
def get_currency_id(self, cursor, user, picking):
if picking.purchase_id:
return picking.purchase_id.pricelist_id.currency_id.id

View File

@ -874,8 +874,7 @@ class stock_picking(osv.osv):
@return {'contact': address, 'invoice': address} for invoice
"""
partner_obj = self.pool.get('res.partner')
partner = (picking.purchase_id and picking.purchase_id.partner_id) or (picking.sale_id and picking.sale_id.partner_id) or picking.address_id.partner_id
partner = picking.address_id.partner_id
return partner_obj.address_get(cr, uid, [partner.id],
['contact', 'invoice'])
@ -970,6 +969,7 @@ class stock_picking(osv.osv):
invoice_obj = self.pool.get('account.invoice')
invoice_line_obj = self.pool.get('account.invoice.line')
address_obj = self.pool.get('res.partner.address')
invoices_group = {}
res = {}
inv_type = type
@ -993,6 +993,7 @@ class stock_picking(osv.osv):
address_contact_id, address_invoice_id = \
self._get_address_invoice(cr, uid, picking).values()
address = address_obj.browse(cr, uid, address_contact_id, context=context)
comment = self._get_comment_invoice(cr, uid, picking)
if group and partner.id in invoices_group:
@ -1012,7 +1013,7 @@ class stock_picking(osv.osv):
'origin': (picking.name or '') + (picking.origin and (':' + picking.origin) or ''),
'type': inv_type,
'account_id': account_id,
'partner_id': partner.id,
'partner_id': address.partner_id.id,
'address_invoice_id': address_invoice_id,
'address_contact_id': address_contact_id,
'comment': comment,