[MERGE] Forward-port saas-5 up to 37ba23d
This commit is contained in:
commit
d706adba11
|
@ -22,6 +22,7 @@
|
|||
from operator import itemgetter
|
||||
import time
|
||||
|
||||
from openerp import SUPERUSER_ID
|
||||
from openerp.osv import fields, osv
|
||||
from openerp import api
|
||||
|
||||
|
@ -222,8 +223,9 @@ class res_partner(osv.osv):
|
|||
result = {}
|
||||
account_invoice_report = self.pool.get('account.invoice.report')
|
||||
for partner in self.browse(cr, uid, ids, context=context):
|
||||
invoice_ids = account_invoice_report.search(cr, uid, [('partner_id','child_of',partner.id)], context=context)
|
||||
invoices = account_invoice_report.browse(cr, uid, invoice_ids, context=context)
|
||||
domain = [('partner_id', 'child_of', partner.id)]
|
||||
invoice_ids = account_invoice_report.search(cr, SUPERUSER_ID, domain, context=context)
|
||||
invoices = account_invoice_report.browse(cr, SUPERUSER_ID, invoice_ids, context=context)
|
||||
result[partner.id] = sum(inv.user_currency_price_total for inv in invoices)
|
||||
return result
|
||||
|
||||
|
@ -267,7 +269,8 @@ class res_partner(osv.osv):
|
|||
fnct_search=_credit_search, string='Total Receivable', multi='dc', help="Total amount this customer owes you."),
|
||||
'debit': fields.function(_credit_debit_get, fnct_search=_debit_search, string='Total Payable', multi='dc', help="Total amount you have to pay to this supplier."),
|
||||
'debit_limit': fields.float('Payable Limit'),
|
||||
'total_invoiced': fields.function(_invoice_total, string="Total Invoiced", type='float'),
|
||||
'total_invoiced': fields.function(_invoice_total, string="Total Invoiced", type='float', groups='account.group_account_invoice'),
|
||||
|
||||
'contracts_count': fields.function(_journal_item_count, string="Contracts", type='integer', multi="invoice_journal"),
|
||||
'journal_item_count': fields.function(_journal_item_count, string="Journal Items", type="integer", multi="invoice_journal"),
|
||||
'property_account_payable': fields.property(
|
||||
|
|
|
@ -55,7 +55,7 @@ class MassMailController(http.Controller):
|
|||
email = request.session['mass_mailing_email']
|
||||
|
||||
if email:
|
||||
contact_ids = Contacts.search(cr, SUPERUSER_ID, [('list_id', '=', int(list_id)), ('email', '=', email)], context=context)
|
||||
contact_ids = Contacts.search(cr, SUPERUSER_ID, [('list_id', '=', int(list_id)), ('email', '=', email), ('opt_out', '=', False)], context=context)
|
||||
is_subscriber = len(contact_ids) > 0
|
||||
|
||||
return {'is_subscriber': is_subscriber, 'email': email}
|
||||
|
@ -65,9 +65,12 @@ class MassMailController(http.Controller):
|
|||
cr, uid, context = request.cr, request.uid, request.context
|
||||
Contacts = request.registry['mail.mass_mailing.contact']
|
||||
|
||||
contact_ids = Contacts.search(cr, SUPERUSER_ID, [('list_id', '=', int(list_id)), ('email', '=', email)], context=context)
|
||||
contact_ids = Contacts.search_read(cr, SUPERUSER_ID, [('list_id', '=', int(list_id)), ('email', '=', email)], ['opt_out'], context=context)
|
||||
if not contact_ids:
|
||||
Contacts.add_to_list(cr, SUPERUSER_ID, email, int(list_id), context=context)
|
||||
else:
|
||||
if contact_ids[0]['opt_out']:
|
||||
Contacts.write(cr, SUPERUSER_ID, [contact_ids[0]['id']], {'opt_out': False}, context=context)
|
||||
# add email to session
|
||||
request.session['mass_mailing_email'] = email
|
||||
return True
|
||||
|
|
|
@ -67,7 +67,7 @@ class sale_order_line(osv.osv):
|
|||
result=res['value']
|
||||
pricelist_obj=self.pool.get('product.pricelist')
|
||||
product_obj = self.pool.get('product.product')
|
||||
if product:
|
||||
if product and pricelist:
|
||||
if result.get('price_unit',False):
|
||||
price=result['price_unit']
|
||||
else:
|
||||
|
@ -77,10 +77,15 @@ class sale_order_line(osv.osv):
|
|||
list_price = pricelist_obj.price_get(cr, uid, [pricelist],
|
||||
product.id, qty or 1.0, partner_id, {'uom': uom,'date': date_order })
|
||||
|
||||
pricelists = pricelist_obj.read(cr,uid,[pricelist],['visible_discount'])
|
||||
so_pricelist = pricelist_obj.browse(cr, uid, pricelist, context=context)
|
||||
|
||||
new_list_price = get_real_price(list_price, product.id, qty, uom, pricelist)
|
||||
if len(pricelists)>0 and pricelists[0]['visible_discount'] and list_price[pricelist] != 0 and new_list_price != 0:
|
||||
if so_pricelist.visible_discount and list_price[pricelist] != 0 and new_list_price != 0:
|
||||
if product.company_id and so_pricelist.currency_id.id != product.company_id.currency_id.id:
|
||||
# new_list_price is in company's currency while price in pricelist currency
|
||||
new_list_price = self.pool['res.currency'].compute(cr, uid,
|
||||
product.company_id.currency_id.id, so_pricelist.currency_id.id,
|
||||
new_list_price, context=context)
|
||||
discount = (new_list_price - price) / new_list_price * 100
|
||||
if discount > 0:
|
||||
result['price_unit'] = new_list_price
|
||||
|
@ -89,4 +94,6 @@ class sale_order_line(osv.osv):
|
|||
result['discount'] = 0.0
|
||||
else:
|
||||
result['discount'] = 0.0
|
||||
else:
|
||||
result['discount'] = 0.0
|
||||
return res
|
||||
|
|
|
@ -152,8 +152,8 @@
|
|||
</div>
|
||||
<div class="container mt16 mb8">
|
||||
<div class="pull-right" t-ignore="true" t-if="not editable">
|
||||
Create a <a href="https://www.odoo.com/page/website-builder">free website</a> with
|
||||
<a class="label label-danger" href="https://www.odoo.com/">Odoo</a>
|
||||
Create a <a href="http://www.odoo.com/page/website-builder">free website</a> with
|
||||
<a class="label label-danger" href="http://www.odoo.com/page/website-builder">Odoo</a>
|
||||
</div>
|
||||
<div class="pull-left text-muted">
|
||||
Copyright &copy; <span t-field="res_company.name">Company name</span>
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
<group col="4">
|
||||
<field name="name"/>
|
||||
<field name="shortcut"/>
|
||||
<field name="domain"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
|
@ -182,8 +183,8 @@
|
|||
<field name="fax"/>
|
||||
<field name="user_ids" invisible="1"/>
|
||||
<field name="email" widget="email" attrs="{'required': [('user_ids','!=', [])]}"/>
|
||||
<field name="title" domain="[('domain', '=', 'contact')]"
|
||||
options='{"no_open": True}' attrs="{'invisible': [('is_company','=', True)]}" />
|
||||
<field name="title" domain="[('domain','=','contact')]" options='{"no_open": True}' attrs="{'invisible': [('is_company','=',True)]}" context="{'default_domain': 'contact'}"/>
|
||||
<field name="title" domain="[('domain','=','partner')]" options='{"no_open": True}' attrs="{'invisible': [('is_company','=',False)]}" context="{'default_domain': 'partner'}"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
|
|
|
@ -1082,6 +1082,16 @@ class BaseModel(object):
|
|||
# Failed to write, log to messages, rollback savepoint (to
|
||||
# avoid broken transaction) and keep going
|
||||
cr.execute('ROLLBACK TO SAVEPOINT model_load_save')
|
||||
except Exception, e:
|
||||
message = (_('Unknown error during import:') +
|
||||
' %s: %s' % (type(e), unicode(e)))
|
||||
moreinfo = _('Resolve other errors first')
|
||||
messages.append(dict(info, type='error',
|
||||
message=message,
|
||||
moreinfo=moreinfo))
|
||||
# Failed for some reason, perhaps due to invalid data supplied,
|
||||
# rollback savepoint and keep going
|
||||
cr.execute('ROLLBACK TO SAVEPOINT model_load_save')
|
||||
if any(message['type'] == 'error' for message in messages):
|
||||
cr.execute('ROLLBACK TO SAVEPOINT model_load')
|
||||
ids = False
|
||||
|
|
Loading…
Reference in New Issue