I am using the Odoo 12 Community version. When I navigate to an employee an error shows ValueError: Field 'ifsc' does not exist and can't open the employee menu. I have inherited employee and it exists in both view and model.
class HrEmployeeInherit(models.Model):
_inherit = 'hr.employee'
sno = fields.Integer(string='Serial No.')
pay = fields.Integer(string='Paycode')
employee_name = fields.Char(string='Emp Name')
designation = fields.Char(string="Designation")
account = fields.Char(string="Account")
bank = fields.Char(string="Bank")
doj = fields.Date(string="Date Of Joining")
ifsc = fields.Char(string="IFSC Code")
present = fields.Float(string="Present Day")
m = fields.Char(string="M-L")
wd = fields.Float(string="WD")
sat = fields.Integer(string="Saturday/Holiday")
week = fields.Integer(string="WeekOff")
leave = fields.Float(string="Leave Adjustment")
payable = fields.Float(string="Total Payable Days")
ot = fields.Float(string="Tdays-OT")
days = fields.Integer(string="T.Days")
wages = fields.Integer(string="Basic wages")
curre = fields.Float(string="Current sal")
sal = fields.Integer(string="% of Salary")
covid = fields.Float(string="Covid 19 salary")
pf = fields.Float(string="PF")
esi = fields.Float(string="Esi")
pay = fields.Integer(string="Payable")
adv = fields.Integer(string="Advance")
tds = fields.Integer(string="Tds")
netpay = fields.Float(string="Net Payable")
icici = fields.Float(string="ICICI")
I have added 'depends': ['base','hr_contract','hr','hr_payroll'] in depends.
Related
I have got 2 tables "animal_breeds" and "ztmp.ztmp_509810_anims_out". In "animals breed" every animal has key and breed name and percentage. Few animals might have 2 different breeds with different percentage. Now based on the animals key in "animals_breeds" i want to update "ztmp.ztmp_509810_anims_out"
i am using this code which i know is wrong
update ztmp.ztmp_509810_anims_out
set
alt_id1 = ab.breed
,alt_id2 = pcnt
,alt_id3 = ab.breed
,alt_id4 = pcnt
,alt_id5 = ab.breed
,alt_id6 = pcnt
,alt_id7 = ab.breed
,alt_id8 = pcnt
from animal_breeds ab
where ab.soc_code = ztmp_509810_anims_out.soc_code and ab.animals_key = ztmp_509810_anims_out.animals_key
and ab.soc_code = 'AUNDB';
could i use a for loop inside an update statement?
UPDATE ztmp.ztmp_509810_anims_out AS z
SET soc_code = q.soc_code,
animals_key = q.animals_key,
alt_id1 = breeds[1],
alt_id2 = pcnts[1],
alt_id3 = breeds[2],
alt_id4 = pcnts[2]
FROM (SELECT soc_code, animals_key,
array_agg(breed) breeds, array_agg(pcnt) pcnts
FROM animal_breeds
GROUP BY soc_code, animals_key
) q
WHERE z.soc_code = q.soc_code
AND z.animals_key = q.animals_key;
If there can be more than 2 breeds per animals_key, add breeds[3] and pcnts[3] and so on.
I have the following code:
UPDATE sm
SET sm_fecha_venc = (SELECT MIN(nd_fecha_venc) FROM [db_facturacion].[dbo].[tb_notas_debito]
WHERE sm_codigo = nd_num_servicio
-- AND nd_referencia = sm_cod_producto
AND nd_num_factura = sm_cod_factura
AND nd_estado = 'G')
,sm_fecha_ult_pago = (SELECT MAX(nd_fecha_pago) FROM [db_facturacion].[dbo].[tb_notas_debito]
WHERE sm_codigo = nd_num_servicio
-- AND nd_referencia = sm_cod_producto
AND nd_num_factura = sm_cod_factura
AND nd_estado = 'C')
,sm_fecha = GETDATE()
,sm_cod_factura_ren = #i_num_factura
OUTPUT DELETED.sm_fecha_venc AS FECHA_VENC_OLD,
DELETED.sm_fecha_ult_pago AS FECHA_ULT_PAGO_OLD,
DELETED.sm_fecha AS FECHA_OLD,
DELETED.sm_cod_factura_ren AS COD_FACTURA_REN_OLD
INTO #TABLATABLA --
FROM [db_facturacion].[dbo].[tb_servicios] sm --WITH(NOLOCK)
INNER JOIN #servicios AS T ON sm_codigo = num_servicio
WHERE sm_tipo_bien_protegido = 1
AND [sm_estado] = 1
--AND sm.sm_cod_forma_contrato = 1
AND sm.sm_tipo_inventario = tipo_inventario
/*===========================
INSERTED DELETED
=============================*/
UPDATE db_facturacion.[dbo].[tb_log_cambio_servicio]
SET cs_fecha_venc_old = FECHA_VENC_OLD
,cs_fecha_ult_pago_old = FECHA_ULT_PAGO_OLD
,cs_fecha_old = FECHA_OLD
,cs_cod_factura_ren_old = COD_FACTURA_REN_OLD
FROM #TABLATABLA
WHERE cs_codigo = #ID_ULTIMO_ING (LAST ##IDENTITY)
Im trying to save the last dates into a log table, just in case I have to return those dates back.
The code works good, just that it's catching the actual date and inserted in the log table.
What am I missing?
I have the following peewee tables/classes (on a postgres DB) and below the dashed line, an example of what I'd like.
Basically I'm a complete newb at DB queries and have no idea how to structure it: I need, given a list of days (like ['2015-01-01', ...]) to obtain the number of Alerts on each day (if there were any) as a count per Service. Hopefully the example below is clear enough.
class Event(BaseModel):
assessment = CharField(max_length = 4096)
day = DateField()
ongoing = BooleanField()
alertType = CharField(null = True)
links = CharField(null = True, max_length = 4096)
newLinks = CharField(null = True, max_length = 4096)
startTime = TimeField()
endTime = TimeField(null = True)
class Service(BaseModel):
svcid = TextField(unique = True)
name = TextField()
class Alert(BaseModel):
alertId = CharField(unique = True, null = True)
alertLink = CharField(unique = True, null = True)
startTime = TimeField()
endTime = TimeField(null = True)
jcaLink = CharField(max_length = 4096, null = True)
description = CharField(max_length = 4096)
relatedNodes = CharField(null = True)
customerName = CharField(null = True)
jcaUrl = CharField(null = True)
deviceName = CharField(null = True)
event = ForeignKeyField(Event, related_name = 'alerts')
service = ForeignKeyField(Service, related_name = 'alerts')
hosted = CharField(default = None, null = True)
------------------------------------------------------------
Example: Event.id 1 has Event.day '2015-01-01'
Event.id 2 has Event.day '2015-01-02'
Service.id 1 has name "A"
Service.id 2 has name "B"
Alert.id 1 has Alert.event.id 1, Alert.service.id 1
Alert.id 2 has Alert.event.id 2, Alert.service.id 2
Alert.id 3 has Alert.event.id 2, Alert.service.id 1
# end of db
If days is ['2015-01-01', '2015-01-02'], output should be like (not resembling, just broken up/organized somewhat like)
Service A
day 2015-01-01
1 alert
day 2015-01-02
1 alert
-----------------
Service B
day 2015-01-01
1 alert
day 2015-01-02
0 alerts
This should do it. I am not sure if your model adds columns like s.id but I imagine it does. Your start_time is a time field so I use the date() method so we are just comparing date parts.
select s.name, date(a.start_time) as alert_date, count(s.name) as alerts
from alert a join service s on a.service_id = s.id
where date(a.start_time) in ('2015-01-01', '2015-01-02')
group by s.name, alert_date
Note that when doing a group by, all fields selected must be used in a group by or aggregate function. There are ways around this but since you need such little data it was not necessary however I am assuming that service.name is unique.
Also, if you want to get alerts by month, year, etc. you can use extract like this:
select s.name, extract(month from a.start_time) as alert_month,
extract(year from a.start_time) as alert_year, count(s.name) as alerts
from alert a join service s on a.service_id = s.id
where extract(year from a.start_time) = 2015
and extract(month from a.start_time) in (11, 12)
group by s.name, alert_month, alert_year
I make sales and procurement system and when I work a query, or search the invoice number, the results appear in palm leaves View, but appears only in a row while the bill by no more than one row
And this was used by code
i.m used vb.net and database sql and b yway linq to sql
Try
Dim data = (From d In DBVariable.Data.masterfatoras
From f In DBVariable.Data.fatoras
From na In DBVariable.Data.asnafs
From sup In DBVariable.Data.suppliers
Where d.ID = f.mid Where d.num.Contains(txt)
Select d, f, na, sup).FirstOrDefault
TextBoxX1.Text = data.d.num
nammord.Text = (From supp In DBVariable.Data.suppliers Where data.d.idmord = supp.ID Select supp.Name).Single()
txtmord.Text = (From supp In DBVariable.Data.suppliers Where data.d.idmord = supp.ID Select supp.Code).Single()
adrmord.Text = (From supp In DBVariable.Data.suppliers Where data.d.idmord = supp.ID Select supp.Address).Single()
nodaf.Text = data.d.nodfa
' ''نفاصيل الفاتورة
For p As Integer = 0 To gridshraa.Rows.Count - 1
gridshraa.Rows(p).Cells(2).Value = (From asna In DBVariable.Data.asnafs Where data.f.idname = asna.ID Select asna.Name).Single()
gridshraa.Rows(p).Cells(1).Value = (From asna In DBVariable.Data.asnafs Where data.f.idname = asna.ID Select asna.code).Single()
gridshraa.Rows(p).Cells(3).Value = (From asna In DBVariable.Data.asnafs Where data.f.idname = asna.ID Select asna.unit).Single()
gridshraa.Rows(p).Cells(4).Value = data.f.qty
gridshraa.Rows(p).Cells(5).Value = data.f.price
gridshraa.Rows(p).Cells(6).Value = data.f.totprice
Next
Catch
End Try
I am new to VB.net and facing a strange situation. I have a structure that contains another structure. The inner structure is nullable. Now wht I do is something like the following. I create a new instance of the inner structure, set the member variables and assign the whole structure to the inner structure of the parent. But it is giving an error. The assignment is not successful. If I try to peek into the structure in the watch window, it says "property evaluation failed" for the HasValue and Value properties.
Dim testData As List(Of TestData) = Nothing
Dim testData_List1 As New TestData
With testData_List1.commonTestParam
.AccuchekActiveEnergy = 2.56
.AccuchekActiveEnergyUnit = ActiveEnergyUnit.KiloWattHour
.AccuchekApparentEnergy = 34.56
.AccuchekApparentEnergyUnit = ApparentEnergyUnit.VoltAmpereHour
.AccuchekFrequency = 1
.AccuchekRange = "20474 ewr 34324"
.AccuchekType = AccuchekType.AccuchekOne
.ActiveLoadRPhase = 145
.AvgActiveLoad = 2.56
.AvgActiveLoadUnit = ActiveLoadUnit.Watt
.AvgPowerFactor = 0
.AvgPowerFactorType = PowerFactorType.PFLag
.ConditionalFlag1 = 0
.ConsumerNo = "343122050242"
.CurrentRPhase = 1
.GeneralFlag1 = 0
.InstantaneousPFRPhase = 2
.ManufacturingYear = 2009
.MeterActiveEnergy = 258.89
.MeterActiveEnergyUnit = ActiveEnergyUnit.KiloWattHour
.MeterActiveError = 20
.MeterApparentError = 14
.MeterConstant = 3200
.MeterConstantUnit = MeterConstantUnit.RevsPerkVAh
.MeterMake = "DS"
.MeterSNo = "6563402"
.MeterTypeAndClass = MeterTypeAndClass.MTCElectorMechWith20
.MTFID = "123456789"
.NoofTestRevolutions = 100
.PulseCriteria = 0
.RatedBasic = 25
.RatedMax = 30
.RatedVoltage = 15
.ReactiveCurrentRPhase = 145
.RemarkID = 0
.TestDateAndTime = "100320101545"
.TestDuration = 2145
.TesterCode = 0
.TestID = "147852"
.TestMode = TestMode.TMOpticalScanner
.TestNumber = 0
.VoltageRPhase = 145
End With
Dim accuchek3TestParameters1 As New Accuchek3PhaseTestParameters
With accuchek3TestParameters1
.AccuchekReactiveLagEnergy = 2.46
.AccuchekReactiveLagEnergyUnit = ReactiveEnergyUnit.KiloVoltAmpereReactiveHour
.AccuchekReactiveLeadEnergy = 2.56
.AccuchekReactiveLeadEnergyUnit = ReactiveEnergyUnit.KiloVoltAmpereReactiveHour
.ActiveLoadBPhase = 14
.ActiveLoadYPhase = 15
.AvgApparentLoad = 10
.AvgApparentLoadUnit = ApparentLoadUnit.KiloVoltAmpere
.AvgReactiveLagLoad = 14
.AvgReactiveLagLoadUnit = ReactiveLoadUnit.KiloVoltAmpereReactive
.AvgReactiveLeadLoad = 15
.AvgReactiveLeadLoadUnit = ReactiveLoadUnit.KiloVoltAmpereReactive
.ConditionalFlag2 = 0
.ConditionalFlag3 = 0
.CTRatio = 1.23
.CurrentBPhase = 10
.CurrentYPhase = 11
.InstantaneousPFBPhase = 0
.InstantaneousPFYPhase = 1
.MeterApparentEnergy = 1.01
.MeterApparentUnit = ApparentEnergyUnit.KiloVoltAmpereHour
.MeterReactiveLagEnergy = 1.25
.MeterReactiveLagError = 1.25
.MeterReactiveLagUnit = ReactiveEnergyUnit.KiloVoltAmpereReactiveHour
.MeterReactiveLeadEnergy = 1.45
.MeterReactiveLeadError = 1.56
.MeterReactiveLeadUnit = ReactiveEnergyUnit.KiloVoltAmpereReactiveHour
.PercentageLoad = 1
.PTRatio = 1
.ReactiveCurrentBPhase = 10
.ReactiveCurrentYPhase = 11
.VoltageBPhase = 10
.VoltageYPhase = 10
End With
testData_List1.accuchek3TestParameters = accuchek3TestParameters1
testData.Add(testData_List1)
Can somebody please guide me?
Your first line is:
Dim testData As List(Of TestData) = Nothing
Then at the bottom you do
testData.Add(testData_List1)
I can't see anywhere in between where you do something like:
testData = New List(Of TestData)()
Though it's slightly hard to read since you've got both a variables and types with TestData as their name (or part of their name) so I might just be missing that.