[IMP] Invoice from SO semantic (manually select with or without refunds)
This commit is contained in:
+1
-1
@@ -261,7 +261,7 @@ class SaleOrder(models.Model):
|
||||
invoices[group_key] = invoice
|
||||
if line.qty_to_invoice > 0:
|
||||
line.invoice_line_create(invoices[group_key].id, line.qty_to_invoice)
|
||||
elif line.qty_to_invoice < 0 and (final or invoices[group_key].amount_untaxed > abs(line.qty_to_invoice * line.price_unit)):
|
||||
elif line.qty_to_invoice < 0 and final:
|
||||
line.invoice_line_create(invoices[group_key].id, line.qty_to_invoice)
|
||||
|
||||
for invoice in invoices.values():
|
||||
|
||||
@@ -32,8 +32,8 @@ class SaleAdvancePaymentInv(models.TransientModel):
|
||||
return False
|
||||
|
||||
advance_payment_method = fields.Selection([
|
||||
('all', 'Invoiceable lines'),
|
||||
('delivered', 'Invoiceable lines (without refunds)'),
|
||||
('all', 'Invoiceable lines (deduce deposits)'),
|
||||
('delivered', 'Invoiceable lines'),
|
||||
('percentage', 'Deposit (percentage)'),
|
||||
('fixed', 'Deposit (fixed amount)')
|
||||
], string='What do you want to invoice?', default=_get_advance_payment_method, required=True)
|
||||
|
||||
@@ -27,17 +27,11 @@
|
||||
attrs="{'invisible': [('advance_payment_method', '!=', 'percentage')]}" class="oe_inline"/>
|
||||
</div>
|
||||
</group>
|
||||
<div attrs="{'invisible': [('advance_payment_method', '!=', 'delivered')]}">
|
||||
<span class="oe_grey">
|
||||
Note that if you select 'Invoiceable lines (without refunds)', you won't be able to create an invoice with a negative total amount.
|
||||
</span>
|
||||
</div>
|
||||
<footer>
|
||||
<button name="create_invoices" string="Create and View Invoices" type="object"
|
||||
context="{'open_invoices': True}" class="btn-primary"/>
|
||||
<button name="create_invoices" string="Create Invoices" type="object"
|
||||
class="btn-primary"/>
|
||||
or
|
||||
<button string="Cancel" class="btn-default" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
|
||||
@@ -89,7 +89,7 @@ class TestSaleStock(TestSale):
|
||||
self.assertEqual(inv.amount_untaxed, self.so.amount_untaxed * 5.0 / 100.0, 'Sale Stock: deposit invoice is wrong')
|
||||
self.assertEqual(self.so.invoice_status, 'to invoice', 'Sale Stock: so should be to invoice after invoicing deposit')
|
||||
# invoice on order: everything should be invoiced
|
||||
self.so.action_invoice_create()
|
||||
self.so.action_invoice_create(final=True)
|
||||
self.assertEqual(self.so.invoice_status, 'invoiced', 'Sale Stock: so should be fully invoiced after second invoice')
|
||||
|
||||
# deliver, check the delivered quantities
|
||||
|
||||
Reference in New Issue
Block a user