Browse Source

[UPDT] Bug fixed 'sale_discount_total'

pull/165/head
Ajmal Cybro 4 years ago
parent
commit
bce67c63ba
  1. 2
      sale_discount_total/__manifest__.py
  2. 5
      sale_discount_total/doc/RELEASE_NOTES.md
  3. 12
      sale_discount_total/models/sale.py
  4. 24
      sale_discount_total/views/sale_view.xml

2
sale_discount_total/__manifest__.py

@ -22,7 +22,7 @@
{
'name': 'Sale Discount on Total Amount',
'version': '13.0.1.0.1',
'version': '13.0.1.1.1',
'category': 'Sales Management',
'summary': "Discount on Total in Sale and Invoice With Discount Limit and Approval",
'author': 'Cybrosys Techno Solutions',

5
sale_discount_total/doc/RELEASE_NOTES.md

@ -10,5 +10,10 @@ Initial commit for Sale Discount On Total Amount
#### FIX
Bug Fixed, discount not updating to invoice
#### 01.04.2021
#### Version 13.0.1.1.1
#### FIX
discount roundoff issue

12
sale_discount_total/models/sale.py

@ -45,9 +45,9 @@ class SaleOrder(models.Model):
'amount_total': amount_untaxed + amount_tax,
})
discount_type = fields.Selection([('percent', 'Percentage'), ('amount', 'Amount')], string='Discount type',
readonly=True,states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
readonly=True,
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
default='percent')
discount_rate = fields.Float('Discount Rate', digits=dp.get_precision('Account'),
readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]})
@ -78,7 +78,7 @@ class SaleOrder(models.Model):
for line in order.order_line:
line.discount = discount
def _prepare_invoice(self,):
def _prepare_invoice(self, ):
invoice_vals = super(SaleOrder, self)._prepare_invoice()
invoice_vals.update({
'discount_type': self.discount_type,
@ -86,19 +86,13 @@ class SaleOrder(models.Model):
})
return invoice_vals
def button_dummy(self):
self.supply_rate()
return True
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
discount = fields.Float(string='Discount (%)', digits=(16, 20), default=0.0)

24
sale_discount_total/views/sale_view.xml

@ -12,33 +12,39 @@
groups="sales_team.group_sale_manager"/>
</xpath>
<xpath expr="//button[@name='action_cancel']" position="attributes">
<attribute name ="states">draft,sent,sale,waiting</attribute>
<attribute name="states">draft,sent,sale,waiting</attribute>
</xpath>
<xpath expr="//group[@name='note_group']" position="replace">
<group name="note_group" col="6">
<group name="discount" colspan="2">
<group name="note_group" col="6">
<group name="discount" colspan="2">
<field name="discount_type"/>
<field name="discount_rate"/>
</group>
<group class="oe_subtotal_footer oe_right" colspan="2" name="sale_total">
<field name="amount_untaxed" widget='monetary' options="{'currency_field': 'currency_id'}"/>
<field name="amount_discount" widget='monetary' options="{'currency_field': 'currency_id'}"/>
<field name="amount_discount" widget='monetary'
options="{'currency_field': 'currency_id'}"/>
<field name="amount_tax" widget='monetary' options="{'currency_field': 'currency_id'}"/>
<div class="oe_subtotal_footer_separator oe_inline o_td_label">
<label for="amount_total" />
<button name="button_dummy"
states="draft,sent" string="(update)" type="object" class="oe_edit_only oe_link"/>
<label for="amount_total"/>
<button name="button_dummy"
states="draft,sent" string="(update)" type="object"
class="oe_edit_only oe_link"/>
</div>
<field name="amount_total" nolabel="1" class="oe_subtotal_footer_separator" widget='monetary' options="{'currency_field': 'currency_id'}"/>
<field name="amount_total" nolabel="1" class="oe_subtotal_footer_separator"
widget='monetary' options="{'currency_field': 'currency_id'}"/>
</group>
<group colspan="4">
<group colspan="4">
<field name="note" nolabel="1" placeholder="Terms and conditions..."/>
</group>
<div class="oe_clear"/>
</group>
</xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='discount']" position="attributes">
<attribute name="digits">[16, 2]</attribute>
</xpath>
</field>
</record>

Loading…
Cancel
Save