123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- # -*- coding: utf-8 -*-
- ###################################################################################
- #
- # Odoo, Open Source Management Solution
- # Copyright (C) 2014-TODAY Prime Consulting, Cape Verde (<http://www.prime.cv>).
- #
- ###################################################################################
- from odoo import models, fields, api
- class ResPartner(models.Model):
- _inherit = "res.partner"
- @api.depends('custom_sales_id')
- def set_custom_sales(self):
- for partner in self:
- if partner.custom_sales_id:
- partner.custom_sales = True
- else:
- partner.custom_sales = False
- region_id = fields.Many2one('res.partner.region', 'Region')
- division_id = fields.Many2one('res.partner.division', 'Division')
- segment_id = fields.Many2one('res.segment', 'Segment', domain=[('type','=','partner')])
- custom_sales = fields.Boolean('Custom Sales Partner?', compute="set_custom_sales", store=True)
- custom_sales_id = fields.Char('Custom Identifier')
- class ResPartnerRegion(models.Model):
- _name = "res.partner.region"
- _description = "Partner Region"
- name = fields.Char("Region Name", required=True, translate=True)
- class ResPartnerDivision(models.Model):
- _name = "res.partner.division"
- _description = "Partner Division"
- name = fields.Char("Division Name", required=True, translate=True)
- class ResSegment(models.Model):
- _name = "res.segment"
- _description = "Segment"
- type = fields.Selection([('partner', 'Partner'), ('product', 'Product')], 'Segment Type', required=True)
- name = fields.Char("Segment Name", required=True, translate=True)
- class ProductTemplate(models.Model):
- _inherit = "product.template"
- @api.depends('custom_sales_id')
- def set_custom_sales(self):
- for product in self:
- if product.custom_sales_id:
- product.custom_sales = True
- else:
- product.custom_sales = False
- segment_id = fields.Many2one('res.segment', 'Segment', domain=[('type','=','product')])
- site = fields.Char('Site')
- platform = fields.Char('Platform')
- custom_sales = fields.Boolean('Custom Sales Product?', compute="set_custom_sales", store=True)
- custom_sales_id = fields.Char('Custom Identifier')
-
- class ProductProduct(models.Model):
- _inherit = "product.product"
- @api.depends('custom_sales_id')
- def set_custom_sales(self):
- for product in self:
- if product.custom_sales_id:
- product.custom_sales = True
- else:
- product.custom_sales = False
- segment_id = fields.Many2one('res.segment', 'Segment', domain=[('type','=','product')])
- site = fields.Char('Site')
- platform = fields.Char('Platform')
- custom_sales = fields.Boolean('Custom Sales Product?', compute="set_custom_sales", store=True)
- custom_sales_id = fields.Char('Custom Identifier')
- class CustomSaleOrder(models.Model):
- _name = "custom.sale.order"
- _description = "Custom Sales Order"
- _inherit = ['mail.thread', 'ir.needaction_mixin']
- custom_sales_id = fields.Char('Custom Identifier', required=True)
- date = fields.Date('Date')
- year = fields.Char('Year')
- month = fields.Char('Month')
- planning_scenario = fields.Char('Planning Scenario')
- partner_division_id = fields.Many2one('res.partner.division', 'Division')
- partner_id = fields.Many2one('res.partner', 'Customer', domain=[('custom_sales','=',True)])
- sale_type = fields.Char('Type of Sales')
- pipeline_category = fields.Char('Pipeline Category')
- product_id = fields.Many2one('product.product', 'Product')
- quantity = fields.Float('Quantity')
- quantity_actuals = fields.Float('Quantity Actuals')
- quantity_total_pipeline = fields.Float('Quantity total pipeline')
- amount_forecast = fields.Float('Amount Forecast')
- currency_id = fields.Many2one('res.currency', 'Currency')
- planner = fields.Char('Planner')
|