Commit 5862e3f5 authored by Alexandre Boeglin's avatar Alexandre Boeglin

Fix: d.update(a=1) does not work with python 2.3 ... simply create full dicts

instead of creating empty dicts and updating them.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10651 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 61e0528a
......@@ -132,20 +132,20 @@ class InvoiceTransactionRule(Rule, PredicateMatrix):
LOG("InvoiceTransactionRule", PROBLEM,
"expanding %s: without resource" % applied_rule.getPath())
prevision_line = {}
prevision_line.update(
id = transaction_line.getId(),
source = transaction_line.getSource(),
destination = transaction_line.getDestination(),
source_section = context_movement.getSourceSection(),
destination_section = context_movement.getDestinationSection(),
resource = resource,
prevision_line = {
'id': transaction_line.getId(),
'source': transaction_line.getSource(),
'destination': transaction_line.getDestination(),
'source_section': context_movement.getSourceSection(),
'destination_section': context_movement.getDestinationSection(),
'resource': resource,
# calculate (quantity * price) * cell_quantity
quantity = (context_movement.getCorrectedQuantity() *
'quantity': (context_movement.getCorrectedQuantity() *
context_movement.getPrice()) * transaction_line.getQuantity(),
start_date = context_movement.getStartDate(),
stop_date = context_movement.getStopDate(),
force_update = 1)
'start_date': context_movement.getStartDate(),
'stop_date': context_movement.getStopDate(),
'force_update': 1,
}
prevision_list.append(prevision_line)
return prevision_list
......
......@@ -108,23 +108,23 @@ class InvoicingRule(Rule):
or destination_section is None:
return []
invoice_line = {}
invoice_line.update(
price=context_movement.getPrice(),
quantity=context_movement.getCorrectedQuantity(),
quantity_unit=context_movement.getQuantityUnit(),
efficiency=context_movement.getEfficiency(),
resource=context_movement.getResource(),
variation_category_list=context_movement.getVariationCategoryList(),
variation_property_dict=context_movement.getVariationPropertyDict(),
start_date=context_movement.getStartDate(),
stop_date=context_movement.getStopDate(),
source=context_movement.getSource(), source_section=source_section,
destination=context_movement.getDestination(),
destination_section=destination_section,
invoice_line = {
'price': context_movement.getPrice(),
'quantity': context_movement.getCorrectedQuantity(),
'quantity_unit': context_movement.getQuantityUnit(),
'efficiency': context_movement.getEfficiency(),
'resource': context_movement.getResource(),
'variation_category_list': context_movement.getVariationCategoryList(),
'variation_property_dict': context_movement.getVariationPropertyDict(),
'start_date': context_movement.getStartDate(),
'stop_date': context_movement.getStopDate(),
'source': context_movement.getSource(),
'source_section': source_section,
'destination': context_movement.getDestination(),
'destination_section': destination_section,
# We do need to collect invoice lines to build invoices
deliverable=1
)
'deliverable': 1
}
return [invoice_line]
security.declareProtected(Permissions.ModifyPortalContent, 'expand')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment