#5687: Modul global_discount hinzugefügt
|
|
@ -0,0 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
###########################################################################
|
||||
#
|
||||
# Copyright (C) 2016 - Today Turkesh Patel. <http://www.almightycs.com>
|
||||
#
|
||||
# @author Turkesh Patel <info@almightycs.com>
|
||||
###########################################################################
|
||||
|
||||
{
|
||||
'name': 'Sale, Purchase and Invoice Global Discounts',
|
||||
'category': 'Accounting',
|
||||
'version': '1.0',
|
||||
'author' : 'Almighty Consulting Services',
|
||||
'support': 'info@almightycs.com',
|
||||
'website' : 'http://www.almightycs.com',
|
||||
'summary': """Apply Global Discounts on Sale, Purchase Orders and Invoice based on fixed amounts and percentage""",
|
||||
'description': """Apply Global Discounts on Sale, Purchase Orders and Invoice based on fixed amounts and percentage.
|
||||
Global Discounts
|
||||
Global Discount
|
||||
Fixed Amount Discount
|
||||
Discount on Total
|
||||
Discount in Purchase
|
||||
Discount in Invoice
|
||||
Discount in Sale
|
||||
Global Discount in Purchase
|
||||
Global Discount in Invoice
|
||||
Global Discount in Sale""",
|
||||
'depends': ['purchase','sale_management','account'],
|
||||
'data': [
|
||||
'views/purchase_view.xml',
|
||||
'views/sale_view.xml',
|
||||
'views/invoice_view.xml',
|
||||
'views/res_config_view.xml',
|
||||
],
|
||||
'images': [
|
||||
'static/description/discount_cover_almightycs_turkesh.png',
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
'price': 35,
|
||||
'currency': 'EUR',
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import sale
|
||||
from . import purchase
|
||||
from . import invoice
|
||||
from . import res_config
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import fields, models, api, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
class Invoice(models.Model):
|
||||
_inherit = "account.invoice"
|
||||
|
||||
global_discount = fields.Boolean("Add Global Disocunt", readonly=True, states={'draft': [('readonly', False)]},)
|
||||
discount_type = fields.Selection([('fixed','Fixed'),('percentage','Percentage')],
|
||||
"Disocunt Type", readonly=True, states={'draft': [('readonly', False)]}, default='fixed')
|
||||
discount_amount = fields.Float("Disocunt Amount", readonly=True, states={'draft': [('readonly', False)]},)
|
||||
discount_percentage = fields.Float("Disocunt Percentage", readonly=True, states={'draft': [('readonly', False)]},)
|
||||
|
||||
@api.multi
|
||||
def _discount_unset(self):
|
||||
if self.env.user.company_id.invoice_discount_product_id:
|
||||
self.env['account.invoice.line'].search([('invoice_id', 'in', self.ids), ('product_id', '=', self.env.user.company_id.invoice_discount_product_id.id)]).unlink()
|
||||
|
||||
@api.multi
|
||||
def create_discount(self):
|
||||
InvoiceLine = self.env['account.invoice.line']
|
||||
|
||||
product_id = self.env.user.company_id.invoice_discount_product_id
|
||||
if not product_id:
|
||||
raise UserError(_('Please set Invoice Discount product in General Settings first.'))
|
||||
|
||||
# Remove Discount line first
|
||||
self._discount_unset()
|
||||
|
||||
account_id = product_id.property_account_income_id.id
|
||||
if not account_id:
|
||||
prop = self.env['ir.property'].get('property_account_income_categ_id', 'product.category')
|
||||
account_id = prop and prop.id or False
|
||||
|
||||
for invoice in self:
|
||||
amount = 0
|
||||
if invoice.discount_type == 'fixed':
|
||||
amount = invoice.discount_amount
|
||||
if invoice.discount_type == 'percentage':
|
||||
amount = (invoice.amount_total * invoice.discount_percentage)/100
|
||||
|
||||
# Apply fiscal position
|
||||
taxes = product_id.taxes_id.filtered(lambda t: t.company_id.id == invoice.company_id.id)
|
||||
taxes_ids = taxes.ids
|
||||
if invoice.partner_id and self.fiscal_position_id:
|
||||
taxes_ids = self.fiscal_position_id.map_tax(taxes, product_id, invoice.partner_id).ids
|
||||
|
||||
# Create the Invoice line
|
||||
InvoiceLine.create({
|
||||
'name': product_id.name,
|
||||
'price_unit': -amount,
|
||||
'account_id': account_id,
|
||||
'quantity': 1.0,
|
||||
'discount': 0.0,
|
||||
'uom_id': product_id.uom_id.id,
|
||||
'product_id': product_id.id,
|
||||
'invoice_id': invoice.id,
|
||||
'invoice_line_tax_ids': [(6, 0, taxes_ids)],
|
||||
'sequence': 100,
|
||||
})
|
||||
return True
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import fields, models, api, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
class PurchaseOrder(models.Model):
|
||||
_inherit = "purchase.order"
|
||||
|
||||
global_discount = fields.Boolean("Add Global Disocunt", readonly=True, states={'draft': [('readonly', False)]},)
|
||||
discount_type = fields.Selection([('fixed','Fixed'),('percentage','Percentage')],
|
||||
"Disocunt Type", readonly=True, states={'draft': [('readonly', False)]}, default='fixed')
|
||||
discount_amount = fields.Float("Disocunt Amount", readonly=True, states={'draft': [('readonly', False)]},)
|
||||
discount_percentage = fields.Float("Disocunt Percentage", readonly=True, states={'draft': [('readonly', False)]},)
|
||||
|
||||
@api.multi
|
||||
def _discount_unset(self):
|
||||
if self.env.user.company_id.purchase_discount_product_id:
|
||||
self.env['purchase.order.line'].search([('order_id', 'in', self.ids), ('product_id', '=', self.env.user.company_id.purchase_discount_product_id.id)]).unlink()
|
||||
|
||||
@api.multi
|
||||
def create_discount(self):
|
||||
Line = self.env['purchase.order.line']
|
||||
|
||||
product_id = self.env.user.company_id.purchase_discount_product_id
|
||||
if not product_id:
|
||||
raise UserError(_('Please set Purchase Discount product in General Settings first.'))
|
||||
|
||||
# Remove Discount line first
|
||||
self._discount_unset()
|
||||
|
||||
for order in self:
|
||||
amount = 0
|
||||
if order.discount_type == 'fixed':
|
||||
amount = order.discount_amount
|
||||
if order.discount_type == 'percentage':
|
||||
amount = (order.amount_total * order.discount_percentage)/100
|
||||
|
||||
# Create the Purchase line
|
||||
Line.create({
|
||||
'name': product_id.name,
|
||||
'price_unit': -amount,
|
||||
'product_qty': 1.0,
|
||||
'product_uom': product_id.uom_id.id,
|
||||
'product_id': product_id.id,
|
||||
'order_id': order.id,
|
||||
'date_planned': fields.datetime.now(),
|
||||
#'sequence': 100,
|
||||
})
|
||||
return True
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import fields, models, api
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
_inherit = "res.company"
|
||||
|
||||
purchase_discount_product_id = fields.Many2one('product.product', string='Purchase Discount Product')
|
||||
sale_discount_product_id = fields.Many2one('product.product', string='Sale Discount Product')
|
||||
invoice_discount_product_id = fields.Many2one('product.product', string='Invoice Discount Product')
|
||||
|
||||
|
||||
class ResConfigSettings(models.TransientModel):
|
||||
_inherit = 'res.config.settings'
|
||||
|
||||
purchase_discount_product_id = fields.Many2one('product.product', string='Purchase Discount Product')
|
||||
sale_discount_product_id = fields.Many2one('product.product', string='Sale Discount Product')
|
||||
invoice_discount_product_id = fields.Many2one('product.product', string='Invoice Discount Product')
|
||||
|
||||
@api.model
|
||||
def get_values(self):
|
||||
res = super(ResConfigSettings, self).get_values()
|
||||
res.update(
|
||||
purchase_discount_product_id=self.env.user.company_id.purchase_discount_product_id and self.env.user.company_id.purchase_discount_product_id.id or False,
|
||||
sale_discount_product_id=self.env.user.company_id.sale_discount_product_id and self.env.user.company_id.sale_discount_product_id.id or False,
|
||||
invoice_discount_product_id=self.env.user.company_id.invoice_discount_product_id and self.env.user.company_id.invoice_discount_product_id.id or False,
|
||||
)
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
def set_values(self):
|
||||
super(ResConfigSettings, self).set_values()
|
||||
if not self.env.user._is_admin():
|
||||
raise AccessError(_("Only administrators can change the settings"))
|
||||
|
||||
self.env.user.company_id.purchase_discount_product_id = self.purchase_discount_product_id.id
|
||||
self.env.user.company_id.sale_discount_product_id = self.sale_discount_product_id.id
|
||||
self.env.user.company_id.invoice_discount_product_id = self.invoice_discount_product_id.id
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import fields, models, api, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = "sale.order"
|
||||
|
||||
global_discount = fields.Boolean("Add Global Disocunt", readonly=True, states={'draft': [('readonly', False)]},)
|
||||
discount_type = fields.Selection([('fixed','Fixed'),('percentage','Percentage')],
|
||||
"Disocunt Type", readonly=True, states={'draft': [('readonly', False)]}, default='fixed')
|
||||
discount_amount = fields.Float("Disocunt Amount", readonly=True, states={'draft': [('readonly', False)]},)
|
||||
discount_percentage = fields.Float("Disocunt Percentage", readonly=True, states={'draft': [('readonly', False)]},)
|
||||
|
||||
@api.multi
|
||||
def _discount_unset(self):
|
||||
if self.env.user.company_id.sale_discount_product_id:
|
||||
self.env['sale.order.line'].search([('order_id', 'in', self.ids), ('product_id', '=', self.env.user.company_id.sale_discount_product_id.id)]).unlink()
|
||||
|
||||
@api.multi
|
||||
def create_discount(self):
|
||||
Line = self.env['sale.order.line']
|
||||
|
||||
product_id = self.env.user.company_id.sale_discount_product_id
|
||||
if not product_id:
|
||||
raise UserError(_('Please set Sale Discount product in General Settings first.'))
|
||||
|
||||
# Remove Discount line first
|
||||
self._discount_unset()
|
||||
|
||||
for order in self:
|
||||
amount = 0
|
||||
if order.discount_type == 'fixed':
|
||||
amount = order.discount_amount
|
||||
if order.discount_type == 'percentage':
|
||||
amount = (order.amount_total * order.discount_percentage)/100
|
||||
|
||||
# Create the Sale line
|
||||
Line.create({
|
||||
'name': product_id.name,
|
||||
'price_unit': -amount,
|
||||
'quantity': 1.0,
|
||||
'discount': 0.0,
|
||||
'product_uom': product_id.uom_id.id,
|
||||
'product_id': product_id.id,
|
||||
'order_id': order.id,
|
||||
'sequence': 100,
|
||||
})
|
||||
return True
|
||||
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 9.9 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
|
@ -0,0 +1,109 @@
|
|||
<head>
|
||||
<style>
|
||||
.backgrounds{background-color:#fff; color:#0B80E6}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<section class="oe_container">
|
||||
<div class="oe_row oe_spaced">
|
||||
<div class="oe_span12 oe_mt32 mb32">
|
||||
<h3 class="oe_slogan">Sale, Purchase and Invoice Global Discounts.</h3><h4><br/>In many cases we need to give some global discount on order. To handle such cases we have added this module where you can add discounts based on percentage or fixed amount.<br/>You will need to configure discount product in general settings and that product will be added as discount on Order. So you can set proper account on product and get expected analysis for account in related accounting reports</h4>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="oe_container">
|
||||
<div class="oe_row oe_spaced">
|
||||
<div class="oe_demo oe_picture oe_screenshot">
|
||||
<a href="http://www.almightycs.com/blog/blogs-1/post/add-global-discounts-in-odoo-42" target="_blank">
|
||||
<img src="discount_settings_almightycs_odoo_turkesh_patel.png">
|
||||
</a>
|
||||
<div class="oe_demo_footer oe_centeralign">Set Discount product on general setting.</div>
|
||||
</div>
|
||||
<div class="oe_demo oe_picture oe_screenshot mt92">
|
||||
<a href="http://www.almightycs.com/blog/blogs-1/post/add-global-discounts-in-odoo-42" target="_blank">
|
||||
<img src="sale_discount_almightycs_odoo_turkesh_patel.png">
|
||||
</a>
|
||||
<div class="oe_demo_footer oe_centeralign">Fields to add discount on Sale Order.</div>
|
||||
</div>
|
||||
<div class="oe_demo oe_picture oe_screenshot mt92">
|
||||
<a href="http://www.almightycs.com/blog/blogs-1/post/add-global-discounts-in-odoo-42" target="_blank">
|
||||
<img src="purchase_discount_almightycs_odoo_turkesh_patel.png">
|
||||
</a>
|
||||
<div class="oe_demo_footer oe_centeralign">Fields to add discount on Puchase Order.</div>
|
||||
</div>
|
||||
<div class="oe_demo oe_picture oe_screenshot mt92">
|
||||
<a href="http://www.almightycs.com/blog/blogs-1/post/add-global-discounts-in-odoo-42" target="_blank">
|
||||
<img src="invoice_discount_almightycs_odoo_turkesh_patel.png">
|
||||
</a>
|
||||
<div class="oe_demo_footer oe_centeralign">Fields to add discount on Invoice.</div>
|
||||
</div>
|
||||
<div class="oe_demo oe_picture oe_screenshot mt92">
|
||||
<a href="http://www.almightycs.com/blog/blogs-1/post/add-global-discounts-in-odoo-42" target="_blank">
|
||||
<img src="bill_discount_almightycs_odoo_turkesh_patel.png">
|
||||
</a>
|
||||
<div class="oe_demo_footer oe_centeralign">Fields to add discount on Bill.</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="oe_container">
|
||||
<div class="oe_row oe_spaced">
|
||||
<div class="oe_span12">
|
||||
<h3 class="oe_slogan">Other Configuration</h3>
|
||||
<p class="oe_slogan">To use this module no technical knowledge is required even no configuration is needed. Just install module and functionality is ready to use. For more customization and help contactus.</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<section class="oe_container">
|
||||
<div class="oe_row oe_spaced">
|
||||
<div class="oe_span6">
|
||||
<div class="oe_demo oe_picture oe_screenshot">
|
||||
<a href="http://www.almightycs.com" target="_blank">
|
||||
<img src="acs.png" width="200" height="auto">
|
||||
</a>
|
||||
<div class="oe_demo_footer oe_centeralign">Meet Us</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oe_span6">
|
||||
<br/><br/>
|
||||
<h2 class="oe_slogan">Do you need help?</h2>
|
||||
<h3 class="oe_slogan">
|
||||
Let's offer you the best services!
|
||||
</h3>
|
||||
<p class="oe_mt32 text-center">
|
||||
Contact us by our official channels.
|
||||
</p>
|
||||
<p class="oe_mt32 text-center">
|
||||
Skype: turkesh4friends
|
||||
</p>
|
||||
<div class="oe_spaced">
|
||||
<ul class="text-center list-inline">
|
||||
<li>
|
||||
<a href="https://in.linkedin.com/pub/patel-turkesh/1b/51b/32b" Target="_blank"><i class="fa fa-linkedin-square fa-xs backgrounds"></i></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://www.facebook.com/public/Turkesh-Patel" Target="_blank"><i class="fa fa-facebook-square fa-xs backgrounds"></i></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://github.com/tpa-odoo" Target="_blank"><i class="fa fa-github-square fa-xs backgrounds"></i></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://plus.google.com/+TurkeshPatel" Target="_blank"><i class="fa fa-google-plus-square fa-xs backgrounds"></i></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://twitter.com/turkeshpatel?lang=en" Target="_blank" ><i class="fa fa-twitter-square fa-xs backgrounds"></i></a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a title="Contact us" data-toggle="tooltip" data-placement="left" Target="_blank" href="http://www.almightycs.com/page/website.contactus"><i class="fa fa-envelope-square fa-xs backgrounds"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 77 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<!-- Invoice View -->
|
||||
<record id="invoice_form" model="ir.ui.view">
|
||||
<field name="name">account.invoice.form.withholding</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="inherit_id" ref="account.invoice_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='user_id']" position="after">
|
||||
<label for="global_discount"/>
|
||||
<div name='global_discount'>
|
||||
<div>
|
||||
<field name='global_discount' class="oe_inline" nolabel="1" attrs="{'invisible': [('state','!=', 'draft')]}"/>
|
||||
<field name='discount_type' class="oe_inline" nolabel="1" attrs="{'invisible': ['|',('global_discount','=', False), ('state','!=', 'draft')], 'required':[('global_discount','!=', False)]}"/>
|
||||
<field name='discount_amount' class="oe_inline" nolabel="1" attrs="{'invisible': ['|','|',('global_discount','=', False), ('state','!=', 'draft'),('discount_type','!=','fixed')]}"/>
|
||||
<field name='discount_percentage' class="oe_inline" nolabel="1" attrs="{'invisible': ['|','|',('global_discount','=', False), ('state','!=', 'draft'),('discount_type','!=','percentage')]}"/>
|
||||
<button name="create_discount" string="Add Line" type="object" class="oe_inline fa fa-arrow-right oe_link" attrs="{'invisible': ['|',('global_discount','=', False), ('state','!=', 'draft')]}"/>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Bill View -->
|
||||
<record id="invoice_supplier_form" model="ir.ui.view">
|
||||
<field name="name">account.invoice.form.withholding</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="inherit_id" ref="account.invoice_supplier_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='date_due']" position="after">
|
||||
<label for="global_discount"/>
|
||||
<div name='global_discount'>
|
||||
<div>
|
||||
<field name='global_discount' class="oe_inline" nolabel="1" attrs="{'invisible': [('state','!=', 'draft')]}"/>
|
||||
<field name='discount_type' class="oe_inline" nolabel="1" attrs="{'invisible': ['|',('global_discount','=', False), ('state','!=', 'draft')], 'required':[('global_discount','!=', False)]}"/>
|
||||
<field name='discount_amount' class="oe_inline" nolabel="1" attrs="{'invisible': ['|','|',('global_discount','=', False), ('state','!=', 'draft'),('discount_type','!=','fixed')]}"/>
|
||||
<field name='discount_percentage' class="oe_inline" nolabel="1" attrs="{'invisible': ['|','|',('global_discount','=', False), ('state','!=', 'draft'),('discount_type','!=','percentage')]}"/>
|
||||
<button name="create_discount" string="Add Line" type="object" class="oe_inline fa fa-arrow-right oe_link" attrs="{'invisible': ['|',('global_discount','=', False), ('state','!=', 'draft')]}"/>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<!-- Purchase View -->
|
||||
<record id="purchase_order_form" model="ir.ui.view">
|
||||
<field name="name">purchase.order.form.rounding</field>
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="inherit_id" ref="purchase.purchase_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='origin']" position="after">
|
||||
<label for="global_discount"/>
|
||||
<div name='global_discount'>
|
||||
<div>
|
||||
<field name='global_discount' class="oe_inline" nolabel="1" attrs="{'invisible': [('state','!=', 'draft')]}"/>
|
||||
<field name='discount_type' class="oe_inline" nolabel="1" attrs="{'invisible': ['|',('global_discount','=', False), ('state','!=', 'draft')], 'required':[('global_discount','!=', False)]}"/>
|
||||
<field name='discount_amount' class="oe_inline" nolabel="1" attrs="{'invisible': ['|','|',('global_discount','=', False), ('state','!=', 'draft'),('discount_type','!=','fixed')]}"/>
|
||||
<field name='discount_percentage' class="oe_inline" nolabel="1" attrs="{'invisible': ['|','|',('global_discount','=', False), ('state','!=', 'draft'),('discount_type','!=','percentage')]}"/>
|
||||
<button name="create_discount" string="Add Line" type="object" class="oe_inline fa fa-arrow-right oe_link" attrs="{'invisible': ['|',('global_discount','=', False), ('state','!=', 'draft')]}"/>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="res_config_settings_view_form" model="ir.ui.view">
|
||||
<field name="name">res.config.settings</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="inherit_id" ref="base_setup.res_config_settings_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="company_id" position="before">
|
||||
<div id="discount">
|
||||
<h2>Discount Configuration</h2>
|
||||
<div class="row mt16 o_settings_container">
|
||||
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||
<div class="o_setting_right_pane">
|
||||
<label string="Default Discount Products"/>
|
||||
<div class="content-group">
|
||||
<div class="mt16 row">
|
||||
<label for="sale_discount_product_id" class="col-xs-3 col-md-3 o_light_label"/>
|
||||
<field name="sale_discount_product_id" class="oe_inline"/>
|
||||
</div>
|
||||
<div class="mt16 row">
|
||||
<label for="purchase_discount_product_id" class="col-xs-3 col-md-3 o_light_label"/>
|
||||
<field name="purchase_discount_product_id" class="oe_inline"/>
|
||||
</div>
|
||||
<div class="mt16 row">
|
||||
<label for="invoice_discount_product_id" class="col-xs-3 col-md-3 o_light_label"/>
|
||||
<field name="invoice_discount_product_id" class="oe_inline"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<!-- Sale View -->
|
||||
<record id="view_order_form" model="ir.ui.view">
|
||||
<field name="name">sale.order.form.rounding</field>
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='payment_term_id']" position="after">
|
||||
<label for="global_discount"/>
|
||||
<div name='global_discount'>
|
||||
<div>
|
||||
<field name='global_discount' class="oe_inline" nolabel="1" attrs="{'invisible': [('state','!=', 'draft')]}"/>
|
||||
<field name='discount_type' class="oe_inline" nolabel="1" attrs="{'invisible': ['|',('global_discount','=', False), ('state','!=', 'draft')], 'required':[('global_discount','!=', False)]}"/>
|
||||
<field name='discount_amount' class="oe_inline" nolabel="1" attrs="{'invisible': ['|','|',('global_discount','=', False), ('state','!=', 'draft'),('discount_type','!=','fixed')]}"/>
|
||||
<field name='discount_percentage' class="oe_inline" nolabel="1" attrs="{'invisible': ['|','|',('global_discount','=', False), ('state','!=', 'draft'),('discount_type','!=','percentage')]}"/>
|
||||
<button name="create_discount" string="Add Line" type="object" class="oe_inline fa fa-arrow-right oe_link" attrs="{'invisible': ['|',('global_discount','=', False), ('state','!=', 'draft')]}"/>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||