'sequence_id' : False,
}
d.update(default)
- return super(pos_order, self).copy(cr, uid, id, d, context=context)
+ return super(pos_config, self).copy(cr, uid, id, d, context=context)
def name_get(self, cr, uid, ids, context=None):
@return: True
"""
stock_picking_obj = self.pool.get('stock.picking')
+ wf_service = netsvc.LocalService("workflow")
for order in self.browse(cr, uid, ids, context=context):
wf_service.trg_validate(uid, 'stock.picking', order.picking_id.id, 'button_cancel', cr)
if stock_picking_obj.browse(cr, uid, order.picking_id.id, context=context).state <> 'cancel':
else:
grouped_data[key].append(values)
+ #because of the weird way the pos order is written, we need to make sure there is at least one line,
+ #because just after the 'for' loop there are references to 'line' and 'income_account' variables (that
+ #are set inside the for loop)
+ #TOFIX: a deep refactoring of this method (and class!) is needed in order to get rid of this stupid hack
+ assert order.lines, _('The POS order must have lines when calling this method')
# Create an move for each order line
-
for line in order.lines:
tax_amount = 0
taxes = [t for t in line.product_id.taxes_id]
'name': _('Tax') + ' ' + tax.name,
'quantity': line.qty,
'product_id': line.product_id.id,
- 'account_id': key[account_pos],
+ 'account_id': key[account_pos] or income_account,
'credit': ((tax_amount>0) and tax_amount) or 0.0,
'debit': ((tax_amount<0) and -tax_amount) or 0.0,
'tax_code_id': key[tax_code_pos],
account_tax_obj = self.pool.get('account.tax')
cur_obj = self.pool.get('res.currency')
for line in self.browse(cr, uid, ids, context=context):
- taxes_ids = filter(lambda t: t.company_id.id == line.order_id.company_id.id, line.product_id.taxes_id)
- price = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
+ taxes_ids = [ tax for tax in line.product_id.taxes_id if tax.company_id.id == line.order_id.company_id.id ]
price = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
taxes = account_tax_obj.compute_all(cr, uid, taxes_ids, price, line.qty, product=line.product_id, partner=line.order_id.partner_id or False)