[FORWARD] Forward port of latest saas-2 fixes, until revision 9062 (revid tde@openerp.com-20140102124143-m1qv8koovjcl8mah)
bzr revid: tde@openerp.com-20140102133028-xhvkzstqy5t8dquh
This commit is contained in:
commit
2488f78e6d
|
@ -115,7 +115,7 @@
|
|||
- product_id: product.product_product_3
|
||||
product_qty: 1
|
||||
price_unit: 10
|
||||
date_planned: '2013-08-31'
|
||||
date_planned: !eval "'%s' % (time.strftime('%Y-%m-%d'))"
|
||||
-
|
||||
I confirm the purchase order.
|
||||
-
|
||||
|
@ -235,7 +235,7 @@
|
|||
As the Invoice state of the picking order is To be invoiced. I create invoice for my outgoing picking order.
|
||||
-
|
||||
!python {model: stock.invoice.onshipping}: |
|
||||
wiz_id = self.create(cr, uid, {'invoice_date': '2013-03-04', 'journal_id': ref('account.sales_journal')},
|
||||
wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal')},
|
||||
{'active_ids': [ref("stock_picking_out001")], "active_model": "stock.picking"})
|
||||
self.create_invoice(cr, uid, [wiz_id], {"lang": "en_US",
|
||||
"search_default_available": 1, "tz": False, "active_model": "stock.picking",
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
- product_id: product_fifo_anglo_saxon
|
||||
product_qty: 1
|
||||
price_unit: 9
|
||||
date_planned: '2013-08-31'
|
||||
date_planned: !eval "'%s' % (time.strftime('%Y-%m-%d'))"
|
||||
taxes_id: []
|
||||
-
|
||||
I confirm the purchase order.
|
||||
|
@ -237,7 +237,7 @@
|
|||
As the Invoice state of the picking order is To be invoiced. I create invoice for my outgoing picking order.
|
||||
-
|
||||
!python {model: stock.invoice.onshipping}: |
|
||||
wiz_id = self.create(cr, uid, {'invoice_date': '2013-03-04', 'journal_id': ref('account.sales_journal')},
|
||||
wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal')},
|
||||
{'active_ids': [ref("stock_picking_out001_fifo")], "active_model": "stock.picking"})
|
||||
self.create_invoice(cr, uid, [wiz_id], {"lang": "en_US",
|
||||
"search_default_available": 1, "tz": False, "active_model": "stock.picking",
|
||||
|
|
|
@ -49,9 +49,21 @@ class account_voucher(osv.osv):
|
|||
if 'value' in default:
|
||||
amount = 'amount' in default['value'] and default['value']['amount'] or amount
|
||||
|
||||
# Currency complete name is not available in res.currency model
|
||||
# Exceptions done here (EUR, USD, BRL) cover 75% of cases
|
||||
# For other currencies, display the currency code
|
||||
currency = self.pool['res.currency'].browse(cr, uid, currency_id, context=context)
|
||||
if currency.name.upper() == 'EUR':
|
||||
currency_name = 'Euro'
|
||||
elif currency.name.upper() == 'USD':
|
||||
currency_name = 'Dollars'
|
||||
elif currency.name.upper() == 'BRL':
|
||||
currency_name = 'reais'
|
||||
else:
|
||||
currency_name = currency.name
|
||||
#TODO : generic amount_to_text is not ready yet, otherwise language (and country) and currency can be passed
|
||||
#amount_in_word = amount_to_text(amount, context=context)
|
||||
amount_in_word = amount_to_text(amount)
|
||||
amount_in_word = amount_to_text(amount, currency=currency_name)
|
||||
default['value'].update({'amount_in_word':amount_in_word})
|
||||
if journal_id:
|
||||
allow_check_writing = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context).allow_check_writing
|
||||
|
|
|
@ -34,7 +34,6 @@ class report_print_check(report_sxw.rml_parse):
|
|||
'fill_stars' : self.fill_stars,
|
||||
})
|
||||
def fill_stars(self, amount):
|
||||
amount = amount.replace('Dollars','')
|
||||
if len(amount) < 100:
|
||||
stars = 100 - len(amount)
|
||||
return ' '.join([amount,'*'*stars])
|
||||
|
|
|
@ -746,7 +746,7 @@ class account_voucher(osv.osv):
|
|||
ids = context['move_line_ids']
|
||||
invoice_id = context.get('invoice_id', False)
|
||||
company_currency = journal.company_id.currency_id.id
|
||||
move_line_found = False
|
||||
move_lines_found = []
|
||||
|
||||
#order the lines by most old first
|
||||
ids.reverse()
|
||||
|
@ -761,21 +761,20 @@ class account_voucher(osv.osv):
|
|||
if line.invoice.id == invoice_id:
|
||||
#if the invoice linked to the voucher line is equal to the invoice_id in context
|
||||
#then we assign the amount on that line, whatever the other voucher lines
|
||||
move_line_found = line.id
|
||||
break
|
||||
move_lines_found.append(line.id)
|
||||
elif currency_id == company_currency:
|
||||
#otherwise treatments is the same but with other field names
|
||||
if line.amount_residual == price:
|
||||
#if the amount residual is equal the amount voucher, we assign it to that voucher
|
||||
#line, whatever the other voucher lines
|
||||
move_line_found = line.id
|
||||
move_lines_found.append(line.id)
|
||||
break
|
||||
#otherwise we will split the voucher amount on each line (by most old first)
|
||||
total_credit += line.credit or 0.0
|
||||
total_debit += line.debit or 0.0
|
||||
elif currency_id == line.currency_id.id:
|
||||
if line.amount_residual_currency == price:
|
||||
move_line_found = line.id
|
||||
move_lines_found.append(line.id)
|
||||
break
|
||||
total_credit += line.credit and line.amount_currency or 0.0
|
||||
total_debit += line.debit and line.amount_currency or 0.0
|
||||
|
@ -800,15 +799,16 @@ class account_voucher(osv.osv):
|
|||
'move_line_id':line.id,
|
||||
'account_id':line.account_id.id,
|
||||
'amount_original': amount_original,
|
||||
'amount': (move_line_found == line.id) and min(abs(price), amount_unreconciled) or 0.0,
|
||||
'amount': (line.id in move_lines_found) and min(abs(price), amount_unreconciled) or 0.0,
|
||||
'date_original':line.date,
|
||||
'date_due':line.date_maturity,
|
||||
'amount_unreconciled': amount_unreconciled,
|
||||
'currency_id': line_currency_id,
|
||||
}
|
||||
price -= rs['amount']
|
||||
#in case a corresponding move_line hasn't been found, we now try to assign the voucher amount
|
||||
#on existing invoices: we split voucher amount by most old first, but only for lines in the same currency
|
||||
if not move_line_found:
|
||||
if not move_lines_found:
|
||||
if currency_id == line_currency_id:
|
||||
if line.credit:
|
||||
amount = min(amount_unreconciled, abs(total_debit))
|
||||
|
|
|
@ -143,8 +143,9 @@ class hr_contract(osv.osv):
|
|||
@param contract_ids: list of contracts
|
||||
@return: the structures linked to the given contracts, ordered by hierachy (parent=False first, then first level children and so on) and without duplicata
|
||||
"""
|
||||
all_structures = []
|
||||
structure_ids = [contract.struct_id.id for contract in self.browse(cr, uid, contract_ids, context=context)]
|
||||
structure_ids = [contract.struct_id.id for contract in self.browse(cr, uid, contract_ids, context=context) if contract.struct_id]
|
||||
if not structure_ids:
|
||||
return []
|
||||
return list(set(self.pool.get('hr.payroll.structure')._get_parent_structure(cr, uid, structure_ids, context=context)))
|
||||
|
||||
|
||||
|
|
|
@ -84,10 +84,9 @@ class note_note(osv.osv):
|
|||
return ids and ids[0] or False
|
||||
|
||||
def _set_stage_per_user(self, cr, uid, id, name, value, args=None, context=None):
|
||||
if not value:
|
||||
return False
|
||||
note = self.browse(cr, SUPERUSER_ID, id, context=context) # do it as SUPERUSER because when creating, followers are not necessariliry set (another function field)
|
||||
stage_ids = [value] + [stage.id for stage in note.stage_ids if stage.user_id.id != uid]
|
||||
note = self.browse(cr, uid, id, context=context)
|
||||
if not value: return False
|
||||
stage_ids = [value] + [stage.id for stage in note.stage_ids if stage.user_id.id != uid ]
|
||||
return self.write(cr, uid, [id], {'stage_ids': [(6, 0, set(stage_ids))]}, context=context)
|
||||
|
||||
def _get_stage_per_user(self, cr, uid, ids, name, args, context=None):
|
||||
|
|
Loading…
Reference in New Issue