summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-01-18 14:37:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-01-18 14:37:50 +0700
commit09c074be5de4fc10f6322303236b5919ff8234fb (patch)
treee6b42fb2f0375cffb60f925d40e1ff20dbe1bcb5
parent780f1a71a5fe3d053b0163f7be495497c84349d7 (diff)
add reference number in sales target
-rw-r--r--indoteknik_custom/models/sales_target.py6
-rw-r--r--indoteknik_custom/views/sales_target.xml1
2 files changed, 5 insertions, 2 deletions
diff --git a/indoteknik_custom/models/sales_target.py b/indoteknik_custom/models/sales_target.py
index 9069fa6a..c31a4470 100644
--- a/indoteknik_custom/models/sales_target.py
+++ b/indoteknik_custom/models/sales_target.py
@@ -18,11 +18,13 @@ class SalesTarget(models.Model):
target = fields.Float(string='Target')
ach_per_year = fields.Float(string='Ach/Year%', compute='_compute_achievement')
ach_per_month = fields.Float(string='Ach/Month%', compute='_compute_achievement')
- sales_id = fields.Many2one('res.users', string='Salesperson', compute='_compute_salesperson')
+ sales_id = fields.Many2one('res.users', string='Salesperson', compute='_compute_partner')
+ reference = fields.Char(string='Reference', compute='_compute_partner')
- def _compute_salesperson(self):
+ def _compute_partner(self):
for sales_target in self:
sales_target.sales_id = sales_target.partner_id.user_id
+ sales_target.reference = sales_target.partner_id.reference_number
def _compute_achievement(self):
for sales_target in self:
diff --git a/indoteknik_custom/views/sales_target.xml b/indoteknik_custom/views/sales_target.xml
index b77ea5d4..08218913 100644
--- a/indoteknik_custom/views/sales_target.xml
+++ b/indoteknik_custom/views/sales_target.xml
@@ -43,6 +43,7 @@
<group>
<group>
<field name="partner_id"/>
+ <field name="reference"/>
<field name="sales_id"/>
<field name="period"/>
<field name="omset_last_year"/>