Browse Source

[ADD] Initial Commit

pull/30/merge
SHEREEF PT 8 years ago
parent
commit
2e918c5a99
  1. 21
      sale_purchase_previous_product_cost/__init__.py
  2. 36
      sale_purchase_previous_product_cost/__manifest__.py
  3. 21
      sale_purchase_previous_product_cost/models/__init__.py
  4. 100
      sale_purchase_previous_product_cost/models/sale_order.py
  5. BIN
      sale_purchase_previous_product_cost/static/description/banner.jpg
  6. BIN
      sale_purchase_previous_product_cost/static/description/cybro_logo.png
  7. BIN
      sale_purchase_previous_product_cost/static/description/icon.png
  8. 130
      sale_purchase_previous_product_cost/static/description/index.html
  9. BIN
      sale_purchase_previous_product_cost/static/description/purchase.png
  10. BIN
      sale_purchase_previous_product_cost/static/description/purchase_form.png
  11. BIN
      sale_purchase_previous_product_cost/static/description/sale.png
  12. BIN
      sale_purchase_previous_product_cost/static/description/sale_form.png
  13. BIN
      sale_purchase_previous_product_cost/static/description/wizard.png
  14. 64
      sale_purchase_previous_product_cost/views/sale_order_view.xml

21
sale_purchase_previous_product_cost/__init__.py

@ -0,0 +1,21 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Nilmar Shereef(<https://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <https://www.gnu.org/licenses/>.
#
##############################################################################
import models

36
sale_purchase_previous_product_cost/__manifest__.py

@ -0,0 +1,36 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Nilmar Shereef(shereef@cybrosys.in)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <https://www.gnu.org/licenses/>.
#
##############################################################################
{
"name": "Previous Sale/Purchase Product Rates",
'version': '10.0.1.0',
"summary": """Provide Product's Previous Sale & Purchase Price History for Partner.""",
"description": """Provide product's previous prices in product master.""",
"category": "Sales",
'author': 'Cybrosys Techno Solutions',
'website': "https://www.cybrosys.com",
'company': 'Cybrosys Techno Solutions',
"depends": ['sale', 'purchase'],
"data": ['views/sale_order_view.xml'],
'images': ['static/description/banner.jpg'],
'license': 'LGPL-3',
'installable': True,
'auto_install': False,
'application': False,
}

21
sale_purchase_previous_product_cost/models/__init__.py

@ -0,0 +1,21 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Nilmar Shereef(<https://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <https://www.gnu.org/licenses/>.
#
##############################################################################
import sale_order

100
sale_purchase_previous_product_cost/models/sale_order.py

@ -0,0 +1,100 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Nilmar Shereef(<https://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <https://www.gnu.org/licenses/>.
#
##############################################################################
from odoo import models, api, fields
from odoo.exceptions import Warning
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
@api.onchange('product_id')
def set_partner(self):
for each in self:
print each.order_id.partner_id.id
if each.product_id:
each.product_id.write({'order_partner_id': each.order_id.partner_id.id})
sale_data = fields.Datetime(comodel_name='sale.order', string='Sale Date',
related='order_id.date_order', store=True)
class PurchaseOrderLine(models.Model):
_inherit = 'purchase.order.line'
@api.onchange('product_id')
def set_partner(self):
for each in self:
print each.order_id.partner_id.id
if each.product_id:
each.product_id.write({'order_partner_id': each.order_id.partner_id.id})
purchase_data = fields.Datetime(comodel_name='purchase.order', string='Purchase Date',
related='order_id.date_order', store=True)
class ProductTemplate(models.Model):
_inherit = "product.product"
order_partner_id = fields.Many2one('res.partner', string="Partner")
@api.multi
def action_sale_product_prices(self):
rel_view_id = self.env.ref(
'sale_purchase_previous_product_cost.last_sale_product_prices_view')
sale_lines = self.env['sale.order.line'].search([('product_id', '=', self.id),
('order_partner_id', '=', self.order_partner_id.id)],
order='create_date DESC')
if not sale_lines:
raise Warning("No sales history found.!")
else:
return {
'view_type': 'tree',
'view_mode': 'tree',
'res_model': 'sale.order.line',
'views': [(rel_view_id.id, 'tree')],
'view_id': False,
'type': 'ir.actions.act_window',
'target': 'new',
'domain': "[('id','in',[" + ','.join(map(str, sale_lines.ids)) + "])]",
}
@api.multi
def action_purchase_product_prices(self):
rel_view_id = self.env.ref(
'sale_purchase_previous_product_cost.last_sale_product_purchase_prices_view')
purchase_lines = self.env['purchase.order.line'].search([('product_id', '=', self.id),
('partner_id', '=', self.order_partner_id.id)],
order='create_date DESC')
if not purchase_lines:
raise Warning("No purchase history found.!")
else:
return {
'view_type': 'tree',
'view_mode': 'tree',
'res_model': 'purchase.order.line',
'views': [(rel_view_id.id, 'tree')],
'view_id': False,
'type': 'ir.actions.act_window',
'target': 'new',
'domain': "[('id','in',[" + ','.join(map(str, purchase_lines.ids)) + "])]",
}

BIN
sale_purchase_previous_product_cost/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

BIN
sale_purchase_previous_product_cost/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
sale_purchase_previous_product_cost/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

130
sale_purchase_previous_product_cost/static/description/index.html

@ -0,0 +1,130 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">Previous Sale/Purchase Product Rates</h2>
<h3 class="oe_slogan">...Provide Product's Previous Sale & Purchase Price History....</h3>
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a> </h4>
<div>
<h4><p>Features:</p></h4>
<ul>
<li style="list-style:none !important;"><span style="color:green;"> &#9745;</span>&nbsp;&nbsp; Previous sale price history.</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9745;</span>&nbsp;&nbsp; Previous purchase price history.</li>
<li style="list-style:none !important;"><span style="color:green;"> &#9745;</span>&nbsp;&nbsp; Provide product's previous prices in product page.</li>
</ul>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_picture">
<h3 class="oe_slogan">Overview</h3>
<p class="oe_mt32" style="text-align: center;">
This module enables a view to see all previous sale/purchase product rates of selected customer. It will help you to manage
your orders according to these price history. You can see these option from sale/purchase form.
</p>
</div>
</div>
</section>
<section class="oe_container">
<di class="oe_row oe_spaced">
<h3 class="oe_slogan">Sale/Purchase Order Form</h3>
<div class="oe_row oe_spaced">
<div class="oe_span12">
<div class="oe_row_img oe_centered">
<img style="border:10px solid white;" class="oe_picture oe_screenshot" src="sale_form.png">
</div>
</div>
<div class="oe_span12">
<div class="oe_row_img oe_centered">
<img style="border:10px solid white;" class="oe_picture oe_screenshot" src="purchase_form.png">
</div>
</div>
<div class="oe_span12">
<p class="text-center">
Select product & go to product form view
</p>
</div>
</div>
</di>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h3 class="oe_slogan">Product Form</h3>
<div class="oe_row oe_spaced">
<div class="oe_span12">
<div class="oe_row_img oe_centered">
<img style="border:10px solid white;" class="oe_picture oe_screenshot" src="wizard.png">
</div>
</div>
<div class="oe_span12">
<p class="text-center">
In product form you can see a new tab named "Previous Price History". In this tab 'Partner'
field already filled with the partner name which you are selected in sale/purchase form.
You have also an option to change this 'Partner'.
</p>
</div>
</div>
</div>
</section>
<section class="oe_container">
<di class="oe_row oe_spaced">
<h3 class="oe_slogan">Previous Price History</h3>
<div class="oe_row oe_spaced">
<div class="oe_span12">
<div class="oe_row_img oe_centered">
<img style="border:10px solid white;" class="oe_picture oe_screenshot" src="sale.png">
</div>
</div>
<div class="oe_span12">
<p class="text-center">
To see previous sale price history please click on the button name 'Previous Sale Rates'.
</p>
</div>
<div class="oe_span12">
<div class="oe_row_img oe_centered">
<img style="border:10px solid white;" class="oe_picture oe_screenshot" src="purchase.png">
</div>
</div>
<div class="oe_span12">
<p class="text-center">
To see previous purchase price history please click on the button name 'Previous Purchase Rates'.
</p>
</div>
</div>
</di>
</section>
<section class="oe_container oe_dark">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;">
<div>
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i
class="fa fa-envelope"></i> Email </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/contact/"><i
class="fa fa-phone"></i> Contact Us </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
<div>
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td>
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td>
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td>
</div>
</div>
</section>

BIN
sale_purchase_previous_product_cost/static/description/purchase.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
sale_purchase_previous_product_cost/static/description/purchase_form.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
sale_purchase_previous_product_cost/static/description/sale.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
sale_purchase_previous_product_cost/static/description/sale_form.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

BIN
sale_purchase_previous_product_cost/static/description/wizard.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

64
sale_purchase_previous_product_cost/views/sale_order_view.xml

@ -0,0 +1,64 @@
<?xml version="1.0"?>
<odoo>
<record id="last_sale_product_prices_view" model="ir.ui.view">
<field name="name">last.product.prices.view</field>
<field name="model">sale.order.line</field>
<field name="priority" eval="40"/>
<field name="arch" type="xml">
<tree string="Last Product Prices">
<field name="order_id"/>
<field name="order_partner_id"/>
<field name="sale_data"/>
<field name="product_id"/>
<field name="product_uom_qty"/>
<field name="price_unit"/>
<field name="price_subtotal"/>
</tree>
</field>
</record>
<record id="last_sale_product_purchase_prices_view" model="ir.ui.view">
<field name="name">last.product.purchase_prices.view</field>
<field name="model">purchase.order.line</field>
<field name="priority" eval="40"/>
<field name="arch" type="xml">
<tree string="Last Product Prices">
<field name="order_id"/>
<field name="partner_id"/>
<field name="purchase_data"/>
<field name="product_id"/>
<field name="product_qty"/>
<field name="price_unit"/>
<field name="price_subtotal"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="product_product_ext_form_view2">
<field name="name">product_extended.product.form.view</field>
<field name="model">product.product</field>
<field name="priority">3</field>
<field name="inherit_id" ref="product.product_normal_form_view" />
<field name="arch" type="xml">
<xpath expr="//notebook//page[2]" position="after">
<page string="Previous Price History" name="previous_sale_history">
<group>
<group>
<field name="order_partner_id"/>
</group>
</group>
<gruop>
<group>
<button name="action_sale_product_prices" string="Previous Sale Rates"
help="Last Prices" type="object"/>
</group>
<group>
<button name="action_purchase_product_prices" string="Previous Purchase Rates"
help="Last Prices" type="object"/>
</group>
</gruop>
</page>
</xpath>
</field>
</record>
</odoo>
Loading…
Cancel
Save