[MERGE] merge from trunk addons

bzr revid: mra@mra-laptop-20101006042713-lq5fqtj1uxz2w1sb
This commit is contained in:
Mustufa Rangwala
2010-10-06 09:57:13 +05:30
8 changed files with 63 additions and 80 deletions
+29 -33
View File
@@ -331,38 +331,34 @@ This is useful for CRM leads for example"),
default.update({'name':new_name})
return super(email_template, self).copy(cr, uid, id, default, context)
def compute_pl(self,
model_object_field,
sub_model_object_field,
null_value, template_language='mako'):
def build_expression(self, field_name, sub_field_name, null_value, template_language='mako'):
"""
Returns the expression based on data provided
@param model_object_field: First level field
@param sub_model_object_field: Second level drilled down field (M2O)
@param null_value: What has to be returned if the value is empty
@param template_language: The language used for templating
Returns a template expression based on data provided
@param field_name: field name
@param sub_field_name: sub field name (M2O)
@param null_value: default value if the target value is empty
@param template_language: name of template engine
@return: computed expression
"""
#Configure for MAKO
copy_val = ''
expression = ''
if template_language == 'mako':
if model_object_field:
copy_val = "${object." + model_object_field
if sub_model_object_field:
copy_val += "." + sub_model_object_field
if null_value:
copy_val += " or '" + null_value + "'"
if model_object_field:
copy_val += "}"
if field_name:
expression = "${object." + field_name
if sub_field_name:
expression += "." + sub_field_name
if null_value:
expression += " or '''%s'''" % null_value
expression += "}"
elif template_language == 'django':
if model_object_field:
copy_val = "{{object." + model_object_field
if sub_model_object_field:
copy_val += "." + sub_model_object_field
if null_value:
copy_val = copy_val + '|default:"' + null_value + '"'
copy_val = copy_val + "}}"
return copy_val
if field_name:
expression = "{{object." + field_name
if sub_field_name:
expression += "." + sub_field_name
if null_value:
expression += "|default: '''%s'''" % null_value
expression += "}}"
return expression
def onchange_model_object_field(self, cr, uid, ids, model_object_field, template_language, context=None):
if not model_object_field:
@@ -374,7 +370,7 @@ This is useful for CRM leads for example"),
res_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', field_obj.relation)], context=context)
if res_ids:
result['sub_object'] = res_ids[0]
result['copyvalue'] = self.compute_pl(False,
result['copyvalue'] = self.build_expression(False,
False,
False,
template_language)
@@ -383,7 +379,7 @@ This is useful for CRM leads for example"),
else:
#Its a simple field... just compute placeholder
result['sub_object'] = False
result['copyvalue'] = self.compute_pl(field_obj.name,
result['copyvalue'] = self.build_expression(field_obj.name,
False,
False,
template_language
@@ -402,7 +398,7 @@ This is useful for CRM leads for example"),
sub_field_obj = self.pool.get('ir.model.fields').browse(cr, uid, sub_model_object_field, context)
if res_ids:
result['sub_object'] = res_ids[0]
result['copyvalue'] = self.compute_pl(field_obj.name,
result['copyvalue'] = self.build_expression(field_obj.name,
sub_field_obj.name,
False,
template_language
@@ -412,7 +408,7 @@ This is useful for CRM leads for example"),
else:
#Its a simple field... just compute placeholder
result['sub_object'] = False
result['copyvalue'] = self.compute_pl(field_obj.name,
result['copyvalue'] = self.build_expression(field_obj.name,
False,
False,
template_language
@@ -431,7 +427,7 @@ This is useful for CRM leads for example"),
sub_field_obj = self.pool.get('ir.model.fields').browse(cr, uid, sub_model_object_field, context)
if res_ids:
result['sub_object'] = res_ids[0]
result['copyvalue'] = self.compute_pl(field_obj.name,
result['copyvalue'] = self.build_expression(field_obj.name,
sub_field_obj.name,
null_value,
template_language
@@ -441,7 +437,7 @@ This is useful for CRM leads for example"),
else:
#Its a simple field... just compute placeholder
result['sub_object'] = False
result['copyvalue'] = self.compute_pl(field_obj.name,
result['copyvalue'] = self.build_expression(field_obj.name,
False,
null_value,
template_language
+1 -1
View File
@@ -303,7 +303,7 @@ class event_registration(osv.osv):
'name': fields.char('Summary', size=124, readonly=True, states={'draft': [('readonly', False)]}),
'email_cc': fields.text('CC', size=252 , readonly=False, states={'done': [('readonly', True)]}, help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"),
'nb_register': fields.integer('Quantity', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Number of Registrations or Tickets"),
'event_id': fields.many2one('event.event', 'Event Related', required=True, readonly=True, states={'draft': [('readonly', False)]}),
'event_id': fields.many2one('event.event', 'Event', required=True, readonly=True, states={'draft': [('readonly', False)]}),
'partner_id': fields.many2one('res.partner', 'Partner', states={'done': [('readonly', True)]}),
"partner_invoice_id": fields.many2one('res.partner', 'Partner Invoiced', readonly=True, states={'draft': [('readonly', False)]}),
"contact_id": fields.many2one('res.partner.contact', 'Partner Contact', readonly=False, states={'done': [('readonly', True)]}), #TODO: filter only the contacts that have a function into the selected partner_id
+25 -26
View File
@@ -219,27 +219,27 @@
<field name="arch" type="xml">
<search string="Events">
<group col="10" colspan="4">
<filter icon="terp-check" string="Current" name="draft" domain="[('state','in',('draft', 'confirm'))]" help="Current Events"/>
<filter icon="terp-camera_test" string="Open" domain="[('state','=','confirm')]" help="Open Events"/>
<filter icon="terp-check" string="Current" name="draft" domain="[('state','in',('draft', 'confirm'))]" help="Events in draft or confirmed state"/>
<filter icon="terp-camera_test" string="Confirmed" domain="[('state','=','confirm')]" help="Confirmed events"/>
<separator orientation="vertical"/>
<field name="name" string="Event" select="1"/>
<field name="state" select="1"/>
<field name="name" select="1"/>
<field name="user_id" widget="selection">
<filter icon="terp-personal"
string="My Events"
help="My Events"
domain="[('user_id','=',uid)]"/>
<filter icon="terp-personal"
string="My Events"
help="My Events"
domain="[('user_id','=',uid)]"/>
</field>
<field name="date_begin" select="1"/>
<field name="state" select="1"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="12">
<filter string="Responsible" icon="terp-personal" context="{'group_by': 'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Event Type" icon="terp-crm" context="{'group_by':'type'}"/>
<filter string="state" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Responsible" icon="terp-personal" context="{'group_by': 'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Creation" icon="terp-go-month"
<filter string="Beginning Date" icon="terp-go-month"
domain="[]" context="{'group_by':'date_begin'}"/>
</group>
</search>
@@ -287,11 +287,11 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Registration">
<field name="date" string="Date"/>
<field name="event_id"/>
<field name="partner_id"/>
<field name="event_id"/>
<field name="nb_register"/>
<field name="price_subtotal"/>
<field name="price_subtotal" sum="Total"/>
<field name="user_id"/>
<field name="state"/>
<button name="button_reg_close" string="Close Registration" states="open" type="object" icon="gtk-close"/>
<button name="check_confirm" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/>
@@ -335,9 +335,9 @@
<separator string="" colspan="4"/>
<group col="8" colspan="4">
<field name="state" select="1" colspan="2"/>
<button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/>
<button name="button_reg_close" string="Close Registration" states="open" type="object" icon="gtk-close"/>
<button name="check_confirm" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/>
<button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/>
</group>
</page>
<page string="Extra Info">
@@ -460,27 +460,26 @@
<field name="arch" type="xml">
<search string="Event Registration">
<group col="12" colspan="4">
<filter icon="terp-check" string="Current" name="draft" domain="[('state','in',('draft', 'open'))]" help="Current Registrations"/>
<filter icon="terp-camera_test" string="Open" domain="[('state','=','open')]" help="Open Registrations"/>
<filter icon="terp-check" string="Current" name="draft" domain="[('state','in',('draft', 'open'))]" help="Registrations in unconfirmed or confirmed state"/>
<filter icon="terp-camera_test" string="Confirmed" domain="[('state','=','open')]" help="Confirmed registrations"/>
<separator orientation="vertical"/>
<field name="partner_id" />
<field name="event_id" widget="selection"/>
<field name="state" select="1"/>
<field name="user_id" widget="selection">
<filter icon="terp-personal"
string="My Registration"
help="My Registration"
domain="[('user_id','=',uid)]"/>
<filter icon="terp-personal"
string="My Registrations"
help="My Registrations"
domain="[('user_id','=',uid)]"/>
</field>
<field name="state" select="1"/>
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<separator orientation="vertical"/>
<filter string="Event" icon="terp-crm" domain="[]" context="{'group_by':'event_id'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Partner" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
</group>
</search>
</field>
@@ -101,7 +101,7 @@
<separator orientation="vertical"/>
<field name="version_id" widget="selection" />
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'project.issue')]"/>
<field name="type_id" widget="selection" domain="[('object_id.model', '=', 'project.issue')]" />
<field name="type_id" widget="selection"/>
<separator orientation="vertical"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<newline/>
+7 -2
View File
@@ -423,8 +423,14 @@ class sale_order(osv.osv):
pay_term = order.payment_term.id
else:
pay_term = False
invoiced_sale_line_ids = self.pool.get('sale.order.line').search(cr, uid, [('order_id', '=', order.id), ('invoiced', '=', True)], context=context)
from_line_invoice_ids = []
for invoiced_sale_line_id in self.pool.get('sale.order.line').browse(cr, uid, invoiced_sale_line_ids, context=context):
for invoice_line_id in invoiced_sale_line_id.invoice_lines:
if invoice_line_id.invoice_id.id not in from_line_invoice_ids:
from_line_invoice_ids.append(invoice_line_id.invoice_id.id)
for preinv in order.invoice_ids:
if preinv.state not in ('cancel',):
if preinv.state not in ('cancel',) and preinv.id not in from_line_invoice_ids:
for preline in preinv.invoice_line:
inv_line_id = self.pool.get('account.invoice.line').copy(cr, uid, preline.id, {'invoice_id': False, 'price_unit': -preline.price_unit})
lines.append(inv_line_id)
@@ -471,7 +477,6 @@ class sale_order(osv.osv):
lines = []
for line in o.order_line:
if line.invoiced:
#raise osv.except_osv(_('Error !'), _('The Sale Order already has some lines invoiced. You should continue the billing process by line.'))
continue
elif (line.state in states):
lines.append(line.id)
-1
View File
@@ -913,7 +913,6 @@
</page>
<page string="Additional info" groups="base.group_extended,base.group_multi_company">
<field name="auto_picking" groups="base.group_extended"/>
<field name="invoice_state" groups="base.group_extended"/>
<field name="date_done" groups="base.group_extended"/>
<field name="move_type" groups="base.group_extended"/>
<field name="type" groups="base.group_extended"/>
-8
View File
@@ -1,8 +0,0 @@
this is a test file:
-------------------
the purpose is to test the buidlbot engine
how to do?
we simply gonna make several commit in a local branch, and also several commits in the main branch, then merge and see what happens
iii
-8
View File
@@ -1,8 +0,0 @@
1
2
3
4
5
6
7
8