Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions addons/account/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,13 +516,9 @@ def onchange_company_id(self, company_id, part_id, type, invoice_line, currency_

values = {}
domain = {}
obj_journal = self.env['account.journal']
account_obj = self.env['account.account']
inv_line_obj = self.env['account.invoice.line']

if company_id and part_id and type:
p = self.env['res.partner'].browse(part_id)
acc_id = False
if p.property_account_payable and p.property_account_receivable and \
p.property_account_payable.company_id.id != company_id and \
p.property_account_receivable.company_id.id != company_id:
Expand Down Expand Up @@ -578,8 +574,11 @@ def onchange_company_id(self, company_id, part_id, type, invoice_line, currency_
if not values.get('journal_id'):
field_desc = journals.fields_get(['journal_id'])
type_label = next(t for t, label in field_desc['journal_id']['selection'] if t == journal_type)
raise except_orm(_('Configuration Error!'),
_('Cannot find any account journal of "%s" type for this company.\n\nYou can create one in the menu: \nConfiguration\Journals\Journals.') % journal_type_label)
raise except_orm(
_('Configuration Error!'),
_('Cannot find any account journal of "%s" type for this company.\n\n'
'You can create one in the menu: \n'
'Configuration\Journals\Journals.') % type_label)
domain = {'journal_id': [('id', 'in', journals.ids)]}

return {'value': values, 'domain': domain}
Expand Down Expand Up @@ -823,7 +822,7 @@ def action_move_create(self):
# I disabled the check_total feature
group_check_total = self.env.ref('account.group_supplier_inv_check_total')
if self.env.user in group_check_total.users:
if (inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding / 2.0)):
if inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding / 2.0):
raise except_orm(_('Bad Total!'), _('Please verify the price of the invoice!\nThe encoded total does not match the computed total.'))

if inv.payment_term:
Expand All @@ -850,7 +849,7 @@ def action_move_create(self):
total, total_currency, iml = inv.sudo(context=ctx).compute_invoice_totals(company_currency, ref, iml)

name = inv.name or inv.supplier_invoice_number or '/'
totlines = False
totlines = []
if inv.payment_term:
totlines = inv.sudo(context=ctx).payment_term.compute(total, inv.date_invoice)[0]
if totlines:
Expand Down Expand Up @@ -887,7 +886,7 @@ def action_move_create(self):
'amount_currency': diff_currency and total_currency,
'currency_id': diff_currency and inv.currency_id.id,
'ref': ref
})
})

date = inv.date_invoice or Date.today()

Expand Down Expand Up @@ -961,7 +960,7 @@ def line_get_convert(self, line, part, date):

@multi
def action_number(self):
#TODO: not correct fix but required a frech values before reading it.
#TODO: not correct fix but required a fresh values before reading it.
self.write({})

for inv in self:
Expand Down Expand Up @@ -1239,7 +1238,7 @@ def _default_price_unit(self):
if taxes and len(taxes[0]) >= 3 and taxes[0][2]:
taxes = self.env['account.tax'].browse(taxes[0][2])
tax_res = taxes.compute_all(price, vals.get('quantity'),
product=vals.get('product_id'), partner=context.get('partner_id'))
product=vals.get('product_id'), partner=self._context.get('partner_id'))
for tax in tax_res['taxes']:
total = total - tax['amount']
return total
Expand Down Expand Up @@ -1307,7 +1306,7 @@ def product_id_change(self, product, uom_id, qty=0, name='', type='out_invoice',
partner_id=False, fposition_id=False, price_unit=False, currency_id=False,
context=None, company_id=None):
context = context or {}
company_id = company_id if company_id != None else context.get('company_id', False)
company_id = company_id if company_id is not None else context.get('company_id', False)
self = self.sudo(company_id=company_id, force_company=company_id)

if not partner_id:
Expand Down
2 changes: 1 addition & 1 deletion addons/calendar/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def get_attendee_detail(self, cr, uid, ids, meeting_id, context=None):
Used by web_calendar.js : Many2ManyAttendee
"""
datas = []
meeting = False
meeting = None
if meeting_id:
meeting = self.pool['calendar.event'].browse(cr, uid, get_real_ids(meeting_id), context=context)
for partner in self.browse(cr, uid, ids, context=context):
Expand Down
4 changes: 2 additions & 2 deletions addons/crm/sales_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ def _get_opportunities_data(self, cr, uid, ids, field_name, arg, context=None):
help="The first contact you get with a potential customer is a lead you qualify before converting it into a real business opportunity. Check this box to manage leads in this sales team."),
'use_opportunities': fields.boolean('Opportunities', help="Check this box to manage opportunities in this sales team."),
'monthly_open_leads': fields.function(_get_opportunities_data,
type="string", readonly=True, multi='_get_opportunities_data',
type="char", readonly=True, multi='_get_opportunities_data',
string='Open Leads per Month'),
'monthly_planned_revenue': fields.function(_get_opportunities_data,
type="string", readonly=True, multi='_get_opportunities_data',
type="char", readonly=True, multi='_get_opportunities_data',
string='Planned Revenue per Month'),
'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="restrict", required=True, help="The email address associated with this team. New emails received will automatically create new leads assigned to the team."),
}
Expand Down