bzr revid: stw@openerp.com-20120808140846-ay7qn0bymtdbwj9q
This commit is contained in:
Stephane Wirtel 2012-08-08 16:08:46 +02:00
commit 4ae8ce4516
6 changed files with 43 additions and 12 deletions

View File

@ -730,7 +730,7 @@ class account_journal(osv.osv):
'view_id': fields.many2one('account.journal.view', 'Display Mode', required=True, help="Gives the view used when writing or browsing entries in this journal. The view tells OpenERP which fields should be visible, required or readonly and in which order. You can create your own view for a faster encoding in each journal."), 'view_id': fields.many2one('account.journal.view', 'Display Mode', required=True, help="Gives the view used when writing or browsing entries in this journal. The view tells OpenERP which fields should be visible, required or readonly and in which order. You can create your own view for a faster encoding in each journal."),
'default_credit_account_id': fields.many2one('account.account', 'Default Credit Account', domain="[('type','!=','view')]", help="It acts as a default account for credit amount"), 'default_credit_account_id': fields.many2one('account.account', 'Default Credit Account', domain="[('type','!=','view')]", help="It acts as a default account for credit amount"),
'default_debit_account_id': fields.many2one('account.account', 'Default Debit Account', domain="[('type','!=','view')]", help="It acts as a default account for debit amount"), 'default_debit_account_id': fields.many2one('account.account', 'Default Debit Account', domain="[('type','!=','view')]", help="It acts as a default account for debit amount"),
'centralisation': fields.boolean('Centralised counterpart', help="Check this box to determine that each entry of this journal won't create a new counterpart but will share the same counterpart. This is used in fiscal year closing."), 'centralisation': fields.boolean('Centralised Counterpart', help="Check this box to determine that each entry of this journal won't create a new counterpart but will share the same counterpart. This is used in fiscal year closing."),
'update_posted': fields.boolean('Allow Cancelling Entries', help="Check this box if you want to allow the cancellation the entries related to this journal or of the invoice related to this journal"), 'update_posted': fields.boolean('Allow Cancelling Entries', help="Check this box if you want to allow the cancellation the entries related to this journal or of the invoice related to this journal"),
'group_invoice_lines': fields.boolean('Group Invoice Lines', help="If this box is checked, the system will try to group the accounting lines when generating them from invoices."), 'group_invoice_lines': fields.boolean('Group Invoice Lines', help="If this box is checked, the system will try to group the accounting lines when generating them from invoices."),
'sequence_id': fields.many2one('ir.sequence', 'Entry Sequence', help="This field contains the information related to the numbering of the journal entries of this journal.", required=True), 'sequence_id': fields.many2one('ir.sequence', 'Entry Sequence', help="This field contains the information related to the numbering of the journal entries of this journal.", required=True),

View File

@ -19,7 +19,7 @@
# #
############################################################################## ##############################################################################
from osv import fields from osv import fields, osv
from tools.translate import _ from tools.translate import _
class base_state(object): class base_state(object):
@ -92,6 +92,24 @@ class base_state(object):
data.update(self.onchange_partner_address_id(cr, uid, ids, addr['contact'])['value']) data.update(self.onchange_partner_address_id(cr, uid, ids, addr['contact'])['value'])
return {'value': data} return {'value': data}
def case_escalate(self, cr, uid, ids, context=None):
""" Escalates case to parent level """
cases = self.browse(cr, uid, ids, context=context)
cases[0].state # fill browse record cache, for _action having old and new values
data = {'active': True}
for case in cases:
parent_id = case.section_id.parent_id
if parent_id:
data['section_id'] = parent_id.id
if parent_id.change_responsible and parent_id.user_id:
data['user_id'] = parent_id.user_id.id
else:
raise osv.except_osv(_('Error !'), _('You can not escalate, you are already at the top level regarding your sales-team category.'))
self.write(cr, uid, [case.id], data, context=context)
case.case_escalate_send_note(parent_id, context=context)
self._action(cr, uid, cases, 'escalate', context=context)
return True
def case_open(self, cr, uid, ids, context=None): def case_open(self, cr, uid, ids, context=None):
""" Opens case """ """ Opens case """
cases = self.browse(cr, uid, ids, context=context) cases = self.browse(cr, uid, ids, context=context)
@ -170,6 +188,15 @@ class base_state(object):
self.message_append_note(cr, uid, [id], body=msg, context=context) self.message_append_note(cr, uid, [id], body=msg, context=context)
return True return True
def case_escalate_send_note(self, cr, uid, ids, new_section=None, context=None):
for id in ids:
if new_section:
msg = '%s has been <b>escalated</b> to <b>%s</b>.' % (self.case_get_note_msg_prefix(cr, uid, id, context=context), new_section.name)
else:
msg = '%s has been <b>escalated</b>.' % (self.case_get_note_msg_prefix(cr, uid, id, context=context))
self.message_append_note(cr, uid, [id], 'System Notification', msg, context=context)
return True
def case_close_send_note(self, cr, uid, ids, context=None): def case_close_send_note(self, cr, uid, ids, context=None):
for id in ids: for id in ids:
msg = _('%s has been <b>closed</b>.') % (self.case_get_note_msg_prefix(cr, uid, id, context=context)) msg = _('%s has been <b>closed</b>.') % (self.case_get_note_msg_prefix(cr, uid, id, context=context))

View File

@ -1025,6 +1025,14 @@
<field name="date_start"/> <field name="date_start"/>
<field name="date_stop"/> <field name="date_stop"/>
</tree> </tree>
<form string="Bill of Material">
<field name="name" string="Component Name"/>
<field name="bom_id"/>
<field name="product_qty" string="Quantity of Product"/>
<field name="type"/>
<field name="date_start"/>
<field name="date_stop"/>
</form>
</field> </field>
</page> </page>
</field> </field>

View File

@ -89,7 +89,7 @@
<group> <group>
<group> <group>
<field name="user_id" string="Project Manager" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/> <field name="user_id" string="Project Manager" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/> <field name="partner_id" string = "Contact" on_change="onchange_partner_id(partner_id)"/>
<field name="privacy_visibility"/> <field name="privacy_visibility"/>
<field name="analytic_account_id" invisible="1" required="0"/> <field name="analytic_account_id" invisible="1" required="0"/>
</group> </group>
@ -193,7 +193,7 @@
<field name="date" invisible="1"/> <field name="date" invisible="1"/>
<field name="name" string="Project Name"/> <field name="name" string="Project Name"/>
<field name="user_id" string="Project Manager"/> <field name="user_id" string="Project Manager"/>
<field name="partner_id" string="Partner"/> <field name="partner_id" string="Contact"/>
<field name="parent_id" string="Parent" invisible="1"/> <field name="parent_id" string="Parent" invisible="1"/>
<field name="planned_hours" widget="float_time"/> <field name="planned_hours" widget="float_time"/>
<field name="total_hours" widget="float_time"/> <field name="total_hours" widget="float_time"/>

View File

@ -1406,7 +1406,6 @@ class sale_order_line(osv.osv):
[('category_id', '=', product_obj.uom_id.category_id.id)], [('category_id', '=', product_obj.uom_id.category_id.id)],
'product_uos': 'product_uos':
[('category_id', '=', uos_category_id)]} [('category_id', '=', uos_category_id)]}
elif uos and not uom: # only happens if uom is False elif uos and not uom: # only happens if uom is False
result['product_uom'] = product_obj.uom_id and product_obj.uom_id.id result['product_uom'] = product_obj.uom_id and product_obj.uom_id.id
result['product_uom_qty'] = qty_uos / product_obj.uos_coeff result['product_uom_qty'] = qty_uos / product_obj.uos_coeff
@ -1463,15 +1462,12 @@ class sale_order_line(osv.osv):
lang=False, update_tax=True, date_order=False, context=None): lang=False, update_tax=True, date_order=False, context=None):
context = context or {} context = context or {}
lang = lang or ('lang' in context and context['lang']) lang = lang or ('lang' in context and context['lang'])
res = self.product_id_change(cursor, user, ids, pricelist, product, if not uom:
return {'value': {'price_unit': 0.0, 'product_uom' : uom or False}}
return self.product_id_change(cursor, user, ids, pricelist, product,
qty=qty, uom=uom, qty_uos=qty_uos, uos=uos, name=name, qty=qty, uom=uom, qty_uos=qty_uos, uos=uos, name=name,
partner_id=partner_id, lang=lang, update_tax=update_tax, partner_id=partner_id, lang=lang, update_tax=update_tax,
date_order=date_order, context=context) date_order=date_order, context=context)
if 'product_uom' in res['value']:
del res['value']['product_uom']
if not uom:
res['value']['price_unit'] = 0.0
return res
def unlink(self, cr, uid, ids, context=None): def unlink(self, cr, uid, ids, context=None):
if context is None: if context is None:

View File

@ -1250,7 +1250,7 @@
<field name="picking_id" string="Reference"/> <field name="picking_id" string="Reference"/>
<field name="origin"/> <field name="origin"/>
<field name="create_date" invisible="1" groups="base.group_no_one"/> <field name="create_date" invisible="1" groups="base.group_no_one"/>
<field name="product_id"/> <field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, False)"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/> <field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" string="Unit of Measure" groups="product.group_uom"/> <field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
<field name="product_uos" groups="product.group_uos"/> <field name="product_uos" groups="product.group_uos"/>