| @ -0,0 +1,56 @@ | |||
| .. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg | |||
|     :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html | |||
|     :alt: License: AGPL-3 | |||
| 
 | |||
| Previous Sale/Purchase Product Rates | |||
| ==================================== | |||
| This module enables a view to see all previous sale/purchase product rates of selected customer. | |||
| 
 | |||
| Configuration | |||
| ============= | |||
| * No additional configurations needed | |||
| 
 | |||
| Company | |||
| ------- | |||
| * `Cybrosys Techno Solutions <https://cybrosys.com/>`__ | |||
| 
 | |||
| License | |||
| ------- | |||
| Affero General Public License v3.0 (AGPL v3) | |||
| (https://www.gnu.org/licenses/agpl-3.0-standalone.html) | |||
| 
 | |||
| Credits | |||
| ------- | |||
| * Developers: | |||
|             Nilamr Shereef, | |||
|             (V11) Niyas Raphy @cybrosys,( | |||
|             (V12) Vinaya S B , | |||
|             (V13) Mehjabin Farsana P, | |||
|             (V14) Minhaj T , | |||
|             (V15) Midilaj V K , | |||
|             (V16) Sahla Sherin , | |||
|             (V17) Anjhana A K, | |||
|             (V18) Manasa T P | |||
|   Contact: odoo@cybrosys.com | |||
| 
 | |||
| Contacts | |||
| -------- | |||
| * Mail Contact : odoo@cybrosys.com | |||
| * Website : https://cybrosys.com | |||
| 
 | |||
| Bug Tracker | |||
| ----------- | |||
| Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. | |||
| 
 | |||
| Maintainer | |||
| ========== | |||
| .. image:: https://cybrosys.com/images/logo.png | |||
|    :target: https://cybrosys.com | |||
| 
 | |||
| This module is maintained by Cybrosys Technologies. | |||
| 
 | |||
| For support and more information, please visit `Our Website <https://cybrosys.com/>`__ | |||
| 
 | |||
| Further information | |||
| =================== | |||
| HTML Description: `<static/description/index.html>`__ | |||
| @ -0,0 +1,21 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################# | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| # | |||
| #    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | |||
| #    Author:Manasa T P(<https://www.cybrosys.com>) | |||
| #    You can modify it under the terms of the GNU AFFERO | |||
| #    GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | |||
| # | |||
| #    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | |||
| #    (AGPL v3) along with this program. | |||
| #    If not, see <http://www.gnu.org/licenses/>. | |||
| # | |||
| ############################################################################# | |||
| from . import models | |||
| @ -0,0 +1,44 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################# | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| # | |||
| #    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | |||
| #    Author:Manasa T P(<https://www.cybrosys.com>) | |||
| #    You can modify it under the terms of the GNU AFFERO | |||
| #    GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | |||
| # | |||
| #    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | |||
| #    (AGPL v3) along with this program. | |||
| #    If not, see <http://www.gnu.org/licenses/>. | |||
| # | |||
| ############################################################################# | |||
| { | |||
|     "name": "Previous Sale/Purchase Product Rates", | |||
|     'version': '18.0.1.0.0', | |||
|     "category": "Sales, Purchases", | |||
|     "summary": """Provide Product's Previous Sale & Purchase Price History  | |||
|     for Partner.""", | |||
|     "description": """With this module you can create a user-friendly system  | |||
|     that allows users to easily track a product's sale and purchase price  | |||
|     history for a specific partner, promoting efficiency and usability.'""", | |||
|     'author': 'Cybrosys Techno Solutions', | |||
|     'website': "https://www.cybrosys.com", | |||
|     'company': 'Cybrosys Techno Solutions', | |||
|     "depends": [ 'sale_management', 'purchase'], | |||
|     "data": [ | |||
|         'views/sale_order_views.xml', | |||
|         'views/purchase_order_views.xml', | |||
|         'views/product_product_views.xml', | |||
|     ], | |||
|     'images': ['static/description/banner.jpg'], | |||
|     'license': 'AGPL-3', | |||
|     'installable': True, | |||
|     'auto_install': False, | |||
|     'application': False, | |||
| } | |||
| @ -0,0 +1,7 @@ | |||
| ## Module <sale_purchase_previous_product_cost> | |||
| 
 | |||
| #### 17.04.2025 | |||
| #### Version 18.0.1.0.0 | |||
| #### ADD | |||
| 
 | |||
| - Initial Commit Previous Sale/Purchase Product Rates | |||
| @ -0,0 +1,23 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################# | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| # | |||
| #    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | |||
| #    Author:Manasa T P(<https://www.cybrosys.com>) | |||
| #    You can modify it under the terms of the GNU AFFERO | |||
| #    GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | |||
| # | |||
| #    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | |||
| #    (AGPL v3) along with this program. | |||
| #    If not, see <http://www.gnu.org/licenses/>. | |||
| # | |||
| ############################################################################# | |||
| from . import product_product | |||
| from . import purchase_order_line | |||
| from . import sale_order_line | |||
| @ -0,0 +1,80 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################# | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| # | |||
| #    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | |||
| #    Author:Manasa T P(<https://www.cybrosys.com>) | |||
| #    You can modify it under the terms of the GNU AFFERO | |||
| #    GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | |||
| # | |||
| #    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | |||
| #    (AGPL v3) along with this program. | |||
| #    If not, see <http://www.gnu.org/licenses/>. | |||
| # | |||
| ############################################################################# | |||
| from odoo import fields, models | |||
| from odoo.exceptions import UserError | |||
| 
 | |||
| 
 | |||
| class ProductProduct(models.Model): | |||
|     """Inherited Product to add a field order partner id""" | |||
|     _inherit = "product.product" | |||
| 
 | |||
|     order_partner_id = fields.Many2one('res.partner', | |||
|                                        string="Partner", help='Order Partner') | |||
| 
 | |||
|     def action_sale_product_prices(self): | |||
|         """On clicking this button sales details such as partner and price could | |||
|          be viewed """ | |||
|         rel_view_id = self.env.ref( | |||
|             'sale_purchase_previous_product_cost.sale_order_line_view_tree') | |||
|         if self.order_partner_id.id: | |||
|             sale_lines = self.env['sale.order.line'].search( | |||
|                 [('product_id', '=', self.id), | |||
|                  ('order_partner_id', '=', self.order_partner_id.id)], | |||
|                 order='create_date DESC').mapped('id') | |||
|         else: | |||
|             sale_lines = self.env['sale.order.line'].search( | |||
|                 [('product_id', '=', self.id)], | |||
|                 order='create_date DESC').mapped('id') | |||
|         if not sale_lines: | |||
|             raise UserError("No sales history found.!") | |||
|         return { | |||
|             'domain': [('id', 'in', sale_lines)], | |||
|             'views': [(rel_view_id.id, 'list')], | |||
|             'name': 'Sales History', | |||
|             'res_model': 'sale.order.line', | |||
|             'view_mode': 'list', | |||
|             'type': 'ir.actions.act_window', | |||
|             } | |||
| 
 | |||
|     def action_purchase_product_prices(self): | |||
|         """On clicking this button Purchase details such as partner and price | |||
|         could  be viewed """ | |||
|         rel_view_id = self.env.ref( | |||
|             'sale_purchase_previous_product_cost.purchase_order_line_view_tree') | |||
|         if self.order_partner_id.id: | |||
|             purchase_lines = self.env['purchase.order.line'].search( | |||
|                 [('product_id', '=', self.id), | |||
|                  ('partner_id', '=', self.order_partner_id.id)], | |||
|                 order='create_date DESC').mapped('id') | |||
|         else: | |||
|             purchase_lines = self.env['purchase.order.line'].search( | |||
|                 [('product_id', '=', self.id)], | |||
|                 order='create_date DESC').mapped('id') | |||
|         if not purchase_lines: | |||
|             raise UserError("No purchase history found.!") | |||
|         return { | |||
|             'domain': [('id', 'in', purchase_lines)], | |||
|             'views': [(rel_view_id.id, 'list')], | |||
|             'name': 'Purchase History', | |||
|             'res_model': 'purchase.order.line', | |||
|             'view_mode': 'list', | |||
|             'type': 'ir.actions.act_window', | |||
|         } | |||
| @ -0,0 +1,42 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################# | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| # | |||
| #    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | |||
| #    Author:Manasa T P(<https://www.cybrosys.com>) | |||
| #    You can modify it under the terms of the GNU AFFERO | |||
| #    GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | |||
| # | |||
| #    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | |||
| #    (AGPL v3) along with this program. | |||
| #    If not, see <http://www.gnu.org/licenses/>. | |||
| # | |||
| ############################################################################# | |||
| from odoo import fields, models | |||
| 
 | |||
| 
 | |||
| class PurchaseOrderLine(models.Model): | |||
|     """Inherited to add field purchase date in purchase order line""" | |||
|     _inherit = 'purchase.order.line' | |||
| 
 | |||
|     purchase_date = fields.Datetime(string='Purchase Date', store=True, | |||
|                                     related='order_id.date_order', | |||
|                                     help='Purchase order date') | |||
| 
 | |||
|     def action_get_product_form(self): | |||
|         """This function is to view product form in purchase order line""" | |||
|         self.product_id.order_partner_id = self.order_id.partner_id.id | |||
|         return { | |||
|             'name': self.product_id.name, | |||
|             'view_mode': 'form', | |||
|             'res_model': 'product.product', | |||
|             'type': 'ir.actions.act_window', | |||
|             'target': 'current', | |||
|             'res_id': self.product_id.id | |||
|         } | |||
| @ -0,0 +1,41 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################# | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| # | |||
| #    Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | |||
| #    Author:Manasa T P(<https://www.cybrosys.com>) | |||
| #    You can modify it under the terms of the GNU AFFERO | |||
| #    GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | |||
| # | |||
| #    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | |||
| #    (AGPL v3) along with this program. | |||
| #    If not, see <http://www.gnu.org/licenses/>. | |||
| # | |||
| ############################################################################# | |||
| from odoo import fields, models | |||
| 
 | |||
| class SaleOrderLine(models.Model): | |||
|     """Inherited SaleOrderLine to add custom fields and methods actions""" | |||
|     _inherit = 'sale.order.line' | |||
| 
 | |||
|     sale_date = fields.Datetime(string='Sale Date', help='Sale Order date', | |||
|                                 related='order_id.date_order', store=True) | |||
| 
 | |||
|     def action_get_product_form(self): | |||
|         """This function opens the product form from the sale order line""" | |||
|         if self.product_id: | |||
|             return { | |||
|                 'name': self.product_id.name, | |||
|                 'view_mode': 'form', | |||
|                 'res_model': 'product.product', | |||
|                 'type': 'ir.actions.act_window', | |||
|                 'target': 'current', | |||
|                 'res_id': self.product_id.id, | |||
|             } | |||
|         return {'type': 'ir.actions.act_window_close'} | |||
| After Width: | Height: | Size: 2.2 KiB | 
| After Width: | Height: | Size: 28 KiB | 
| After Width: | Height: | Size: 628 KiB | 
| After Width: | Height: | Size: 1.1 KiB | 
| After Width: | Height: | Size: 210 KiB | 
| After Width: | Height: | Size: 209 KiB | 
| After Width: | Height: | Size: 109 KiB | 
| After Width: | Height: | Size: 495 B | 
| After Width: | Height: | Size: 1.0 KiB | 
| After Width: | Height: | Size: 624 B | 
| After Width: | Height: | Size: 136 KiB | 
| After Width: | Height: | Size: 214 KiB | 
| After Width: | Height: | Size: 36 KiB | 
| After Width: | Height: | Size: 3.6 KiB | 
| After Width: | Height: | Size: 310 B | 
| After Width: | Height: | Size: 929 B | 
| After Width: | Height: | Size: 1.3 KiB | 
| After Width: | Height: | Size: 3.3 KiB | 
| After Width: | Height: | Size: 1.4 KiB | 
| After Width: | Height: | Size: 17 KiB | 
| After Width: | Height: | Size: 542 B | 
| After Width: | Height: | Size: 576 B | 
| After Width: | Height: | Size: 733 B | 
| After Width: | Height: | Size: 4.3 KiB | 
| After Width: | Height: | Size: 1.2 KiB | 
| After Width: | Height: | Size: 4.0 KiB | 
| After Width: | Height: | Size: 1.7 KiB | 
| After Width: | Height: | Size: 738 KiB | 
| After Width: | Height: | Size: 2.2 KiB | 
| After Width: | Height: | Size: 911 B | 
| After Width: | Height: | Size: 1.1 KiB | 
| After Width: | Height: | Size: 1.2 KiB | 
| After Width: | Height: | Size: 1.2 KiB | 
| After Width: | Height: | Size: 600 B | 
| After Width: | Height: | Size: 673 B | 
| After Width: | Height: | Size: 2.0 KiB | 
| After Width: | Height: | Size: 462 B | 
| After Width: | Height: | Size: 2.1 KiB | 
| After Width: | Height: | Size: 926 B | 
| After Width: | Height: | Size: 9.0 KiB | 
| After Width: | Height: | Size: 23 KiB | 
| After Width: | Height: | Size: 7.0 KiB | 
| After Width: | Height: | Size: 878 B | 
| After Width: | Height: | Size: 1.2 KiB | 
| After Width: | Height: | Size: 653 B | 
| After Width: | Height: | Size: 800 B | 
| After Width: | Height: | Size: 905 B | 
| After Width: | Height: | Size: 189 KiB | 
| After Width: | Height: | Size: 4.3 KiB | 
| After Width: | Height: | Size: 839 B | 
| After Width: | Height: | Size: 1.7 KiB | 
| After Width: | Height: | Size: 5.9 KiB | 
| After Width: | Height: | Size: 1.6 KiB | 
| After Width: | Height: | Size: 34 KiB | 
| After Width: | Height: | Size: 26 KiB | 
| After Width: | Height: | Size: 3.8 KiB | 
| After Width: | Height: | Size: 23 KiB | 
| After Width: | Height: | Size: 1.9 KiB | 
| After Width: | Height: | Size: 2.3 KiB | 
| After Width: | Height: | Size: 427 B | 
| After Width: | Height: | Size: 627 B | 
| After Width: | Height: | Size: 1.1 KiB | 
| After Width: | Height: | Size: 1.2 KiB | 
| After Width: | Height: | Size: 988 B | 
| After Width: | Height: | Size: 3.7 KiB | 
| After Width: | Height: | Size: 5.0 KiB | 
| After Width: | Height: | Size: 875 B | 
| After Width: | Height: | Size: 1.2 KiB | 
| After Width: | Height: | Size: 92 KiB | 
| After Width: | Height: | Size: 93 KiB | 
| After Width: | Height: | Size: 93 KiB | 
| After Width: | Height: | Size: 88 KiB | 
| After Width: | Height: | Size: 92 KiB | 
| After Width: | Height: | Size: 86 KiB | 
| After Width: | Height: | Size: 83 KiB | 
| After Width: | Height: | Size: 76 KiB | 
| After Width: | Height: | Size: 76 KiB | 
| After Width: | Height: | Size: 60 KiB | 
| After Width: | Height: | Size: 108 KiB | 
| After Width: | Height: | Size: 57 KiB | 
| After Width: | Height: | Size: 31 KiB | 
| After Width: | Height: | Size: 468 KiB | 
| After Width: | Height: | Size: 880 KiB | 
| After Width: | Height: | Size: 779 KiB | 
| After Width: | Height: | Size: 40 KiB | 
| @ -0,0 +1,29 @@ | |||
| <?xml version="1.0"?> | |||
| <odoo> | |||
| <!--    Product view inherited to add field--> | |||
|     <record  id="product_normal_form_view" model="ir.ui.view"> | |||
|         <field name="name">product.product.view.form.inherit.sale.purchase.previous.product.cost</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> | |||
|                     <group> | |||
|                         <group> | |||
|                              <button name="action_sale_product_prices" string="Previous Sale Rates" | |||
|                                 help="Last Prices" type="object"/> | |||
|                             <button name="action_purchase_product_prices" string="Previous Purchase Rates" | |||
|                                 help="Last Prices" type="object"/> | |||
|                         </group> | |||
|                     </group> | |||
|                 </page> | |||
|             </xpath> | |||
|         </field> | |||
|     </record> | |||
| </odoo> | |||
| @ -0,0 +1,36 @@ | |||
| <?xml version="1.0"?> | |||
| <odoo> | |||
|     <!--    Inherited to add button to view product form--> | |||
|     <record id="purchase_order_form" model="ir.ui.view"> | |||
|         <field name="name"> | |||
|             purchase.order.view.form.inherit.sale.purchase.previous.product.cost | |||
|         </field> | |||
|         <field name="model">purchase.order</field> | |||
|         <field name="inherit_id" ref="purchase.purchase_order_form"/> | |||
|         <field name="arch" type="xml"> | |||
|             <xpath expr="//field[@name='order_line']/list//field[@name='product_id']" | |||
|                    position="before"> | |||
|                 <button name="action_get_product_form" type="object" | |||
|                         title="Sale/Purchase History" | |||
|                         icon="fa-external-link" string=""/> | |||
|             </xpath> | |||
|         </field> | |||
|     </record> | |||
|     <!--To view last Sale or purchase details like price--> | |||
|     <record id="purchase_order_line_view_tree" model="ir.ui.view"> | |||
|         <field name="name">purchase.order.line.view.tree</field> | |||
|         <field name="model">purchase.order.line</field> | |||
|         <field name="priority" eval="40"/> | |||
|         <field name="arch" type="xml"> | |||
|             <list string="Last Product Prices"> | |||
|                 <field name="order_id"/> | |||
|                 <field name="partner_id"/> | |||
|                 <field name="purchase_date"/> | |||
|                 <field name="product_id"/> | |||
|                 <field name="product_qty"/> | |||
|                 <field name="price_unit"/> | |||
|                 <field name="price_subtotal"/> | |||
|             </list> | |||
|         </field> | |||
|     </record> | |||
| </odoo> | |||
| @ -0,0 +1,34 @@ | |||
| <?xml version="1.0"?> | |||
| <odoo> | |||
|     <!-- Inherited to add button to view product form in sale order line --> | |||
|     <record id="view_order_form" model="ir.ui.view"> | |||
|         <field name="name">sale.order.view.form.inherit.sale.purchase.previous.product.cost</field> | |||
|         <field name="model">sale.order</field> | |||
|         <field name="inherit_id" ref="sale.view_order_form"/> | |||
|         <field name="arch" type="xml"> | |||
|             <xpath expr="//field[@name='order_line']/list/field[@name='product_id']" position="before"> | |||
|                 <button name="action_get_product_form" type="object" | |||
|                         title="Sale/Purchase History" | |||
|                         icon="fa-external-link" string=""/> | |||
|             </xpath> | |||
|         </field> | |||
|     </record> | |||
| 
 | |||
|     <!-- Tree view for last sale or purchase details --> | |||
|     <record id="sale_order_line_view_tree" model="ir.ui.view"> | |||
|         <field name="name">sale.order.line.view.tree</field> | |||
|         <field name="model">sale.order.line</field> | |||
|         <field name="priority" eval="40"/> | |||
|         <field name="arch" type="xml"> | |||
|             <list string="Last Product Prices"> | |||
|                 <field name="order_id"/> | |||
|                 <field name="order_partner_id"/> | |||
|                 <field name="sale_date"/> | |||
|                 <field name="product_id"/> | |||
|                 <field name="product_uom_qty"/> | |||
|                 <field name="price_unit"/> | |||
|                 <field name="price_subtotal"/> | |||
|             </list> | |||
|         </field> | |||
|     </record> | |||
| </odoo> | |||