[MERGE] merged with trunk-development-branch
bzr revid: hmo@tinyerp.com-20111214121916-3u112ph951zd89zr
This commit is contained in:
commit
2c2f11b849
|
@ -610,15 +610,15 @@ class account_invoice(osv.osv):
|
|||
res[r[0]].append( r[1] )
|
||||
return res
|
||||
|
||||
def copy(self, cr, uid, id, default={}, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
default = default or {}
|
||||
default.update({
|
||||
'state':'draft',
|
||||
'number':False,
|
||||
'move_id':False,
|
||||
'move_name':False,
|
||||
'internal_number': False,
|
||||
'period_id': False,
|
||||
})
|
||||
if 'date_invoice' not in default:
|
||||
default.update({
|
||||
|
@ -1642,12 +1642,7 @@ class res_partner(osv.osv):
|
|||
}
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
default = default or {}
|
||||
default.update({'invoice_ids' : []})
|
||||
return super(res_partner, self).copy(cr, uid, id, default, context)
|
||||
|
||||
|
|
|
@ -91,10 +91,10 @@ class account_voucher(osv.osv):
|
|||
return False
|
||||
|
||||
def _get_payment_rate_currency(self, cr, uid, context=None):
|
||||
'''
|
||||
"""
|
||||
Return the default value for field payment_rate_currency_id: the currency of the journal
|
||||
if there is one, otherwise the currency of the user's company
|
||||
'''
|
||||
"""
|
||||
if context is None: context = {}
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
journal_id = context.get('journal_id', False)
|
||||
|
@ -141,20 +141,22 @@ class account_voucher(osv.osv):
|
|||
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
if context is None: context = {}
|
||||
if not view_id and context.get('invoice_type', False):
|
||||
if context.get('invoice_type', False) in ('out_invoice', 'out_refund'):
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form')
|
||||
else:
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form')
|
||||
result = result and result[1] or False
|
||||
view_id = result
|
||||
if not view_id and view_type == 'form' and context.get('line_type', False):
|
||||
if context.get('line_type', False) == 'customer':
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form')
|
||||
else:
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form')
|
||||
result = result and result[1] or False
|
||||
view_id = result
|
||||
|
||||
if view_type == 'form':
|
||||
if not view_id and context.get('invoice_type'):
|
||||
if context.get('invoice_type') in ('out_invoice', 'out_refund'):
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form')
|
||||
else:
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form')
|
||||
result = result and result[1] or False
|
||||
view_id = result
|
||||
if not view_id and context.get('line_type'):
|
||||
if context.get('line_type') == 'customer':
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form')
|
||||
else:
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form')
|
||||
result = result and result[1] or False
|
||||
view_id = result
|
||||
|
||||
res = super(account_voucher, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
|
||||
doc = etree.XML(res['arch'])
|
||||
|
|
|
@ -205,6 +205,7 @@
|
|||
<group col="2" colspan="1">
|
||||
<group col="4" colspan="1" attrs="{'invisible':[('currency_id','=',False),('is_multi_currency','=',False)]}">
|
||||
<separator string="Currency Options" colspan="4"/>
|
||||
<field name="is_multi_currency" invisible="1"/>
|
||||
<field name="payment_rate" required="1" on_change="onchange_rate(payment_rate, amount, currency_id, payment_rate_currency_id, company_id, context)" groups='base.group_extended' colspan="3"/>
|
||||
<field name="payment_rate_currency_id" groups='base.group_extended' colspan="1" nolabel="1" on_change="onchange_payment_rate_currency(currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context)"/>
|
||||
<field name="paid_amount_in_company_currency" groups='base.group_extended' colspan="4" invisible="1"/>
|
||||
|
@ -356,6 +357,7 @@
|
|||
<group col="2" colspan="1">
|
||||
<group col="4" colspan="1" attrs="{'invisible':[('currency_id','=',False),('is_multi_currency','=',False)]}">
|
||||
<separator string="Currency Options" colspan="4"/>
|
||||
<field name="is_multi_currency" invisible="1"/>
|
||||
<field name="payment_rate" required="1" on_change="onchange_rate(payment_rate, amount, currency_id, payment_rate_currency_id, company_id, context)" groups='base.group_extended' colspan="3"/>
|
||||
<field name="payment_rate_currency_id" groups='base.group_extended' colspan="1" nolabel="1" on_change="onchange_payment_rate_currency(currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context)"/>
|
||||
<field name="paid_amount_in_company_currency" groups='base.group_extended' colspan="4" invisible="1"/>
|
||||
|
|
|
@ -522,6 +522,7 @@
|
|||
<field name="res_model">mrp.bom</field>
|
||||
<field name="domain">[('id','=',active_id)]</field>
|
||||
<field name="view_type">tree</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="mrp_bom_tree_view"/>
|
||||
</record>
|
||||
<record id="ir_BOM_structure" model="ir.values">
|
||||
|
@ -776,7 +777,7 @@
|
|||
<field colspan="4" name="product_lines" nolabel="1" widget="one2many_list"/>
|
||||
</page>
|
||||
<page string="Extra Information">
|
||||
<field name="user_id"/>
|
||||
<field name="user_id"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
<field name="priority" groups="base.group_extended"/>
|
||||
<newline/>
|
||||
|
@ -972,7 +973,7 @@
|
|||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<act_window
|
||||
context="{'search_default_product_id': [active_id]}"
|
||||
id="act_product_manufacturing_open"
|
||||
|
@ -980,13 +981,14 @@
|
|||
view_id="mrp_production_tree_view"
|
||||
res_model="mrp.production"
|
||||
src_model="product.product"/>
|
||||
|
||||
|
||||
<act_window
|
||||
id="action_product_bom_structure"
|
||||
name="Product BoM Structure"
|
||||
domain="[('product_id', '=', active_id),('bom_id','=',False)]"
|
||||
context="{'default_product_id': active_id}"
|
||||
view_type="tree"
|
||||
view_mode="tree"
|
||||
view_id="mrp_bom_tree_view"
|
||||
res_model="mrp.bom"
|
||||
src_model="product.product"
|
||||
|
|
|
@ -880,14 +880,24 @@ class task(osv.osv):
|
|||
self.write(cr, uid, ids, {'state': 'draft'}, context=context)
|
||||
return True
|
||||
|
||||
|
||||
def _delegate_task_attachments(self, cr, uid, task_id, delegated_task_id, context=None):
|
||||
attachment = self.pool.get('ir.attachment')
|
||||
attachment_ids = attachment.search(cr, uid, [('res_model', '=', self._name), ('res_id', '=', task_id)], context=context)
|
||||
new_attachment_ids = []
|
||||
for attachment_id in attachment_ids:
|
||||
new_attachment_ids.append(attachment.copy(cr, uid, attachment_id, default={'res_id': delegated_task_id}, context=context))
|
||||
return new_attachment_ids
|
||||
|
||||
|
||||
def do_delegate(self, cr, uid, ids, delegate_data={}, context=None):
|
||||
"""
|
||||
Delegate Task to another users.
|
||||
"""
|
||||
assert delegate_data['user_id'], _("Delegated User should be specified")
|
||||
delegrated_tasks = {}
|
||||
delegated_tasks = {}
|
||||
for task in self.browse(cr, uid, ids, context=context):
|
||||
delegrated_task_id = self.copy(cr, uid, task.id, {
|
||||
delegated_task_id = self.copy(cr, uid, task.id, {
|
||||
'name': delegate_data['name'],
|
||||
'project_id': delegate_data['project_id'] and delegate_data['project_id'][0] or False,
|
||||
'user_id': delegate_data['user_id'] and delegate_data['user_id'][0] or False,
|
||||
|
@ -898,6 +908,7 @@ class task(osv.osv):
|
|||
'child_ids': [],
|
||||
'work_ids': []
|
||||
}, context=context)
|
||||
self._delegate_task_attachments(cr, uid, task.id, delegated_task_id, context=context)
|
||||
newname = delegate_data['prefix'] or ''
|
||||
task.write({
|
||||
'remaining_hours': delegate_data['planned_hours_me'],
|
||||
|
@ -911,8 +922,8 @@ class task(osv.osv):
|
|||
|
||||
message = _("The task '%s' has been delegated to %s.") % (delegate_data['name'], delegate_data['user_id'][1])
|
||||
self.log(cr, uid, task.id, message)
|
||||
delegrated_tasks[task.id] = delegrated_task_id
|
||||
return delegrated_tasks
|
||||
delegated_tasks[task.id] = delegated_task_id
|
||||
return delegated_tasks
|
||||
|
||||
def do_pending(self, cr, uid, ids, context={}):
|
||||
self.write(cr, uid, ids, {'state': 'pending'}, context=context)
|
||||
|
|
Loading…
Reference in New Issue